mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-24 04:41:25 +00:00
fix unhelpful error message; fixes #123
This commit is contained in:
parent
98cb23ca63
commit
87b9fca732
1 changed files with 5 additions and 3 deletions
8
parser.c
8
parser.c
|
@ -311,8 +311,10 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
|
|||
ctx = vec_last(sy->ops).ctx;
|
||||
|
||||
if (vec_size(sy->out) < op->operands) {
|
||||
compile_error(ctx, "internal error: not enough operands: %i (operator %s (%i))", vec_size(sy->out),
|
||||
op->op, (int)op->id);
|
||||
if (op->flags & OP_PREFIX)
|
||||
compile_error(ctx, "expected expression after unary operator `%s`", op->op, (int)op->id);
|
||||
else /* this should have errored previously already */
|
||||
compile_error(ctx, "expected expression after operator `%s`", op->op, (int)op->id);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1664,7 +1666,7 @@ static ast_expression* parse_expression_leave(parser_t *parser, bool stopatcomma
|
|||
}
|
||||
}
|
||||
if (o == operator_count) {
|
||||
compile_error(parser_ctx(parser), "unknown operator: %s", parser_tokval(parser));
|
||||
compile_error(parser_ctx(parser), "unexpected operator: %s", parser_tokval(parser));
|
||||
goto onerr;
|
||||
}
|
||||
/* found an operator */
|
||||
|
|
Loading…
Reference in a new issue