summaryrefslogtreecommitdiff
path: root/lex.c
diff options
context:
space:
mode:
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
commit52f705e81ce2d7a42c6c14fca92c5e2a4326c988 (patch)
tree90c7ba2324f4d2e531a45cdefd827ab1177803ba /lex.c
parentf0016d8946958d029706b39ecd233044d3cf93f5 (diff)
wire up a basic test main with the lexing
Diffstat (limited to 'lex.c')
-rw-r--r--lex.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lex.c b/lex.c
index e8d6425..c59057e 100644
--- a/lex.c
+++ b/lex.c
@@ -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', &reg_arena);
+ TokenVec toks = lex_level(&line, '\0', &reg_arena);
+ return (LexResult){.top_tokens = toks, .reg_arena = reg_arena};
}