diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:12:28 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-14 21:12:28 +0200 |
commit | 69f9bed7bf1773f6dec07606abd4105ca4b90b4a (patch) | |
tree | 5a6d45eac7b33983ef30f5e830e330836a7b6200 /src | |
parent | 5671e8e4cdc3551b87a516d6130afb2243701ebd (diff) |
Allow identifiers in expressions
Diffstat (limited to 'src')
-rw-r--r-- | src/parser.c | 4 | ||||
-rw-r--r-- | src/parser.h | 3 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index b79d1f0..6e6838a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -114,6 +114,10 @@ parseexpr(struct ast *ast, struct lexemes toks) toksidx++; ast->kinds[i] = ASTNUMLIT; break; + case LEXIDENT: + toksidx++; + ast->kinds[i] = ASTIDENT; + break; case LEXLPAR: ast->kinds[i] = ASTFN; idx_t_ lhs = parseproto(ast, toks); diff --git a/src/parser.h b/src/parser.h index 96a0ed8..6780e24 100644 --- a/src/parser.h +++ b/src/parser.h @@ -28,6 +28,9 @@ enum { /* Braced block, sublist[lhs…rhs] */ ASTBLK, + /* Identifier literal */ + ASTIDENT, + /* Numeric literal */ ASTNUMLIT, |