From 100e1ed4d97d3958f8585d7d956ea0c4c9762f22 Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Tue, 12 May 2026 03:26:10 +0200 Subject: work on double-quote lexing --- lex.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'lex.h') diff --git a/lex.h b/lex.h index db4d713..ba2a666 100644 --- a/lex.h +++ b/lex.h @@ -1,7 +1,7 @@ #include "typeutils.h" -typedef struct Region Region; +typedef struct ExpansionRegion ExpansionRegion; typedef enum { @@ -10,24 +10,19 @@ typedef enum { DOUBLE_Q, } QuotationMode; - typedef enum { LITERAL, - CMD_SUB, - ARITHM, + REGION_EXP, VAR_EXP, // TODO: Later include other exps } ChunkKind; - typedef struct { ChunkKind kind; - QuotationMode mode; - + QuotationMode qmode; union { - char* lit_str; - Region* sub_cmd_region; - Region* arithm_expr_region; - char* param_string; + char* literal_str; + ExpansionRegion* reg_ptr; + char* varname; } as; } Chunk; @@ -61,12 +56,16 @@ DECLARE_VEC(Token, TokenVec) DECLARE_MAYBE(SpecialToken) +typedef enum { + CMD_SUB, + ARITHM, +} RegionMode; -struct Region { - QuotationMode mode; +struct ExpansionRegion { + RegionMode mode; TokenVec tokens; }; DECLARE_MAYBE(Chunk); -DECLARE_VEC(Region, RegionVec) +DECLARE_VEC(ExpansionRegion, ExpansionRegionVec) -- cgit v1.2.3