Added more fire signal strenght to scanner match

This commit is contained in:
Willem Cazander 2025-01-16 23:12:05 +01:00
parent 87659bdf83
commit 547ad93953
3 changed files with 11 additions and 11 deletions

View file

@ -240,17 +240,16 @@ public class FourCornerZionStenoLexer {
} }
final public ScanResult scan(FourCornerZionStenoLexer lexer) { final public ScanResult scan(FourCornerZionStenoLexer lexer) {
int cakePoint = lexer.input.get(lexer.inputIndex); int matchPoint = lexer.input.get(lexer.inputIndex);
if (cakePoint < blockStart || cakePoint > blockStop) { if (matchPoint < blockStart || matchPoint > blockStop) {
return ScanResult.NEXT; return ScanResult.NEXT;
} }
lexer.fireSignals.fireStateScanner(blockStart, blockStop, cakePoint); // TODO: move below and add idxFirst/stop + next
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) {
cakePoint = lexer.input.get(lexer.inputIndex); int cakePoint = lexer.input.get(lexer.inputIndex);
if (cakePoint < blockStart || cakePoint > blockStop) { if (cakePoint < blockStart || cakePoint > blockStop) {
break; break;
} }
@ -260,8 +259,7 @@ public class FourCornerZionStenoLexer {
break; break;
} }
} }
//System.out.println("PROCESS: " + lexer.input.size() + " start: " + idxFirst + " stop: " + idxLast + " currenId: " + lexer.inputIndex); lexer.fireSignals.fireStateScannerMatch(blockStart, blockStop, matchPoint, idxFirst, idxLast);
process(lexer, idxFirst, idxLast); process(lexer, idxFirst, idxLast);
return result; return result;
} }

View file

@ -32,7 +32,7 @@ public interface FourCornerZionStenoLexerFire {
void fireStateColumn(int column); void fireStateColumn(int column);
void fireStateScanner(int blockStart, int blockStop, int cakePoint); void fireStateScannerMatch(int blockStart, int blockStop, int matchPoint, int idxFirst, int idxLast);
void fireStateNCR1632BankSparkler(boolean magic); void fireStateNCR1632BankSparkler(boolean magic);
@ -49,7 +49,7 @@ public interface FourCornerZionStenoLexerFire {
} }
@Override @Override
default void fireStateScanner(int blockStart, int blockStop, int cakePoint) { default void fireStateScannerMatch(int blockStart, int blockStop, int matchPoint, int idxFirst, int idxLast) {
} }
@Override @Override

View file

@ -34,7 +34,7 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
int currentColumn; int currentColumn;
int scanBlockStart; int scanBlockStart;
int scanBlockStop; int scanBlockStop;
int scanCakePoint; int scanMatchPoint;
int ncr1632BankSparkler; int ncr1632BankSparkler;
int ncr1632BankReset; int ncr1632BankReset;
@ -46,6 +46,8 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
currentLine = 0; currentLine = 0;
currentColumn = 0; currentColumn = 0;
scanBlockStart = 0; scanBlockStart = 0;
scanMatchPoint = 0;
scanMatchPoint = 0;
ncr1632BankSparkler = 0; ncr1632BankSparkler = 0;
ncr1632BankReset = 0; ncr1632BankReset = 0;
} }
@ -61,10 +63,10 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
} }
@Override @Override
public void fireStateScanner(int blockStart, int blockStop, int cakePoint) { public void fireStateScannerMatch(int blockStart, int blockStop, int matchPoint, int idxFirst, int idxLast) {
scanBlockStart = blockStart; scanBlockStart = blockStart;
scanBlockStop = blockStop; scanBlockStop = blockStop;
scanCakePoint = cakePoint; scanMatchPoint = matchPoint;
} }
@Override @Override