From 5a47ae6f4250fd655f3ec09e8e6447a1b7785e06 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Tue, 12 Nov 2024 18:12:58 +0800 Subject: [PATCH] fix `True not False` bug --- src/compiler/compiler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index a86343d9..f0de6e7c 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -1400,7 +1400,9 @@ static Error* parse_expression(Compiler* self, int precedence, bool allow_slice) TokenIndex op = curr()->type; advance(); PrattCallback infix = rules[op].infix; - assert(infix != NULL); + if(infix == NULL){ + return SyntaxError(self, "expected an expression, got %s", TokenSymbols[op]); + } check(infix(self)); } return NULL;