From ca55816a231800893ee00ea07060f7cfb4c34185 Mon Sep 17 00:00:00 2001 From: cozis Date: Wed, 3 Nov 2021 01:14:08 +0000 Subject: [PATCH] added script that triggers a bug --- samples/if-else.noja | 6 ++++-- src/compiler/parse.c | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/samples/if-else.noja b/samples/if-else.noja index 348a37c..a46e8a1 100644 --- a/samples/if-else.noja +++ b/samples/if-else.noja @@ -1,6 +1,8 @@ +p = (true); -if true - a = 1; +if p + (a = 1); else a = 2; + return a; \ No newline at end of file diff --git a/src/compiler/parse.c b/src/compiler/parse.c index a7f07f5..e893b14 100644 --- a/src/compiler/parse.c +++ b/src/compiler/parse.c @@ -338,19 +338,15 @@ static inline _Bool done(Context *ctx) return current(ctx) == TDONE; } +#warning "TEMP" +#include + static Node *parse_statement(Context *ctx) { assert(ctx != NULL); switch(current(ctx)) { - case '*': - case '/': - case TASS: - case TDONE: - UNREACHABLE; - break; - case '(': case '+': case '-': @@ -408,7 +404,7 @@ static Node *parse_statement(Context *ctx) case TKWFUN: return parse_function_definition(ctx); } - + Error_Report(ctx->error, 0, "Got token \"%.*s\" where the start of a statement was expected", ctx->token->length, ctx->src + ctx->token->offset); return NULL;