]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fix unhelpful error message; fixes #123
authorWolfgang Bumiller <wry.git@bumiller.com>
Sat, 31 Aug 2013 08:19:10 +0000 (10:19 +0200)
committerWolfgang Bumiller <wry.git@bumiller.com>
Sat, 31 Aug 2013 08:19:10 +0000 (10:19 +0200)
parser.c

index 1cd74dd8ef49c9141e005abccc4280b376869d0c..9cbb8d16b017b1b7e45e7bc7104fb93604eb382d 100644 (file)
--- a/parser.c
+++ b/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 */