From 60809018421fc576381ebe521eeb20b77c89ecd0 Mon Sep 17 00:00:00 2001 From: r4 Date: Tue, 21 Dec 2021 11:55:53 +0100 Subject: [PATCH] catch missing expression --- parse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parse.c b/parse.c index 97f4054..0b5cc84 100644 --- a/parse.c +++ b/parse.c @@ -221,6 +221,11 @@ static void expr(State *s, Scope *parent_sc, TokListItem *t, bool toplevel, bool * NOTE: Sometimes, we don't reach this point because the function already * exits directly after the last operation. */ if (l_op_prec == PREC_DELIM && r_op_prec == PREC_DELIM) { + if (t->tok.kind != TokVal && t->tok.kind != TokIdent) { + mark_err(&t->tok); + set_err("Expected literal or identifier"); + return; + } IRParam res; TRY(res = tok_to_irparam(sc, &t->tok)); irtoks_app(s->ir, (IRTok){