diff mbox series

syntax errors in numbers are not fatal

Message ID 20200714214351.14516-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series syntax errors in numbers are not fatal | expand

Commit Message

Luc Van Oostenryck July 14, 2020, 9:43 p.m. UTC
When parsing expressions, if an invalid number is reached, a fatal
error is issued. But this is not the kind of error for which
continuing the processing doesn't make sense, since the token
was already categorized as a number during the tokenization.

So, change the fatal error into a normal one (and set the value to 0).

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 expression.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/expression.c b/expression.c
index 1160cd9cc593..02bb5b159d9f 100644
--- a/expression.c
+++ b/expression.c
@@ -379,7 +379,10 @@  Float:
 	return;
 
 Enoint:
-	error_die(expr->pos, "constant %s is not a valid number", show_token(token));
+	sparse_error(expr->pos, "constant %s is not a valid number", show_token(token));
+	expr->type = EXPR_VALUE;
+	expr->value = 0;
+	expr->ctype = &int_ctype;
 }
 
 static struct token *generic_selection(struct token *token, struct expression **tree)