feat+ref: refactor + new types

This commit is contained in:
samsonium
2026-10-11 08:51:54 +03:00
parent e3b8ec6b7d
commit 83e20d78f3
13 changed files with 532 additions and 341 deletions
+7 -6
View File
@@ -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;
}