Updated the token to more reflect what was implemented in the book. Maybe not the right way to handle it but perhaps this setup will come in handy in later chapters.

This commit is contained in:
2022-03-03 19:39:12 +00:00
parent caf4f02428
commit 5ea8079090
3 changed files with 33 additions and 27 deletions
+2 -1
View File
@@ -42,13 +42,14 @@ typedef struct {
typedef struct {
TokenType type;
const char* lexeme;
const void* literal;
int line;
} Token;
extern KeyValuePair TokenTypeMappings[TOKENTYPE_MAPPINGS_COUNT];
//If the first parameter is NULL, the token creation will attempt to infer the lexeme from the TokenType.
Token* CreateToken(const char*, int, TokenType);
Token* CreateToken(const char*, void*, int, TokenType);
void FreeToken(Token*);
#endif