feat+ref: refactor + new types
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include <compiler/fzl_token.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
fzl_token_t *fzl_mktoken(const fzl_toktype_t type, uint16_t from, uint16_t to,
|
||||
fzl_token_t *fzl_mktoken(const fzl_toktype_t type, size_t line, size_t col,
|
||||
void *value, size_t value_len)
|
||||
{
|
||||
char *valholder = malloc(value_len + 1);
|
||||
@@ -10,12 +11,12 @@ fzl_token_t *fzl_mktoken(const fzl_toktype_t type, uint16_t from, uint16_t to,
|
||||
valholder[value_len] = '\0';
|
||||
|
||||
fzl_token_t *token = malloc(sizeof(fzl_token_t));
|
||||
token->type = type;
|
||||
token->i0 = from;
|
||||
token->i1 = to;
|
||||
token->type = type;
|
||||
token->ln = line;
|
||||
token->cn = col;
|
||||
token->store_value = value_len > 0;
|
||||
token->value = valholder;
|
||||
token->value_sz = value_len;
|
||||
token->value = valholder;
|
||||
token->value_sz = value_len;
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user