summaryrefslogtreecommitdiff
path: root/lex.h
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-12 03:26:10 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-12 03:26:10 +0200
commit100e1ed4d97d3958f8585d7d956ea0c4c9762f22 (patch)
treee5de4cad8087bfbcafb171bff219bac7ae40272a /lex.h
parentb59501340a5d6b1c0ace169f140391cc0555015e (diff)
work on double-quote lexing
Diffstat (limited to 'lex.h')
-rw-r--r--lex.h27
1 files changed, 13 insertions, 14 deletions
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)