fix(lexer): keyword tokens now also contains the char *data
This commit is contained in:
parent
58fd9d530e
commit
19c9ce6c5d
1 changed files with 5 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue