feat+fix: make compiler STRONGAAA

- FEAT: add source code length field in `fzl_reader_t` struct
- FIX: check name, lpair (lparen) and rpair (rparen) when lexing call
- FIX: check string literal termination
- FIX: increment position even on empty string to prevent infinite
lexing loop
- FIX: add string terminator in `fzl_mktoken` when allocating space for
string value
- FIX: add check for errors in recursevly called `walk`
- FIX: change source code holder from stack-stored `char[8192]` to
dynamically allocated with actual file size holder
- FIX: correct constant hasing util to hash actual string value instead
of link
This commit is contained in:
samsonium
2026-10-10 21:03:23 +03:00
parent f49a54c878
commit 1db985ecb5
7 changed files with 47 additions and 14 deletions
+2 -1
View File
@@ -5,8 +5,9 @@
fzl_token_t *fzl_mktoken(const fzl_toktype_t type, uint16_t from, uint16_t to,
void *value, size_t value_len)
{
void *valholder = malloc(value_len);
char *valholder = malloc(value_len + 1);
memcpy(valholder, value, value_len);
valholder[value_len] = '\0';
fzl_token_t *token = malloc(sizeof(fzl_token_t));
token->type = type;