fix(lexer): keyword tokens now also contains the char *data

This commit is contained in:
Matteo Flebus 2026-01-14 18:48:12 +01:00
parent 58fd9d530e
commit 19c9ce6c5d

View file

@ -82,6 +82,11 @@ static void set_token_keyword(struct token *tok, char *begin, ssize_t size)
{
tok->type = TOKEN_ELSE;
}
tok->data = calloc(size + 1, sizeof(char));
if (tok->data == NULL)
return;
strncpy(tok->data, begin, size);
}
/* @brief: if token_type has not yet been set, then it is a TOKEN_WORD