add identifier to parser

This commit is contained in:
2025-06-01 02:28:27 +01:00
parent b7e9493171
commit d2518afb8e
20 changed files with 733 additions and 251 deletions

View File

@@ -1,17 +1,17 @@
#include "token.h"
#include <stdlib.h>
#include "../string/string.h"
#include <stdlib.h>
Token *create_token(TokenType type, int line, int column, char *value) {
Token * token = malloc(sizeof(Token));
token->type = type;
token->line=line;
token->column=column;
token->value=cloneString(value);
return token;
Token *token = malloc(sizeof(Token));
token->type = type;
token->line = line;
token->column = column;
token->value = cloneString(value);
return token;
}
void free_token(void * ptr) {
Token* token = ptr;
free(token->value);
void free_token(void *ptr) {
Token *token = ptr;
free(token->value);
}