# HG changeset patch # User lost # Date 1231117034 0 # Node ID 73423b66e511f29bebd94f7a65931e2ae773faa3 # Parent 309810f39ab73cca07588f19e9b5950911c09265 Fixed error with single char ascii constants diff -r 309810f39ab7 -r 73423b66e511 src/expr.c --- a/src/expr.c Mon Jan 05 00:44:38 2009 +0000 +++ b/src/expr.c Mon Jan 05 00:57:14 2009 +0000 @@ -185,6 +185,8 @@ debug_message(2, "Expression string %s", *p); eval_next: + if (!**p || isspace(**p) || **p == ')' || **p == ']') + return -1; if (**p == '(') { debug_message(3, "Starting paren"); @@ -304,6 +306,7 @@ // single ascii constant int val; (*p)++; + debug_message(3, "Single ascii character constant '%c'", **p); if (!**p) return -1; val = **p; @@ -311,6 +314,7 @@ t = lwasm_expr_term_create_int(val); lwasm_expr_stack_push(s, t); lwasm_expr_term_free(t); + return 0; } else if (**p == '&') { @@ -582,14 +586,14 @@ lwasm_expr_term_t *operterm; // return if we are at the end of the expression or a subexpression - if (!**p || isspace(**p) || **p == ')' || **p == ',') + if (!**p || isspace(**p) || **p == ')' || **p == ',' || **p == ']') return 0; if (lwasm_expr_parse_term(s, p) < 0) return -1; eval_next: - if (!**p || isspace(**p) || **p == ')' || **p == ',') + if (!**p || isspace(**p) || **p == ')' || **p == ',' || **p == ']') return 0; // expecting an operator here