DEBUGSHUNTDO(printf("push (\n"));
}
else if (parser->tok == ')') {
- DEBUGSHUNTDO(printf("call )\n"));
+ DEBUGSHUNTDO(printf("do[nop] )\n"));
--parens;
if (parens < 0)
break;
wantop = nextwant;
parser->lex->flags.noops = !wantop;
} else {
+ bool nextwant = false;
if (parser->tok == '(') {
DEBUGSHUNTDO(printf("push (\n"));
++parens;
}
}
else if (parser->tok == ')') {
- DEBUGSHUNTDO(printf("calc )\n"));
+ DEBUGSHUNTDO(printf("do[op] )\n"));
--parens;
if (parens < 0)
break;
/* 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");
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;