diff options
| author | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-12 12:57:20 +0200 |
|---|---|---|
| committer | Ákos Kőrösi <korakos99@gmail.com> | 2026-05-12 12:57:20 +0200 |
| commit | 3297384ec22c4931dc86b2429c8afe25b436682d (patch) | |
| tree | eeff6e612c84a8cfc0b7f32484a0f4e2ee1da91f /lex.h | |
| parent | a668be570b3b1b1d4c8a7e85159eece4080217c1 (diff) | |
add parsing codes and lexing renames
- outline more sketch code for parsing
- rename Region
Diffstat (limited to 'lex.h')
| -rw-r--r-- | lex.h | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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; |
