Made steno lexer scanners static
This commit is contained in:
parent
88184157c5
commit
cfe85a7911
|
@ -49,49 +49,30 @@ public class FourCornerZionStenoLexer {
|
|||
private final static FourCornerZionStenoLexerFire CLEAN_FIRE = new FourCornerZionStenoLexerFire.Adapter() {};
|
||||
private final static FourCornerZionStenoLexerSmoke CLEAN_SMOKE = new FourCornerZionStenoLexerSmoke.Adapter() {};
|
||||
private final static FourCornerZion7SalahSequence CLEAN_PRAYER = new FourCornerZion7SalahSequence.Adapter() {};
|
||||
private final static List<StenoScanner> CAKE_SLICE_EATERS = new ArrayList<>();
|
||||
private final boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
private final FourCornerZion7AlphaOmega handlerDocument;
|
||||
private final FourCornerZion7WaterCodex handlerCodex;
|
||||
private final FourCornerZion7SalahSequence handlerSalahSequence;
|
||||
private final FourCornerZion7TempleScrolls handlerTempleScrolls;
|
||||
private final List<StenoScanner> scanners = new ArrayList<>(); // TODO: make static is WIP
|
||||
private final int denominatorBank[] = new int[64]; // <== is the terminator select per 9 bit group
|
||||
private final int numeratorBank[] = new int[denominatorBank.length];
|
||||
private List<Integer> input;
|
||||
private int inputIndex = 0;
|
||||
private int currLine = 0;
|
||||
private int currCol = 0;
|
||||
private int cdcDECScanIndex = 0;
|
||||
private int cdcDECScanIndexEnd = 0;
|
||||
private FCDotDEC2701DashPX0 cdcDECMode = null;
|
||||
private FCDotINC0801DashP8 cdcDECModeInc = null;
|
||||
private FCDotDEC0801DashE10 cdcDECModeE10 = null;
|
||||
private Integer cdcDECModeNcr = null;
|
||||
private Integer cdcDECModePie = null;
|
||||
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
||||
private FourCornerZionStenoLexerFire fireSignals = CLEAN_FIRE;
|
||||
|
||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler) {
|
||||
this(handler, true);
|
||||
}
|
||||
|
||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
this.handlerEscape = handlerEscape;
|
||||
if (handler instanceof FourCornerZion7AlphaOmega) {
|
||||
this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler);
|
||||
} else {
|
||||
this.handlerDocument = CLEAN_BIBLE;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7WaterCodex) {
|
||||
this.handlerCodex = FourCornerZion7WaterCodex.class.cast(handler);
|
||||
} else {
|
||||
this.handlerCodex = CLEAN_WATER;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7SalahSequence) {
|
||||
this.handlerSalahSequence = FourCornerZion7SalahSequence.class.cast(handler);
|
||||
} else {
|
||||
this.handlerSalahSequence = CLEAN_PRAYER;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||
} else {
|
||||
this.handlerTempleScrolls = null;
|
||||
}
|
||||
static {
|
||||
for (FourCornerDotCake cakeSlice : FourCornerDotCake.values()) {
|
||||
if (cakeSlice.name().startsWith("__")) {
|
||||
continue; // can't handle reserved, we be reported as
|
||||
|
@ -120,13 +101,43 @@ public class FourCornerZionStenoLexer {
|
|||
if (FourCornerDotCake.FC_NCR1632_XN.equals(cakeSlice)) {
|
||||
continue; // parse block manually
|
||||
}
|
||||
this.scanners.add(new StenoScannerWordCakeSlice(cakeSlice));
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerWordCakeSlice(cakeSlice));
|
||||
}
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerCDCDEC());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerNCR18());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerUNI21());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerSandOlgoi());
|
||||
CAKE_SLICE_EATERS.add(new StenoScannerSandKhorkhoi());
|
||||
ArrayList.class.cast(CAKE_SLICE_EATERS).trimToSize();
|
||||
}
|
||||
|
||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler) {
|
||||
this(handler, true);
|
||||
}
|
||||
|
||||
public FourCornerZionStenoLexer(FourCornerZion7Candlelier handler, boolean handlerEscape) {
|
||||
this.handler = Objects.requireNonNull(handler);
|
||||
this.handlerEscape = handlerEscape;
|
||||
if (handler instanceof FourCornerZion7AlphaOmega) {
|
||||
this.handlerDocument = FourCornerZion7AlphaOmega.class.cast(handler);
|
||||
} else {
|
||||
this.handlerDocument = CLEAN_BIBLE;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7WaterCodex) {
|
||||
this.handlerCodex = FourCornerZion7WaterCodex.class.cast(handler);
|
||||
} else {
|
||||
this.handlerCodex = CLEAN_WATER;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7SalahSequence) {
|
||||
this.handlerSalahSequence = FourCornerZion7SalahSequence.class.cast(handler);
|
||||
} else {
|
||||
this.handlerSalahSequence = CLEAN_PRAYER;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||
} else {
|
||||
this.handlerTempleScrolls = null;
|
||||
}
|
||||
this.scanners.add(new StenoScannerCDCDEC());
|
||||
this.scanners.add(new StenoScannerNCR18());
|
||||
this.scanners.add(new StenoScannerUNI21());
|
||||
this.scanners.add(new StenoScannerSandOlgoi());
|
||||
this.scanners.add(new StenoScannerSandKhorkhoi());
|
||||
}
|
||||
|
||||
public FourCornerZionStenoLexer withSmokeSignals(FourCornerZionStenoLexerSmoke smokeSignals) {
|
||||
|
@ -179,7 +190,9 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
private ScanResult readTokens() {
|
||||
ScanResult result = ScanResult.NEXT;
|
||||
for (StenoScanner scanner : scanners) {
|
||||
final int cakeCutSize = CAKE_SLICE_EATERS.size();
|
||||
for (int i = 0; i < cakeCutSize; i++) {
|
||||
StenoScanner scanner = CAKE_SLICE_EATERS.get(i);
|
||||
result = scanner.scan(this);
|
||||
if (result.isEOF()) {
|
||||
return result;
|
||||
|
@ -231,6 +244,14 @@ public class FourCornerZionStenoLexer {
|
|||
handler.strobeNCR1632(denominator, numerator);
|
||||
}
|
||||
|
||||
private void decModeReset() {
|
||||
cdcDECMode = null;
|
||||
cdcDECModeInc = null;
|
||||
cdcDECModeE10 = null;
|
||||
cdcDECModeNcr = null;
|
||||
cdcDECModePie = null;
|
||||
}
|
||||
|
||||
abstract static private class StenoScanner {
|
||||
|
||||
protected final int blockStart;
|
||||
|
@ -470,15 +491,6 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
static class StenoScannerCDCDEC extends StenoScanner {
|
||||
|
||||
// TODO: remove state here
|
||||
private int cdcDECScanIndex = 0;
|
||||
private int cdcDECScanIndexEnd = 0;
|
||||
private FCDotDEC2701DashPX0 cdcDECMode = null;
|
||||
private FCDotINC0801DashP8 cdcDECModeInc = null;
|
||||
private FCDotDEC0801DashE10 cdcDECModeE10 = null;
|
||||
private Integer cdcDECModeNcr = null;
|
||||
private Integer cdcDECModePie = null;
|
||||
|
||||
public StenoScannerCDCDEC() {
|
||||
super(FourCornerDotCake.FC_CDC1604_P6.getStart(), FourCornerDotCake.FC_DEC2701_PX0.getStop());
|
||||
|
@ -486,17 +498,17 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
@Override
|
||||
public void process(FourCornerZionStenoLexer lexer, int idxFirst, int idxLast) {
|
||||
decModeReset();
|
||||
cdcDECScanIndex = idxFirst;
|
||||
cdcDECScanIndexEnd = idxLast;
|
||||
for (cdcDECScanIndex = idxFirst; cdcDECScanIndex <= cdcDECScanIndexEnd; cdcDECScanIndex++) {
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECScanIndex = idxFirst;
|
||||
lexer.cdcDECScanIndexEnd = idxLast;
|
||||
for (lexer.cdcDECScanIndex = idxFirst; lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd; lexer.cdcDECScanIndex++) {
|
||||
if (handleEscape(lexer)) {
|
||||
continue;
|
||||
}
|
||||
if (cdcDECMode != null && handleDECMode(lexer)) {
|
||||
if (lexer.cdcDECMode != null && handleDECMode(lexer)) {
|
||||
continue;
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_DEC2701_PX0, cdcDECPoint - FourCornerDotCake.FC_DEC2701_PX0.getStart());
|
||||
} else {
|
||||
|
@ -505,46 +517,38 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
}
|
||||
|
||||
private void decModeReset() {
|
||||
cdcDECMode = null;
|
||||
cdcDECModeInc = null;
|
||||
cdcDECModeE10 = null;
|
||||
cdcDECModeNcr = null;
|
||||
cdcDECModePie = null;
|
||||
}
|
||||
|
||||
private boolean handleEscape(FourCornerZionStenoLexer lexer) {
|
||||
if (!lexer.handlerEscape) {
|
||||
return false; // disable escape handing
|
||||
}
|
||||
int cdcDECPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcDECPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FourCornerDotCake.FC_DEC2701_PX0.contains(cdcDECPoint)) {
|
||||
decModeReset();
|
||||
cdcDECMode = FCDotDEC2701DashPX0.valueOfCakePoint(cdcDECPoint);
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECMode = FCDotDEC2701DashPX0.valueOfCakePoint(cdcDECPoint);
|
||||
return true;
|
||||
} else if (FCDotCDC1604DashP6.isEscape6(cdcDECPoint)) {
|
||||
decModeReset();
|
||||
cdcDECMode = readEscape6(lexer);
|
||||
lexer.decModeReset();
|
||||
lexer.cdcDECMode = readEscape6(lexer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private FCDotDEC2701DashPX0 readEscape6(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint1 = lexer.input.get(cdcDECScanIndex);
|
||||
if (cdcDECScanIndex >= cdcDECScanIndexEnd) {
|
||||
int cdcPoint1 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
cdcDECScanIndex++;
|
||||
int cdcPoint2 = lexer.input.get(cdcDECScanIndex);
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint2 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscape6(cdcPoint2)) {
|
||||
return null;
|
||||
}
|
||||
if (cdcDECScanIndex >= cdcDECScanIndexEnd) {
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
cdcDECScanIndex++;
|
||||
int cdcPoint3 = lexer.input.get(cdcDECScanIndex);
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint3 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscape6(cdcPoint3)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -555,20 +559,20 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private Integer readEscapePepper3(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint1 = lexer.input.get(cdcDECScanIndex);
|
||||
if (cdcDECScanIndex >= cdcDECScanIndexEnd) {
|
||||
int cdcPoint1 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
cdcDECScanIndex++;
|
||||
int cdcPoint2 = lexer.input.get(cdcDECScanIndex);
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint2 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscapePepper(cdcPoint2)) {
|
||||
return null;
|
||||
}
|
||||
if (cdcDECScanIndex >= cdcDECScanIndexEnd) {
|
||||
if (lexer.cdcDECScanIndex >= lexer.cdcDECScanIndexEnd) {
|
||||
return null;
|
||||
}
|
||||
cdcDECScanIndex++;
|
||||
int cdcPoint3 = lexer.input.get(cdcDECScanIndex);
|
||||
lexer.cdcDECScanIndex++;
|
||||
int cdcPoint3 = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (!FCDotCDC1604DashP6.isEscapePepper(cdcPoint3)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -579,12 +583,13 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleDECMode(FourCornerZionStenoLexer lexer) {
|
||||
FCDotDEC2701DashPX0 cdcDECMode = lexer.cdcDECMode;
|
||||
if (FCDotDEC2701DashPX0.ESC_STOP.equals(cdcDECMode)) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return false; // print current char
|
||||
}
|
||||
if (cdcDECMode.isExternal() || FCDotDEC2701DashPX0.ESC_VT06.equals(cdcDECMode)) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
List<List<Integer>> args = new ArrayList<>();
|
||||
boolean readOK = scanSalahRakaAt(lexer, args);
|
||||
if (readOK == false) {
|
||||
|
@ -618,18 +623,18 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleINC(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FCDotCDC1604DashP6.isEscapePepper(cdcPoint)) {
|
||||
cdcDECModeInc = FCDotINC0801DashP8.values()[readEscapePepper3(lexer)];
|
||||
lexer.cdcDECModeInc = FCDotINC0801DashP8.values()[readEscapePepper3(lexer)];
|
||||
return true;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex() == cdcPoint) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return true; // end E10 mode, so no print
|
||||
}
|
||||
FourCornerDotCake displayCake = cdcDECModeInc.displayCake();
|
||||
FourCornerDotCake displayCake = lexer.cdcDECModeInc.displayCake();
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > displayCake.getLength() - 1 + FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
|
@ -637,13 +642,13 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleE10(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (FCDotCDC1604DashP6.isEscapePepper(cdcPoint)) {
|
||||
cdcDECModeE10 = FCDotDEC0801DashE10.values()[readEscapePepper3(lexer)];
|
||||
lexer.cdcDECModeE10 = FCDotDEC0801DashE10.values()[readEscapePepper3(lexer)];
|
||||
return true;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex() == cdcPoint) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return true; // end E10 mode, so no print
|
||||
}
|
||||
// if (FCDotCDC1604DashP6._RAKA_QUESTION.baklavaPointDotIndex() == cdcPoint) {
|
||||
|
@ -658,13 +663,13 @@ public class FourCornerZionStenoLexer {
|
|||
// return true;
|
||||
// }
|
||||
|
||||
if (FCDotDEC0801DashE10.E10_CDC1604_P6.equals(cdcDECModeE10)) {
|
||||
if (FCDotDEC0801DashE10.E10_CDC1604_P6.equals(lexer.cdcDECModeE10)) {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint); // not A based offset here
|
||||
return true;
|
||||
}
|
||||
FourCornerDotCake displayCake = cdcDECModeE10.displayCake();
|
||||
FourCornerDotCake displayCake = lexer.cdcDECModeE10.displayCake();
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > displayCake.getLength() - 1 + FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
|
@ -672,57 +677,57 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleCMD(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
Optional<FCDotCMD5401Dash2D> cmdModeOpt = FCDotCMD5401Dash2D.valueOfCDC(cdcPoint);
|
||||
if (cmdModeOpt.isEmpty()) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
lexer.smokeSignals.burnControlCommandUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false;
|
||||
}
|
||||
FCDotCMD5401Dash2D cmdMode = cmdModeOpt.get();
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TXT0001_SP.equals(cmdMode)) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_F4TXT0001_SP, 0); // white space
|
||||
return true;
|
||||
}
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TTY0001_NL.equals(cmdMode)) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
lexer.currLine++;
|
||||
lexer.currCol = 0;
|
||||
lexer.fireSignals.fireStateLine(lexer.currLine);
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_F4TTY0001_NL, 0); // new line
|
||||
return true;
|
||||
}
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
lexer.smokeSignals.burnControlCommandUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean handlePIE(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
|
||||
// TODO: add PIE left/right + elevator button support
|
||||
|
||||
if (cdcDECModePie == null) {
|
||||
cdcDECModePie = cdcPoint;
|
||||
if (cdcDECModePie < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
if (lexer.cdcDECModePie == null) {
|
||||
lexer.cdcDECModePie = cdcPoint;
|
||||
if (lexer.cdcDECModePie < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
lexer.decModeReset();
|
||||
return false; // print char
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (cdcDECModePie != null) {
|
||||
if (lexer.cdcDECModePie != null) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
if (cdcPoint > cdcDECModePie) {
|
||||
decModeReset();
|
||||
if (cdcPoint > lexer.cdcDECModePie) {
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int terminatorOffZero = cdcDECModePie - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||
int terminatorOffZero = lexer.cdcDECModePie - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||
int numberIdxOffZero = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||
FourCornerDotCake slice = FourCornerDotCake.values()[terminatorOffZero + FourCornerDotCake.FC_PIE9C_01.ordinal()];
|
||||
lexer.handler.strobeWord(slice, numberIdxOffZero);
|
||||
|
@ -730,28 +735,28 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleNCR(FourCornerZionStenoLexer lexer) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
|
||||
if (cdcDECModeNcr == null) {
|
||||
cdcDECModeNcr = cdcPoint;
|
||||
if (cdcDECModeNcr < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
if (lexer.cdcDECModeNcr == null) {
|
||||
lexer.cdcDECModeNcr = cdcPoint;
|
||||
if (lexer.cdcDECModeNcr < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
lexer.decModeReset();
|
||||
return false; // print char
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (cdcDECModeNcr != null) {
|
||||
if (lexer.cdcDECModeNcr != null) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
if (cdcPoint > cdcDECModeNcr) {
|
||||
decModeReset();
|
||||
if (cdcPoint > lexer.cdcDECModeNcr) {
|
||||
lexer.decModeReset();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
int terminatorOff = cdcDECModeNcr - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
||||
int terminatorOff = lexer.cdcDECModeNcr - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
||||
int numberIdxOff = cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal() + 1;
|
||||
BigInteger denominator = BigInteger.valueOf(terminatorOff);
|
||||
BigInteger numerator = BigInteger.valueOf(numberIdxOff);
|
||||
|
@ -760,7 +765,7 @@ public class FourCornerZionStenoLexer {
|
|||
}
|
||||
|
||||
private boolean handleFC18(FourCornerZionStenoLexer lexer) {
|
||||
decModeReset();
|
||||
lexer.decModeReset();
|
||||
List<List<Integer>> result = new ArrayList<>();
|
||||
scanSalahRakaAt(lexer, result);
|
||||
if (result.isEmpty()) {
|
||||
|
@ -796,17 +801,17 @@ public class FourCornerZionStenoLexer {
|
|||
|
||||
private boolean scanSalahRakaAt(FourCornerZionStenoLexer lexer, List<List<Integer>> result) {
|
||||
List<Integer> argu = new ArrayList<>();
|
||||
while (cdcDECScanIndex <= cdcDECScanIndexEnd) {
|
||||
int cdcPoint = lexer.input.get(cdcDECScanIndex);
|
||||
while (lexer.cdcDECScanIndex <= lexer.cdcDECScanIndexEnd) {
|
||||
int cdcPoint = lexer.input.get(lexer.cdcDECScanIndex);
|
||||
if (cdcPoint == FCDotCDC1604DashP6._NUL.ordinal()) {
|
||||
lexer.smokeSignals.burnSalahInvalidCakePoint(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
result.clear();
|
||||
cdcDECScanIndex--;
|
||||
lexer.cdcDECScanIndex--;
|
||||
return false; // _NUL not allowed salah
|
||||
}
|
||||
if (FCDotCDC1604DashP6.isEscape6(cdcPoint)) {
|
||||
result.add(argu);
|
||||
cdcDECScanIndex--;
|
||||
lexer.cdcDECScanIndex--;
|
||||
return true;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.ordinal() == cdcPoint) {
|
||||
|
@ -816,10 +821,10 @@ public class FourCornerZionStenoLexer {
|
|||
if (FCDotCDC1604DashP6._RAKA_QUESTION.ordinal() == cdcPoint) {
|
||||
result.add(argu);
|
||||
argu = new ArrayList<>();
|
||||
cdcDECScanIndex++;
|
||||
lexer.cdcDECScanIndex++;
|
||||
continue; // Next argument
|
||||
}
|
||||
cdcDECScanIndex++;
|
||||
lexer.cdcDECScanIndex++;
|
||||
argu.add(cdcPoint);
|
||||
}
|
||||
lexer.smokeSignals.burnSalahMissingAmen(lexer.currLine, lexer.currCol);
|
||||
|
|
Loading…
Reference in a new issue