Cleaned lexer and smoke code a bit.
This commit is contained in:
parent
34b4761446
commit
12785fff61
|
@ -46,12 +46,12 @@ import org.x4o.fc18.zion7.FourCornerZionStenoLexerSmoke;
|
|||
/// @version 1.0 Dec 28, 2024
|
||||
public class FourCornerUnicodeDisplay {
|
||||
|
||||
private boolean failUnsupported = false;
|
||||
private boolean failPipeSmoke = false;
|
||||
private boolean handleEscape = true;
|
||||
private String renderSeperator = null;
|
||||
|
||||
public FourCornerUnicodeDisplay(boolean failUnsupported, boolean handleEscape, String renderSeperator) {
|
||||
this.failUnsupported = failUnsupported;
|
||||
public FourCornerUnicodeDisplay(boolean failPipeSmoke, boolean handleEscape, String renderSeperator) {
|
||||
this.failPipeSmoke = failPipeSmoke;
|
||||
this.handleEscape = handleEscape;
|
||||
this.renderSeperator = renderSeperator;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class FourCornerUnicodeDisplay {
|
|||
lexer.withSmokeSignals(printer).read(chars);
|
||||
}
|
||||
|
||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZion7WaterCodex, FourCornerZionStenoLexerSmoke.Adapter {
|
||||
private final class StenoUnicodePrinter implements FourCornerZion7Candlelier, FourCornerZion7WaterCodex, FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||
|
||||
private final StringBuilder output;
|
||||
private FourCornerZionStenoLexer thisDisplayEscaked = null;
|
||||
|
@ -238,18 +238,6 @@ public class FourCornerUnicodeDisplay {
|
|||
public void strobeSandWorm(List<Integer> spice) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnUnsupported(int line, int col, int cakePoint) {
|
||||
if (failUnsupported) {
|
||||
throw new IllegalArgumentException("Unsupported cakePoint: " + Integer.toHexString(cakePoint)+ " on line: " + line + ":" + col);
|
||||
} else {
|
||||
// TODO: use unicode glyps for unknow letter
|
||||
output.append("&#x");
|
||||
output.append(Integer.toHexString(cakePoint).toUpperCase());
|
||||
output.append(";");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void strobeWaterUnicode(List<Integer> codePoints) {
|
||||
codePoints.forEach(v -> output.appendCodePoint(v));
|
||||
|
@ -258,5 +246,20 @@ public class FourCornerUnicodeDisplay {
|
|||
@Override
|
||||
public void strobeWaterKanji(List<Integer> kuTenPoints) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnMonoPipe(int line, int col, String pipeError) {
|
||||
StringBuilder errBuf = new StringBuilder();
|
||||
errBuf.append(line);
|
||||
errBuf.append(":");
|
||||
errBuf.append(col);
|
||||
errBuf.append(":");
|
||||
errBuf.append(pipeError);
|
||||
if (failPipeSmoke) {
|
||||
throw new IllegalStateException(errBuf.toString());
|
||||
} else {
|
||||
output.append(errBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ package org.x4o.fc18.cake2.zero33.dec1;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
||||
|
@ -44,38 +46,48 @@ public enum FCDotDEC0801DashE10 implements FourCornerX06BaklavaPointSequence, Fo
|
|||
|
||||
/// ¡¡¡
|
||||
/// Back to normal dough
|
||||
E10_CDC1604_P6,
|
||||
E10_CDC1604_P6(FourCornerDotCake.FC_CDC1604_P6),
|
||||
|
||||
/// ¡¡¿
|
||||
/// 2 gram of BMW (booleans)
|
||||
E10_BMW0102_S2,
|
||||
E10_BMW0102_S2(FourCornerDotCake.FC_BMW0102_S2),
|
||||
|
||||
/// ¡¿¡
|
||||
/// 10 gram of AMD (decimals)
|
||||
E10_AMD0110_SA,
|
||||
E10_AMD0110_SA(FourCornerDotCake.FC_AMD0110_SA),
|
||||
|
||||
/// ¡¿¿
|
||||
/// 27 gram of NES (unvocalized-hebrew)
|
||||
E10_NES0127_9C,
|
||||
E10_NES0127_9C(FourCornerDotCake.FC_NES0127_9C),
|
||||
|
||||
/// ¿¡¿
|
||||
/// 3 gram of NXP (3-phase)
|
||||
E10_NXP0103_S3,
|
||||
E10_NXP0103_S3(FourCornerDotCake.FC_NXP0103_S3),
|
||||
|
||||
/// ¿¡¿
|
||||
/// 1 gram of UWU (white space)
|
||||
/// Typewriter gram escape the the UWU word space word index register lookup the right white and left width for user.
|
||||
E10_UWU0101_S1,
|
||||
E10_UWU0101_S1(FourCornerDotCake.FC_UWU0101_S1),
|
||||
|
||||
/// ¿¡¡
|
||||
/// 26 gram of ICL (lowercase)
|
||||
E10_ICL0126_9B,
|
||||
E10_ICL0126_9B(FourCornerDotCake.FC_ICL0126_9B),
|
||||
|
||||
/// ¿¿¿
|
||||
/// 8 gram of OCE (octals)
|
||||
E10_OCE0801_H3,
|
||||
E10_OCE0801_H3(FourCornerDotCake.FC_OCE0801_H3),
|
||||
;
|
||||
|
||||
private final FourCornerDotCake displayCake;
|
||||
|
||||
private FCDotDEC0801DashE10(FourCornerDotCake displayCake) {
|
||||
this.displayCake = Objects.requireNonNull(displayCake);
|
||||
}
|
||||
|
||||
public FourCornerDotCake displayCake() {
|
||||
return displayCake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> baklavaPointSequence() {
|
||||
return FCDotCDC1604DashP6.pepper3SequenceWritePoints(ordinal());
|
||||
|
|
|
@ -24,7 +24,9 @@ package org.x4o.fc18.cake2.zero33.dec1;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.x4o.fc18.cake2.FourCornerDotCake;
|
||||
import org.x4o.fc18.cake2.FourCornerX06BaklavaPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX08MuffinPointSequence;
|
||||
import org.x4o.fc18.cake2.FourCornerX18CakePointSequence;
|
||||
|
@ -40,37 +42,47 @@ public enum FCDotINC0801DashP8 implements FourCornerX06BaklavaPointSequence, Fou
|
|||
|
||||
/// ¡¡¡
|
||||
/// Select APL page 7A mode.
|
||||
INC_APL0127_P7A,
|
||||
INC_APL0127_P7A(FourCornerDotCake.FC_APL0127_P7A),
|
||||
|
||||
/// ¡¡¿
|
||||
/// Select APL page 7B mode.
|
||||
INC_APL0127_P7B,
|
||||
INC_APL0127_P7B(FourCornerDotCake.FC_APL0127_P7B),
|
||||
|
||||
/// ¡¿¡
|
||||
/// Select APL page 7C mode.
|
||||
INC_APL0127_P7C,
|
||||
INC_APL0127_P7C(FourCornerDotCake.FC_APL0127_P7C),
|
||||
|
||||
/// ¡¿¿
|
||||
/// Select BYD page 7D mode.
|
||||
INC_BYD0127_P7D,
|
||||
INC_BYD0127_P7D(FourCornerDotCake.FC_BYD0127_P7D),
|
||||
|
||||
/// ¿¡¿
|
||||
/// Select BYD page 7E mode.
|
||||
INC_BYD0127_P7E,
|
||||
INC_BYD0127_P7E(FourCornerDotCake.FC_BYD0127_P7E),
|
||||
|
||||
/// ¿¡¿
|
||||
/// Select BYD page 7F mode.
|
||||
INC_BYD0127_P7F,
|
||||
INC_BYD0127_P7F(FourCornerDotCake.FC_BYD0127_P7F),
|
||||
|
||||
/// ¿¡¡
|
||||
/// Select italic mode.
|
||||
INC_PIE9D_27,
|
||||
INC_PIE9D_27(FourCornerDotCake.FC_PIE9D_27),
|
||||
|
||||
/// ¿¿¿
|
||||
// Select lower case mode.
|
||||
INC_PIE9C_26,
|
||||
INC_PIE9C_26(FourCornerDotCake.FC_PIE9C_26),
|
||||
;
|
||||
|
||||
private final FourCornerDotCake displayCake;
|
||||
|
||||
private FCDotINC0801DashP8(FourCornerDotCake displayCake) {
|
||||
this.displayCake = Objects.requireNonNull(displayCake);
|
||||
}
|
||||
|
||||
public FourCornerDotCake displayCake() {
|
||||
return displayCake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> baklavaPointSequence() {
|
||||
return FCDotCDC1604DashP6.pepper3SequenceWritePoints(ordinal());
|
||||
|
|
|
@ -33,4 +33,11 @@ import org.x4o.fc18.cake2.zero33.dec1.FCDotDEC2701DashPX0;
|
|||
public interface FourCornerZion7SalahSequence extends FourCornerZion7Candlelier {
|
||||
|
||||
void strobeSalahSequence(FCDotDEC2701DashPX0 type, List<List<Integer>> arguments);
|
||||
|
||||
interface Adapter extends FourCornerZion7SalahSequence, FourCornerZion7Candlelier.Adapter {
|
||||
|
||||
@Override
|
||||
default void strobeSalahSequence(FCDotDEC2701DashPX0 type, List<List<Integer>> arguments) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class FourCornerZionStenoLexer {
|
|||
private final static FourCornerZion7WaterCodex CLEAN_WATER = new FourCornerZion7WaterCodex.Adapter() {};
|
||||
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 boolean handlerEscape;
|
||||
private final FourCornerZion7Candlelier handler;
|
||||
private final FourCornerZion7AlphaOmega handlerDocument;
|
||||
|
@ -84,7 +85,7 @@ public class FourCornerZionStenoLexer {
|
|||
if (handler instanceof FourCornerZion7SalahSequence) {
|
||||
this.handlerSalahSequence = FourCornerZion7SalahSequence.class.cast(handler);
|
||||
} else {
|
||||
this.handlerSalahSequence = null;
|
||||
this.handlerSalahSequence = CLEAN_PRAYER;
|
||||
}
|
||||
if (handler instanceof FourCornerZion7TempleScrolls) {
|
||||
this.handlerTempleScrolls = FourCornerZion7TempleScrolls.class.cast(handler);
|
||||
|
@ -170,7 +171,7 @@ public class FourCornerZionStenoLexer {
|
|||
break;
|
||||
}
|
||||
if (!run.isDone()) {
|
||||
smokeSignals.burnUnsupported(currLine, currCol, input.get(inputIndex));
|
||||
smokeSignals.burnLexerReservedCakePoint(currLine, currCol, input.get(inputIndex));
|
||||
}
|
||||
}
|
||||
handlerDocument.strobeDocumentOmega();
|
||||
|
@ -590,9 +591,7 @@ public class FourCornerZionStenoLexer {
|
|||
if (readOK == false) {
|
||||
return true; // point is eaten
|
||||
}
|
||||
if (lexer.handlerSalahSequence != null) {
|
||||
lexer.handlerSalahSequence.strobeSalahSequence(cdcDECMode, args);
|
||||
}
|
||||
lexer.handlerSalahSequence.strobeSalahSequence(cdcDECMode, args);
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC2701DashPX0.ESC68_2PIE.equals(cdcDECMode)) {
|
||||
|
@ -625,83 +624,17 @@ public class FourCornerZionStenoLexer {
|
|||
cdcDECModeInc = FCDotINC0801DashP8.values()[readEscapePepper3(lexer)];
|
||||
return true;
|
||||
}
|
||||
if (cdcDECModeInc == null) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
if (FCDotCDC1604DashP6._SALAH_EXCLAMATION.baklavaPointDotIndex() == cdcPoint) {
|
||||
decModeReset();
|
||||
return true; // end E10 mode, so no print
|
||||
}
|
||||
// if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
// decModeReset();
|
||||
// return false;
|
||||
// }
|
||||
if (FCDotINC0801DashP8.INC_APL0127_P7A.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7A, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
FourCornerDotCake displayCake = cdcDECModeInc.displayCake();
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > displayCake.getLength() - 1 + FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_APL0127_P7B.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7B, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_APL0127_P7C.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_APL0127_P7C, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_BYD0127_P7D.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7D, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_BYD0127_P7E.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7E, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_BYD0127_P7F.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_BYD0127_P7F, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_PIE9D_27.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_PIE9D_27, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotINC0801DashP8.INC_PIE9C_26.equals(cdcDECModeInc)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX26_Z.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_PIE9C_26, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleE10(FourCornerZionStenoLexer lexer) {
|
||||
|
@ -725,69 +658,18 @@ public class FourCornerZionStenoLexer {
|
|||
// decModeE10DeckLevel = 2;
|
||||
// return true;
|
||||
// }
|
||||
|
||||
if (FCDotDEC0801DashE10.E10_CDC1604_P6.equals(cdcDECModeE10)) {
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint);
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_CDC1604_P6, cdcPoint); // not A based offset here
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_BMW0102_S2.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX02_B.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_BMW0102_S2, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
FourCornerDotCake displayCake = cdcDECModeE10.displayCake();
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > displayCake.getLength() - 1 + FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_AMD0110_SA.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX10_J.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_AMD0110_SA, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_NES0127_9C.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX27_AMP.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_NES0127_9C, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_NXP0103_S3.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX03_C.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_NXP0103_S3, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_UWU0101_S1.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_UWU0101_S1, 0); // white space
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_ICL0126_9B.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX26_Z.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_ICL0126_9B, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
if (FCDotDEC0801DashE10.E10_OCE0801_H3.equals(cdcDECModeE10)) {
|
||||
if (cdcPoint < FCDotCDC1604DashP6.NX01_A.ordinal() || cdcPoint > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
||||
decModeReset();
|
||||
return false;
|
||||
}
|
||||
lexer.handler.strobeWord(FourCornerDotCake.FC_OCE0801_H3, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
decModeReset();
|
||||
lexer.smokeSignals.burnUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false;
|
||||
lexer.handler.strobeWord(displayCake, cdcPoint - FCDotCDC1604DashP6.NX01_A.ordinal());
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleCMD(FourCornerZionStenoLexer lexer) {
|
||||
|
@ -795,8 +677,8 @@ public class FourCornerZionStenoLexer {
|
|||
Optional<FCDotCMD5401Dash2D> cmdModeOpt = FCDotCMD5401Dash2D.valueOfCDC(cdcPoint);
|
||||
if (cmdModeOpt.isEmpty()) {
|
||||
decModeReset();
|
||||
lexer.smokeSignals.burnUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false; // TODO: add smoke for unkown cmd
|
||||
lexer.smokeSignals.burnControlCommandUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false;
|
||||
}
|
||||
FCDotCMD5401Dash2D cmdMode = cmdModeOpt.get();
|
||||
if (FCDotCMD5401Dash2D.CMD_F4TXT0001_SP.equals(cmdMode)) {
|
||||
|
@ -814,7 +696,7 @@ public class FourCornerZionStenoLexer {
|
|||
return true;
|
||||
}
|
||||
decModeReset();
|
||||
lexer.smokeSignals.burnUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
lexer.smokeSignals.burnControlCommandUnsupported(lexer.currLine, lexer.currCol, cdcPoint);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ package org.x4o.fc18.zion7;
|
|||
/// @version 1.0 Jan 12, 2025
|
||||
public interface FourCornerZionStenoLexerSmoke {
|
||||
|
||||
void burnUnsupported(int line, int col, int cakePoint);
|
||||
void burnLexerReservedCakePoint(int line, int col, int cakePoint);
|
||||
|
||||
void burnInvalidEscape(int line, int col, int cakePoint);
|
||||
void burnControlCommandUnsupported(int line, int col, int cakePoint);
|
||||
|
||||
|
||||
void burnSalahInvalidCakePoint(int line, int col, int cakePoint);
|
||||
|
@ -49,7 +49,7 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
interface Adapter extends FourCornerZionStenoLexerSmoke {
|
||||
|
||||
@Override
|
||||
default void burnUnsupported(int line, int col, int cakePoint) {
|
||||
default void burnLexerReservedCakePoint(int line, int col, int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -61,7 +61,7 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
}
|
||||
|
||||
@Override
|
||||
default void burnInvalidEscape(int line, int col, int cakePoint) {
|
||||
default void burnControlCommandUnsupported(int line, int col, int cakePoint) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,4 +76,44 @@ public interface FourCornerZionStenoLexerSmoke {
|
|||
default void burnSandWalkerStepUnaligned(int line, int col, int size) {
|
||||
}
|
||||
}
|
||||
|
||||
interface AdapterMonoPipe extends FourCornerZionStenoLexerSmoke {
|
||||
|
||||
void burnMonoPipe(int line, int col, String pipeError);
|
||||
|
||||
@Override
|
||||
default void burnLexerReservedCakePoint(int line, int col, int cakePoint) {
|
||||
burnMonoPipe(line, col, "burnLexerReservedCakePoint:0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSalahInvalidCakePoint(int line, int col, int cakePoint) {
|
||||
burnMonoPipe(line, col, "burnSalahInvalidCakePoint:0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSalahMissingAmen(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnSalahMissingAmen");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnControlCommandUnsupported(int line, int col, int cakePoint) {
|
||||
burnMonoPipe(line, col, "burnControlCommandUnsupported:0x" + Integer.toHexString(cakePoint));
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnWaterUnicodeBadBigIndian(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnWaterUnicodeBadBigIndian");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSandWalkerOutOfRhythm(int line, int col) {
|
||||
burnMonoPipe(line, col, "burnSandWalkerOutOfRhythm");
|
||||
}
|
||||
|
||||
@Override
|
||||
default void burnSandWalkerStepUnaligned(int line, int col, int size) {
|
||||
burnMonoPipe(line, col, "burnSandWalkerStepUnaligned:" + size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,7 +166,11 @@ public class FourCornerUnicodeDisplayTest {
|
|||
cdc.add(FCDotCDC1604DashP6.NX08_H); // HOI
|
||||
cdc.add(FCDotCDC1604DashP6.NX15_O);
|
||||
cdc.add(FCDotCDC1604DashP6.NX09_I);
|
||||
cdc.add(FCDotDEC2701DashPX0.ESC_DEC0801_E10);
|
||||
cdc.add(FCDotDEC0801DashE10.E10_UWU0101_S1);
|
||||
cdc.add(FCDotCDC1604DashP6.NX02_B); // B
|
||||
cdc.add(FCDotCDC1604DashP6._SALAH_EXCLAMATION); // with ! as we droped out of escape mode by B being to large
|
||||
|
||||
Assertions.assertEquals("HOI__ __.:=UWU=:.__ __HOI", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
Assertions.assertEquals("HOI__ __.:=UWU=:.__ __HOIB!", FourCornerUnicodeDisplay.text().renderFromX06(cdc));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,8 +46,8 @@ public class LexerUNI21Test {
|
|||
cdc.add(FourCornerDotCake.FC_UNI2K_22.getStart() + 123);
|
||||
|
||||
smokeReader.reset();
|
||||
Assertions.assertEquals(-1, smokeReader.errorUNI21UnusedBigIndian);
|
||||
Assertions.assertEquals(0, smokeReader.pipeSmokeClouds);
|
||||
lexer.read(cdc);
|
||||
Assertions.assertEquals(0, smokeReader.errorUNI21UnusedBigIndian);
|
||||
Assertions.assertEquals(1, smokeReader.pipeSmokeClouds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,27 +28,26 @@ package org.x4o.fc18.zion7;
|
|||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 14, 2025
|
||||
*/
|
||||
public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.Adapter {
|
||||
public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.AdapterMonoPipe {
|
||||
|
||||
int errorUNI21UnusedBigIndian;
|
||||
int errorUnsupport;
|
||||
int pipeSmokeClouds;
|
||||
int pipeErrorLine;
|
||||
int pipeErrorCol;
|
||||
String pipeError;
|
||||
|
||||
public TestSmokeReader() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
errorUNI21UnusedBigIndian = -1;
|
||||
errorUnsupport = -1;
|
||||
this.pipeSmokeClouds = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnWaterUnicodeBadBigIndian(int line, int col) {
|
||||
errorUNI21UnusedBigIndian = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void burnUnsupported(int line, int col, int cakePoint) {
|
||||
errorUnsupport = line;
|
||||
public void burnMonoPipe(int line, int col, String pipeError) {
|
||||
this.pipeSmokeClouds++;
|
||||
this.pipeErrorLine = line;
|
||||
this.pipeErrorCol = col;
|
||||
this.pipeError = pipeError;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue