aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c
index defe47d..9e748b5 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -47,6 +47,9 @@ static idx_t astalloc(ast_t *ast)
static void astresz(ast_t *ast)
__attribute__((nonnull));
+/* Generated by Gperf */
+bool iskeyword(strview_t);
+
/* TODO: Make thread-local? */
static size_t toksidx;
@@ -177,6 +180,9 @@ parsedecl(ast_t *ast, aux_t *aux, lexemes_t toks, bool toplvl)
ast->lexemes[i] = toksidx;
}
+ if (iskeyword(toks.strs[toksidx]))
+ err("parser: Cannot use reserved word as identifier");
+
if (toks.kinds[toksidx++] != LEXIDENT)
err("parser: Expected identifier");
if (toks.kinds[toksidx++] != LEXCOLON)