Fixed a bug with string parsing in the Scanner.
This commit is contained in:
@@ -212,6 +212,8 @@ void ParseString(TokenList *list) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AdvanceScanner();
|
||||||
|
|
||||||
char* lexeme = calloc(current - start + 1, sizeof(char));
|
char* lexeme = calloc(current - start + 1, sizeof(char));
|
||||||
|
|
||||||
if (!lexeme) {
|
if (!lexeme) {
|
||||||
@@ -222,8 +224,6 @@ void ParseString(TokenList *list) {
|
|||||||
snprintf(lexeme, current - start, "%s", &source_code[start]);
|
snprintf(lexeme, current - start, "%s", &source_code[start]);
|
||||||
|
|
||||||
AddToTokenList(CreateToken(lexeme, lexeme, line, String), list);
|
AddToTokenList(CreateToken(lexeme, lexeme, line, String), list);
|
||||||
|
|
||||||
AdvanceScanner(); // The closing ".
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParseNumber(TokenList* list) {
|
void ParseNumber(TokenList* list) {
|
||||||
|
|||||||
Reference in New Issue
Block a user