Moved escaked point handling out of the lexer
This commit is contained in:
parent
547ad93953
commit
0d54b152dc
|
@ -244,6 +244,12 @@ public class FourCornerUnicodeDisplay {
|
||||||
codePoints.forEach(v -> output.appendCodePoint(v));
|
codePoints.forEach(v -> output.appendCodePoint(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strobeRecursiveCake(List<Integer> cakePoints) {
|
||||||
|
FourCornerZionStenoLexer thisDisplayEscaked = new FourCornerZionStenoLexer(this, true);
|
||||||
|
thisDisplayEscaked.read(cakePoints);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void strobeNether(List<Integer> key, List<Integer> octals) {
|
public void strobeNether(List<Integer> key, List<Integer> octals) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -260,10 +266,5 @@ public class FourCornerUnicodeDisplay {
|
||||||
output.append(";");
|
output.append(";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void burnRecursive(int line, int col) {
|
|
||||||
throw new IllegalStateException("loop");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ public interface FourCornerZion7Candlelier {
|
||||||
|
|
||||||
void strobeUnicode(List<Integer> codePoints);
|
void strobeUnicode(List<Integer> codePoints);
|
||||||
|
|
||||||
|
void strobeRecursiveCake(List<Integer> cakePoints);
|
||||||
|
|
||||||
void strobeNether(List<Integer> key, List<Integer> octals);
|
void strobeNether(List<Integer> key, List<Integer> octals);
|
||||||
|
|
||||||
interface Adapter extends FourCornerZion7Candlelier {
|
interface Adapter extends FourCornerZion7Candlelier {
|
||||||
|
@ -57,6 +59,10 @@ public interface FourCornerZion7Candlelier {
|
||||||
default void strobeUnicode(List<Integer> codePoints) {
|
default void strobeUnicode(List<Integer> codePoints) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default void strobeRecursiveCake(List<Integer> cakePoints) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void strobeNether(List<Integer> key, List<Integer> octals) {
|
default void strobeNether(List<Integer> key, List<Integer> octals) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class FourCornerZionStenoLexer {
|
||||||
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 readLevel = 0;
|
|
||||||
private int currLine = 0;
|
private int currLine = 0;
|
||||||
private int currCol = 0;
|
private int currCol = 0;
|
||||||
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
private FourCornerZionStenoLexerSmoke smokeSignals = CLEAN_SMOKE;
|
||||||
|
@ -137,17 +136,10 @@ public class FourCornerZionStenoLexer {
|
||||||
|
|
||||||
public void read(List<Integer> points) {
|
public void read(List<Integer> points) {
|
||||||
input = Objects.requireNonNull(points);
|
input = Objects.requireNonNull(points);
|
||||||
readLevel++; // first puts on one, we allow level deep
|
inputIndex = 0;
|
||||||
if (readLevel > 2) {
|
currLine = 0;
|
||||||
smokeSignals.burnRecursive(currLine, currCol);
|
currCol = 0; // allow reuse of lexer
|
||||||
return;
|
handlerDocument.strobeDocumentAlpha();
|
||||||
}
|
|
||||||
if (readLevel == 1) {
|
|
||||||
inputIndex = 0;
|
|
||||||
currLine = 0;
|
|
||||||
currCol = 0; // allow reuse of lexer
|
|
||||||
handlerDocument.strobeDocumentAlpha();
|
|
||||||
}
|
|
||||||
while (true) {
|
while (true) {
|
||||||
ScanResult run = ScanResult.DONE;
|
ScanResult run = ScanResult.DONE;
|
||||||
while (run.isDone()) {
|
while (run.isDone()) {
|
||||||
|
@ -164,10 +156,7 @@ public class FourCornerZionStenoLexer {
|
||||||
smokeSignals.burnUnsupported(currLine, currCol, input.get(inputIndex));
|
smokeSignals.burnUnsupported(currLine, currCol, input.get(inputIndex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (readLevel == 1) {
|
handlerDocument.strobeDocumentOmega();
|
||||||
handlerDocument.strobeDocumentOmega();
|
|
||||||
}
|
|
||||||
readLevel--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ScanResult readTokens() {
|
private ScanResult readTokens() {
|
||||||
|
@ -247,7 +236,6 @@ public class FourCornerZionStenoLexer {
|
||||||
ScanResult result = ScanResult.DONE;
|
ScanResult result = ScanResult.DONE;
|
||||||
int idxFirst = lexer.inputIndex;
|
int idxFirst = lexer.inputIndex;
|
||||||
int idxLast = lexer.inputIndex;
|
int idxLast = lexer.inputIndex;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
int cakePoint = lexer.input.get(lexer.inputIndex);
|
int cakePoint = lexer.input.get(lexer.inputIndex);
|
||||||
if (cakePoint < blockStart || cakePoint > blockStop) {
|
if (cakePoint < blockStart || cakePoint > blockStop) {
|
||||||
|
@ -590,32 +578,32 @@ public class FourCornerZionStenoLexer {
|
||||||
if (FCDotDEC0127DashPX0.ESC68_FC18.equals(decMode)) {
|
if (FCDotDEC0127DashPX0.ESC68_FC18.equals(decMode)) {
|
||||||
List<List<Integer>> result = new ArrayList<>();
|
List<List<Integer>> result = new ArrayList<>();
|
||||||
scanSalahRakaAt(lexer, result);
|
scanSalahRakaAt(lexer, result);
|
||||||
if (!result.isEmpty()) {
|
if (result.isEmpty()) {
|
||||||
List<Integer> renderCakePoints = new ArrayList<>();
|
return false;
|
||||||
for (List<Integer> argu : result) {
|
}
|
||||||
int cakePointArgu = 0;
|
List<Integer> renderCakePoints = new ArrayList<>();
|
||||||
int cakePointIdx = 6;
|
for (List<Integer> argu : result) {
|
||||||
for (Integer octal : argu) {
|
int cakePointArgu = 0;
|
||||||
if (octal < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
int cakePointIdx = 6;
|
||||||
continue;
|
for (Integer octal : argu) {
|
||||||
}
|
if (octal < FCDotCDC1604DashP6.NX01_A.ordinal()) {
|
||||||
if (octal > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
if (octal > FCDotCDC1604DashP6.NX08_H.ordinal()) {
|
||||||
int offset = octal - FCDotCDC1604DashP6.NX01_A.ordinal();
|
continue;
|
||||||
cakePointArgu = cakePointArgu + (offset << (cakePointIdx*3));
|
}
|
||||||
cakePointIdx--;
|
int offset = octal - FCDotCDC1604DashP6.NX01_A.ordinal();
|
||||||
if (cakePointIdx < 0) {
|
cakePointArgu = cakePointArgu + (offset << (cakePointIdx*3));
|
||||||
renderCakePoints.add(cakePointArgu);
|
cakePointIdx--;
|
||||||
cakePointIdx = 6;
|
if (cakePointIdx < 0) {
|
||||||
cakePointArgu = 0;
|
renderCakePoints.add(cakePointArgu);
|
||||||
}
|
cakePointIdx = 6;
|
||||||
|
cakePointArgu = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FourCornerZionStenoLexer lexer2 = new FourCornerZionStenoLexer(lexer.handler);
|
|
||||||
lexer2.read(renderCakePoints);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
lexer.handler.strobeRecursiveCake(renderCakePoints);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ public interface FourCornerZionStenoLexerSmoke {
|
||||||
|
|
||||||
void burnUnsupported(int line, int col, int cakePoint);
|
void burnUnsupported(int line, int col, int cakePoint);
|
||||||
|
|
||||||
void burnRecursive(int line, int col);
|
|
||||||
|
|
||||||
void burnInvalidEscape(int line, int col, int cakePoint);
|
void burnInvalidEscape(int line, int col, int cakePoint);
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,10 +53,6 @@ public interface FourCornerZionStenoLexerSmoke {
|
||||||
default void burnUnsupported(int line, int col, int cakePoint) {
|
default void burnUnsupported(int line, int col, int cakePoint) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
default void burnRecursive(int line, int col) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void burnSalahInvalidCakePoint(int line, int col, int cakePoint) {
|
default void burnSalahInvalidCakePoint(int line, int col, int cakePoint) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.Adapter {
|
||||||
|
|
||||||
int errorUNI21UnusedBigIndian;
|
int errorUNI21UnusedBigIndian;
|
||||||
int errorUnsupport;
|
int errorUnsupport;
|
||||||
int errorRecursive;
|
|
||||||
|
|
||||||
public TestSmokeReader() {
|
public TestSmokeReader() {
|
||||||
reset();
|
reset();
|
||||||
|
@ -41,7 +40,6 @@ public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.Adapter {
|
||||||
public void reset() {
|
public void reset() {
|
||||||
errorUNI21UnusedBigIndian = -1;
|
errorUNI21UnusedBigIndian = -1;
|
||||||
errorUnsupport = -1;
|
errorUnsupport = -1;
|
||||||
errorRecursive = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,9 +51,4 @@ public class TestSmokeReader implements FourCornerZionStenoLexerSmoke.Adapter {
|
||||||
public void burnUnsupported(int line, int col, int cakePoint) {
|
public void burnUnsupported(int line, int col, int cakePoint) {
|
||||||
errorUnsupport = line;
|
errorUnsupport = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void burnRecursive(int line, int col) {
|
|
||||||
errorRecursive = line;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue