From 69f9bed7bf1773f6dec07606abd4105ca4b90b4a Mon Sep 17 00:00:00 2001
From: Thomas Voss <mail@thomasvoss.com>
Date: Fri, 14 Jun 2024 21:12:28 +0200
Subject: Allow identifiers in expressions

---
 src/parser.c | 4 ++++
 src/parser.h | 3 +++
 2 files changed, 7 insertions(+)

(limited to 'src')

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,
 
-- 
cgit v1.2.3