From 3297384ec22c4931dc86b2429c8afe25b436682d Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Tue, 12 May 2026 12:57:20 +0200 Subject: add parsing codes and lexing renames - outline more sketch code for parsing - rename Region --- lex.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lex.h') diff --git a/lex.h b/lex.h index f8d48ab..b6a102d 100644 --- a/lex.h +++ b/lex.h @@ -4,7 +4,7 @@ #include "typeutils.h" -typedef struct ExpansionRegion ExpansionRegion; +typedef struct Region Region; typedef enum { @@ -24,13 +24,15 @@ typedef struct { QuotationMode qmode; union { char* literal_str; - ExpansionRegion* reg_ptr; + Region* reg_ptr; char* varname; } as; } Chunk; -DECLARE_VEC(Chunk, ChunkVec) +DECLARE_VEC(Chunk, Word) + +DECLARE_VEC(Word, WordVec) typedef enum { TOK_WORD, @@ -52,7 +54,7 @@ typedef struct { TokenKind kind; union { - ChunkVec word; + Word word; SpecialToken spec; } as; } Token; @@ -67,19 +69,19 @@ typedef enum { ARITHM, } RegionMode; -struct ExpansionRegion { +struct Region { RegionMode mode; TokenVec tokens; }; DECLARE_MAYBE(Chunk); -DECLARE_VEC(ExpansionRegion, ExpansionRegionVec) +DECLARE_VEC(Region, RegionVec) typedef struct { TokenVec top_tokens; - ExpansionRegionVec reg_arena; + RegionVec reg_arena; } LexResult; -- cgit v1.2.3