From: Wolfgang (Blub) Bumiller Date: Sun, 12 Aug 2012 18:21:21 +0000 (+0200) Subject: after a closing paren another operator has to be expected again X-Git-Tag: 0.1-rc1~336 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c7cca404dcaa039423cd5ac2f5f89e71e1b255d3;p=xonotic%2Fgmqcc.git after a closing paren another operator has to be expected again --- diff --git a/parser.c b/parser.c index 6654e91..973ab4b 100644 --- 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;