]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
after a closing paren another operator has to be expected again
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 12 Aug 2012 18:21:21 +0000 (20:21 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 12 Aug 2012 18:21:21 +0000 (20:21 +0200)
parser.c

index 6654e9120fb7049b49e756600b09963446247924..973ab4bc3c7ca0a0cb9cb4dce699e71eca315115 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -724,7 +724,7 @@ static ast_expression* parser_expression(parser_t *parser)
                 DEBUGSHUNTDO(printf("push (\n"));
             }
             else if (parser->tok == ')') {
-                DEBUGSHUNTDO(printf("call )\n"));
+                DEBUGSHUNTDO(printf("do[nop] )\n"));
                 --parens;
                 if (parens < 0)
                     break;
@@ -740,6 +740,7 @@ static ast_expression* parser_expression(parser_t *parser)
             wantop = nextwant;
             parser->lex->flags.noops = !wantop;
         } else {
+            bool nextwant = false;
             if (parser->tok == '(') {
                 DEBUGSHUNTDO(printf("push (\n"));
                 ++parens;
@@ -750,7 +751,7 @@ static ast_expression* parser_expression(parser_t *parser)
                 }
             }
             else if (parser->tok == ')') {
-                DEBUGSHUNTDO(printf("calc )\n"));
+                DEBUGSHUNTDO(printf("do[op] )\n"));
                 --parens;
                 if (parens < 0)
                     break;
@@ -758,6 +759,7 @@ static ast_expression* parser_expression(parser_t *parser)
                 /* closing an opening paren */
                 if (!parser_close_paren(parser, &sy, false))
                     goto onerr;
+                nextwant = true;
             }
             else if (parser->tok != TOKEN_OPERATOR) {
                 parseerror(parser, "expected operator or end of statement");
@@ -820,8 +822,8 @@ static ast_expression* parser_expression(parser_t *parser)
                 if (!shunt_ops_add(&sy, syop(parser_ctx(parser), op)))
                     goto onerr;
             }
-            wantop = false;
-            parser->lex->flags.noops = true;
+            wantop = nextwant;
+            parser->lex->flags.noops = !wantop;
         }
         if (!parser_next(parser)) {
             goto onerr;