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:
2023-04-14 13:28:44 -05:00
parent aa3888b578
commit a9e57132be
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -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();
}