diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-11 01:11:14 +0200 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-07-15 00:00:12 +0200 |
commit | 7d648be9208b26bee94ecc0dad8511c92a7fe339 (patch) | |
tree | 7611087c212e6fae4fcbae09c715dcf7ca1eea27 | |
parent | 635db41c41a436cf0e8d27a5e70898b5332425ed (diff) | |
download | sparse-7d648be9208b26bee94ecc0dad8511c92a7fe339.tar.gz |
syntax errors in numbers are not fatal
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>
-rw-r--r-- | expression.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/expression.c b/expression.c index 1160cd9c..02bb5b15 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) |