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