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) {
int cakePoint = lexer.input.get(lexer.inputIndex);
if (cakePoint < blockStart || cakePoint > blockStop) {
int matchPoint = lexer.input.get(lexer.inputIndex);
if (matchPoint < blockStart || matchPoint > blockStop) {
return ScanResult.NEXT;
}
lexer.fireSignals.fireStateScanner(blockStart, blockStop, cakePoint); // TODO: move below and add idxFirst/stop + next
ScanResult result = ScanResult.DONE;
int idxFirst = lexer.inputIndex;
int idxLast = lexer.inputIndex;
while (true) {
cakePoint = lexer.input.get(lexer.inputIndex);
int cakePoint = lexer.input.get(lexer.inputIndex);
if (cakePoint < blockStart || cakePoint > blockStop) {
break;
}
@ -260,8 +259,7 @@ public class FourCornerZionStenoLexer {
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);
return result;
}

View file

@ -32,7 +32,7 @@ public interface FourCornerZionStenoLexerFire {
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);
@ -49,7 +49,7 @@ public interface FourCornerZionStenoLexerFire {
}
@Override
default void fireStateScanner(int blockStart, int blockStop, int cakePoint) {
default void fireStateScannerMatch(int blockStart, int blockStop, int matchPoint, int idxFirst, int idxLast) {
}
@Override

View file

@ -34,7 +34,7 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
int currentColumn;
int scanBlockStart;
int scanBlockStop;
int scanCakePoint;
int scanMatchPoint;
int ncr1632BankSparkler;
int ncr1632BankReset;
@ -46,6 +46,8 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
currentLine = 0;
currentColumn = 0;
scanBlockStart = 0;
scanMatchPoint = 0;
scanMatchPoint = 0;
ncr1632BankSparkler = 0;
ncr1632BankReset = 0;
}
@ -61,10 +63,10 @@ public class TestFireWalker implements FourCornerZionStenoLexerFire.Adapter {
}
@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;
scanBlockStop = blockStop;
scanCakePoint = cakePoint;
scanMatchPoint = matchPoint;
}
@Override