mirror of
https://github.com/AppleCommander/bastools.git
synced 2026-04-20 08:16:33 +00:00
Adding number preservation tests which revealed classic tokenizer was not generating the correct tokens for '&', '+', '-', '*', '/', '^', '<', '=', and '>'.
This commit is contained in:
@@ -48,6 +48,8 @@ public class ClassicTokenReader {
|
||||
}
|
||||
|
||||
static class LinePopulator {
|
||||
/** These are the alternate tokens that do not start with an alphabetic character. */
|
||||
private static final Set<Character> ALT_TOKENS = Set.of('&','+','-','*','/','^','<','=','>');
|
||||
private final int lineNo;
|
||||
private final LinkedList<Token> tokens;
|
||||
private boolean dataFlag = false;
|
||||
@@ -115,7 +117,8 @@ public class ClassicTokenReader {
|
||||
}
|
||||
|
||||
// Keyword handling
|
||||
if (Character.isLetter(ch)) {
|
||||
// Additional: &+-*/^<=>
|
||||
if (Character.isLetter(ch) || ALT_TOKENS.contains(ch)) {
|
||||
int n = handleKeyword(i, line);
|
||||
if (n == -1) {
|
||||
// No keyword found, must be identifier
|
||||
@@ -144,10 +147,6 @@ public class ClassicTokenReader {
|
||||
else if (ch == '.') {
|
||||
emitNumber(ch);
|
||||
}
|
||||
// Cases of missed tokens(?)
|
||||
else if (ch == '=') {
|
||||
emitKeyword(ApplesoftKeyword.eq);
|
||||
}
|
||||
// A "$" _might_ be a directive, figure that out
|
||||
else if (ch == '$') {
|
||||
int n = handleDirective(i, line);
|
||||
|
||||
Reference in New Issue
Block a user