diff --git a/src/expr.c b/src/expr.c index adf99e7b..1db1dd0b 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1825,8 +1825,8 @@ static expr_node * parse_function_call(char const **e, int *r, Var *locals, int return free_expr_tree(node); } if (TOKEN_IS(")")) { - Eprint("%s `)'", ErrMsg[E_ILLEGAL_CHAR]); - *r = E_ILLEGAL_CHAR; + Eprint("%s `)'", ErrMsg[E_PARSE_ERR]); + *r = E_PARSE_ERR; return free_expr_tree(node); } } @@ -2461,7 +2461,7 @@ static expr_node *parse_expression_aux(char const **e, int *r, Var *locals, int expr_node *parse_expression(char const **e, int *r, Var *locals) { char const *orig = *e; - + char const *o2 = *e; if (ExpressionEvaluationDisabled) { *r = E_EXPR_DISABLED; return NULL; @@ -2486,6 +2486,23 @@ expr_node *parse_expression(char const **e, int *r, Var *locals) fprintf(ErrFp, " Unparsed: %s\n", *e); } } + if (*r == E_EXPECT_COMMA || + *r == E_PARSE_ERR || + *r == E_MISS_RIGHT_PAREN || + *r == E_EXPECTING_EOL || + *r == E_ILLEGAL_CHAR) { + orig = o2; + while (*orig) { + fprintf(ErrFp, "%c", *orig++); + } + fprintf(ErrFp, "\n"); + orig = o2; + while ((orig < *e) && *orig) { + orig++; + fprintf(ErrFp, " "); + } + fprintf(ErrFp, "^-- here\n"); + } return node; } diff --git a/src/var.c b/src/var.c index 374864f1..38a7b5c3 100644 --- a/src/var.c +++ b/src/var.c @@ -567,6 +567,11 @@ int DoSet (Parser *p) ParseNonSpaceChar(p, &r, 0); } + if (p->isnested) { + Eprint("%s", "Do not use [] around expression in SET command"); + return E_CANTNEST_FDEF; + } + r = EvaluateExpr(p, &v); if (r) { DBufFree(&buf);