Fixed issue #1 Scanner Bug where the start of comment would become part of an identifier or throw off number parsing.
This commit is contained in:
+6
-5
@@ -10,13 +10,13 @@ something_insance:
|
||||
load r1, unknown_symbol
|
||||
load byte r1, r3
|
||||
load r1, 5
|
||||
.db fun_alright 0x70
|
||||
.db fun_alright 0x70;does this break?
|
||||
load r3, r4
|
||||
store byte r3, r5
|
||||
store r5, r7
|
||||
unknown_symbol:
|
||||
cmp r1, 5
|
||||
cmp r1, r2
|
||||
unknown_symbol:;Does this work?
|
||||
cmp r1, 5;or one after the register?
|
||||
cmp r1, r2;This might work
|
||||
and r1, r2
|
||||
add r4, r7
|
||||
inc r1 ;increment r1
|
||||
@@ -24,4 +24,5 @@ xor r1, r1 ;clear self
|
||||
pop r3
|
||||
jmp unknown_symbol
|
||||
jmp r4
|
||||
jz unknown_symbol
|
||||
jz unknown_symbol
|
||||
;And a comment at the end
|
||||
+2
-2
@@ -128,7 +128,7 @@ Token* ParseNumber(void) {
|
||||
if ((ahead >= 'a' && ahead <= 'f') || isdigit(ahead)) {
|
||||
AdvanceScanner(); //Consume the 'x'
|
||||
|
||||
while(!ScannerAtEnd() && PeekScanner() != '\n' && !IsWhiteSpace(PeekScanner())) {
|
||||
while(!ScannerAtEnd() && PeekScanner() != '\n' && !IsWhiteSpace(PeekScanner()) && PeekScanner() != ';') {
|
||||
if (isdigit(PeekScanner())) {
|
||||
AdvanceScanner();
|
||||
continue;
|
||||
@@ -243,7 +243,7 @@ Token* ParseString(void) {
|
||||
Token* ParseIdentifier(void) {
|
||||
int start = Position;
|
||||
|
||||
while(!ScannerAtEnd() && !IsPunctuation(PeekScanner()) && PeekScanner() != ' ' && PeekScanner() != '\n') {
|
||||
while(!ScannerAtEnd() && !IsPunctuation(PeekScanner()) && PeekScanner() != ' ' && PeekScanner() != '\n' && PeekScanner() != ';') {
|
||||
AdvanceScanner();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user