Added smoke signal for UNI21 burn missing big indian
This commit is contained in:
parent
d96e6e3e6e
commit
95eeb90ccd
|
@ -336,16 +336,22 @@ public class FourCornerZionStenoLexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handlePoints(List<Integer> slicedPoints) {
|
private void handlePoints(List<Integer> slicedPoints) {
|
||||||
|
boolean errorUnusedBigIndian = false; // are optional
|
||||||
List<Integer> result = new ArrayList<>();
|
List<Integer> result = new ArrayList<>();
|
||||||
int codePoint22 = 0;
|
int codePoint22 = 0;
|
||||||
for (Integer cakePoint : slicedPoints) {
|
for (Integer cakePoint : slicedPoints) {
|
||||||
if (cakePoint >= FourCornerDotCake.FC_UNI2K_22.getStart() && cakePoint <= FourCornerDotCake.FC_UNI2K_22.getStop()) {
|
if (cakePoint >= FourCornerDotCake.FC_UNI2K_22.getStart() && cakePoint <= FourCornerDotCake.FC_UNI2K_22.getStop()) {
|
||||||
codePoint22 = cakePoint - FourCornerDotCake.FC_UNI2K_22.getStart();
|
codePoint22 = cakePoint - FourCornerDotCake.FC_UNI2K_22.getStart();
|
||||||
|
errorUnusedBigIndian = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int codePointL = cakePoint - FourCornerDotCake.FC_UNI2K_11.getStart();
|
int codePointL = cakePoint - FourCornerDotCake.FC_UNI2K_11.getStart();
|
||||||
int codePoint = (codePoint22 << 11) + codePointL;
|
int codePoint = (codePoint22 << 11) + codePointL;
|
||||||
result.add(codePoint);
|
result.add(codePoint);
|
||||||
|
errorUnusedBigIndian = false;
|
||||||
|
}
|
||||||
|
if (smokeSignals != null && errorUnusedBigIndian) {
|
||||||
|
smokeSignals.burnUNI21UnusedBigIndian(currLine, currCol);
|
||||||
}
|
}
|
||||||
handler.strobeUnicode(result);
|
handler.strobeUnicode(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ public interface FourCornerZionStenoLexerSmoke {
|
||||||
|
|
||||||
void burnInvalidEscape(int line, int col, int cakePoint);
|
void burnInvalidEscape(int line, int col, int cakePoint);
|
||||||
|
|
||||||
|
void burnUNI21UnusedBigIndian(int line, int col);
|
||||||
|
|
||||||
void burnNCR1632ZeroSparks(int line, int col);
|
void burnNCR1632ZeroSparks(int line, int col);
|
||||||
|
|
||||||
void burnNCR1632UnusedSparks(int line, int col);
|
void burnNCR1632UnusedSparks(int line, int col);
|
||||||
|
@ -58,6 +60,10 @@ public interface FourCornerZionStenoLexerSmoke {
|
||||||
default void burnInvalidEscape(int line, int col, int cakePoint) {
|
default void burnInvalidEscape(int line, int col, int cakePoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void burnUNI21UnusedBigIndian(int line, int col) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void burnNCR1632ZeroSparks(int line, int col) {
|
default void burnNCR1632ZeroSparks(int line, int col) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,28 +41,7 @@ import org.x4o.o2o.fc18.zero33.FCDotDEC0127DashPX0;
|
||||||
*/
|
*/
|
||||||
public class LexerNCRTest {
|
public class LexerNCRTest {
|
||||||
|
|
||||||
SmokeReader SMOKE_READER = new SmokeReader();
|
final TestSmokeReader SMOKE_READER = new TestSmokeReader();
|
||||||
|
|
||||||
class SmokeReader implements FourCornerZionStenoLexerSmoke.Adapter {
|
|
||||||
|
|
||||||
int errorNCRZeroSparks = -1;
|
|
||||||
int errorNCRUnusedSparks = -1;
|
|
||||||
|
|
||||||
public void reset() {
|
|
||||||
errorNCRZeroSparks = -1;
|
|
||||||
errorNCRUnusedSparks = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void burnNCR1632ZeroSparks(int line, int col) {
|
|
||||||
errorNCRZeroSparks = line;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void burnNCR1632UnusedSparks(int line, int col) {
|
|
||||||
errorNCRUnusedSparks = line;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNCRInvalid() throws Exception {
|
public void testNCRInvalid() throws Exception {
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014, Willem Cazander
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package org.x4o.o2o.fc18.zion7;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.x4o.o2o.fc18.FourCornerDotCake;
|
||||||
|
import org.x4o.o2o.fc18.FourCornerUnicodeDisplay;
|
||||||
|
import org.x4o.o2o.fc18.FourCornerX06BaklavaPoints;
|
||||||
|
import org.x4o.o2o.fc18.zero33.FCDotCDC1604DashP6;
|
||||||
|
import org.x4o.o2o.fc18.zero33.FCDotDEC0127DashPX0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests four corner lexer parts.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Jan 14, 2025
|
||||||
|
*/
|
||||||
|
public class LexerUNI21Test {
|
||||||
|
|
||||||
|
final TestSmokeReader SMOKE_READER = new TestSmokeReader();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUNI21Invalid() throws Exception {
|
||||||
|
FourCornerZionStenoLexer lexer = new FourCornerZionStenoLexer(new FourCornerZion7Candlelier.Adapter() {}, true);
|
||||||
|
lexer.withSmokeSignals(SMOKE_READER);
|
||||||
|
List<Integer> cdc = new ArrayList<>();
|
||||||
|
cdc.add(FourCornerDotCake.FC_UNI2K_22.getStart() + 123);
|
||||||
|
|
||||||
|
SMOKE_READER.reset();
|
||||||
|
Assertions.assertEquals(-1, SMOKE_READER.errorUNI21UnusedBigIndian);
|
||||||
|
lexer.read(cdc);
|
||||||
|
Assertions.assertEquals(0, SMOKE_READER.errorUNI21UnusedBigIndian);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2014, Willem Cazander
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||||
|
* that the following conditions are met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
|
||||||
|
* following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
|
||||||
|
* the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||||
|
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package org.x4o.o2o.fc18.zion7;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests four corner lexer parts.
|
||||||
|
*
|
||||||
|
* @author Willem Cazander
|
||||||
|
* @version 1.0 Jan 14, 2025
|
||||||
|
*/
|
||||||
|
public class TestSmokeReader implements FourCornerZionStenoLexerSmoke {
|
||||||
|
|
||||||
|
int errorNCRZeroSparks;
|
||||||
|
int errorNCRUnusedSparks;
|
||||||
|
int errorUNI21UnusedBigIndian;
|
||||||
|
int errorUnsupport;
|
||||||
|
int errorRecursive;
|
||||||
|
|
||||||
|
public TestSmokeReader() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset() {
|
||||||
|
errorNCRZeroSparks = -1;
|
||||||
|
errorNCRUnusedSparks = -1;
|
||||||
|
errorUNI21UnusedBigIndian = -1;
|
||||||
|
errorUnsupport = -1;
|
||||||
|
errorRecursive = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnNCR1632ZeroSparks(int line, int col) {
|
||||||
|
errorNCRZeroSparks = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnNCR1632UnusedSparks(int line, int col) {
|
||||||
|
errorNCRUnusedSparks = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnUNI21UnusedBigIndian(int line, int col) {
|
||||||
|
errorUNI21UnusedBigIndian = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnUnsupported(int line, int col, int cakePoint) {
|
||||||
|
errorUnsupport = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnRecursive(int line, int col) {
|
||||||
|
errorRecursive = line;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnInvalidSalah(int line, int col) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void burnInvalidEscape(int line, int col, int cakePoint) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue