Fixed a bug with string parsing in the Scanner.

This commit is contained in:
2022-03-15 18:37:25 +00:00
parent 1ded68ddee
commit d4dd459389
+2 -2
View File
@@ -212,6 +212,8 @@ void ParseString(TokenList *list) {
return;
}
AdvanceScanner();
char* lexeme = calloc(current - start + 1, sizeof(char));
if (!lexeme) {
@@ -222,8 +224,6 @@ void ParseString(TokenList *list) {
snprintf(lexeme, current - start, "%s", &source_code[start]);
AddToTokenList(CreateToken(lexeme, lexeme, line, String), list);
AdvanceScanner(); // The closing ".
}
void ParseNumber(TokenList* list) {