Refactored the scanner and updated the Token struct to store the length of its lexeme to avoid malloc()ing new strings for every token.

This commit is contained in:
2022-02-10 17:17:33 +00:00
parent 2d84019e58
commit 7bdbb9f53a
3 changed files with 55 additions and 14 deletions
+2 -1
View File
@@ -31,8 +31,9 @@ typedef enum {
typedef struct {
TokenType type;
char* lexeme;
const char* lexeme;
int line;
int length;
} Token;
typedef struct {