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 -3
View File
@@ -9,11 +9,13 @@
typedef enum
{
FZL_TOKTYPE_NAME, // abc
FZL_TOKTYPE_TYPE, // i16
FZL_TOKTYPE_LPAREN, // (
FZL_TOKTYPE_RPAREN, // )
FZL_TOKTYPE_COMMA, // ,
FZL_TOKTYPE_DOT, // .
FZL_TOKTYPE_STR_LITERAL, // ""
FZL_TOKTYPE_NUM_LITERAL, // 123
@@ -24,21 +26,23 @@ typedef enum
FZL_TOKTYPE_MINUS, // -
FZL_TOKTYPE_CARET, // ^
FZL_TOKTYPE_PERCENT, // %
FZL_TOKTYPE_EQ // =
} fzl_toktype_t;
// Token descriptor
typedef struct
{
fzl_toktype_t type;
uint16_t i0;
uint16_t i1;
size_t ln;
size_t cn;
bool store_value;
void *value;
uint16_t value_sz;
} fzl_token_t;
// Allocate new token
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_sz);
// Free token and its contents