Fixed the '!=' detection bug.

This commit is contained in:
2022-02-14 17:21:35 +00:00
parent db54e8f888
commit 5b90c98123
+4
View File
@@ -142,6 +142,7 @@ void ScanToken(TokenList* tokens) {
case '!':
if (Match('=')) AddTokenToList(Bang_Equal, "!=", 2, tokens);
else AddTokenToList(Bang, c, 1, tokens);
break;
case '/':
if (Match('/')) {
while(Peek() != '\n' && !IsAtEnd()) Advance();
@@ -157,6 +158,9 @@ void ScanToken(TokenList* tokens) {
case '\n':
line++;
break;
default:
fprintf(stderr, "Unexcpedted character %c\n", *c);
break;
}
}