Attempting to declutter the lexer and tokenizer by rereolling them into the 'Scanner' object.

This commit is contained in:
2022-05-03 21:20:38 +00:00
parent 1900b504e7
commit 2c9478d311
4 changed files with 207 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#include "../includes/token.h"
Token* CreateToken(TokenType type, char* value) {
Token* token = calloc(1, sizeof(Token));
if (!token) return NULL;
token->type = type;
token->value = value;
return token;
}
void FreeToken(Token* token) {
if (!token) return;
if (token->value) free(token->value);
free(token);
}