diff options
| author | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-12 10:23:03 +0200 |
|---|---|---|
| committer | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-12 10:23:03 +0200 |
| commit | 52f705e81ce2d7a42c6c14fca92c5e2a4326c988 (patch) | |
| tree | 90c7ba2324f4d2e531a45cdefd827ab1177803ba | |
| parent | f0016d8946958d029706b39ecd233044d3cf93f5 (diff) | |
wire up a basic test main with the lexing
| -rw-r--r-- | lex.c | 11 | ||||
| -rw-r--r-- | lex.h | 8 | ||||
| -rw-r--r-- | main.c | 1 |
3 files changed, 12 insertions, 8 deletions
@@ -205,14 +205,9 @@ TokenVec lex_level(RawLine* line, char until, ExpansionRegionVec* reg_arena) { } -typedef struct { - TokenVec top_tokens; - ExpansionRegionVec reg_arena; -} LexResult; - - -TokenVec lex(char* input) { +LexResult lex(char* input) { RawLine line = {.str = input, .pos = 0}; ExpansionRegionVec reg_arena = make_ExpansionRegionVec(256); - return lex_level(&line, '\0', ®_arena); + TokenVec toks = lex_level(&line, '\0', ®_arena); + return (LexResult){.top_tokens = toks, .reg_arena = reg_arena}; } @@ -76,4 +76,12 @@ DECLARE_MAYBE(Chunk); DECLARE_VEC(ExpansionRegion, ExpansionRegionVec) + +typedef struct { + TokenVec top_tokens; + ExpansionRegionVec reg_arena; +} LexResult; + + +LexResult lex(char* input); #endif @@ -12,6 +12,7 @@ int main() { line = readline("$"); if (line[0] == '\0') continue; if (strcmp(line, "exit") == 0) exit(0); + LexResult res = lex(line); printf("%s \n", line); } |
