+ if (!parser_close_paren(parser, &sy))
+ goto onerr;
+ vec_push(sy.ops, syop(parser_ctx(parser), op));
+ wantop = false;
+ --ternaries;
+ } else {
+ vec_push(sy.ops, syop(parser_ctx(parser), op));
+ wantop = !!(op->flags & OP_SUFFIX);
+ }
+ }
+ else if (parser->tok == ')') {
+ while (vec_size(sy.paren) && vec_last(sy.paren) == PAREN_TERNARY2) {
+ if (!parser_sy_apply_operator(parser, &sy))
+ goto onerr;
+ }
+ if (!vec_size(sy.paren))
+ break;
+ if (wantop) {
+ if (vec_last(sy.paren) == PAREN_TERNARY1) {
+ parseerror(parser, "mismatched parentheses (closing paren in ternary expression?)");
+ goto onerr;
+ }
+ if (!parser_close_paren(parser, &sy))
+ goto onerr;
+ } else {
+ /* must be a function call without parameters */
+ if (vec_last(sy.paren) != PAREN_FUNC) {
+ parseerror(parser, "closing paren in invalid position");
+ goto onerr;
+ }
+ if (!parser_close_paren(parser, &sy))
+ goto onerr;
+ }
+ wantop = true;
+ }
+ else if (parser->tok == '(') {
+ parseerror(parser, "internal error: '(' should be classified as operator");
+ goto onerr;
+ }
+ else if (parser->tok == '[') {
+ parseerror(parser, "internal error: '[' should be classified as operator");
+ goto onerr;
+ }
+ else if (parser->tok == ']') {
+ while (vec_size(sy.paren) && vec_last(sy.paren) == PAREN_TERNARY2) {
+ if (!parser_sy_apply_operator(parser, &sy))
+ goto onerr;
+ }
+ if (!vec_size(sy.paren))
+ break;
+ if (vec_last(sy.paren) != PAREN_INDEX) {
+ parseerror(parser, "mismatched parentheses, unexpected ']'");
+ goto onerr;
+ }
+ if (!parser_close_paren(parser, &sy))
+ goto onerr;
+ wantop = true;
+ }
+ else if (!wantop) {
+ if (!parse_sya_operand(parser, &sy, with_labels))
+ goto onerr;
+#if 0
+ if (vec_size(sy.paren) && vec_last(sy.ops).isparen && vec_last(sy.paren) == PAREN_FUNC)
+ vec_last(sy.argc)++;
+#endif
+ wantop = true;
+ }
+ else {
+ /* in this case we might want to allow constant string concatenation */
+ bool concatenated = false;
+ if (parser->tok == TOKEN_STRINGCONST && vec_size(sy.out)) {
+ ast_expression *lexpr = vec_last(sy.out).out;
+ if (ast_istype(lexpr, ast_value)) {
+ ast_value *last = (ast_value*)lexpr;
+ if (last->isimm == true && last->cvq == CV_CONST &&
+ last->hasvalue && last->expression.vtype == TYPE_STRING)
+ {
+ char *newstr = NULL;
+ util_asprintf(&newstr, "%s%s", last->constval.vstring, parser_tokval(parser));
+ vec_last(sy.out).out = (ast_expression*)parser_const_string(parser, newstr, false);
+ mem_d(newstr);
+ concatenated = true;
+ }
+ }
+ }
+ if (!concatenated) {
+ parseerror(parser, "expected operator or end of statement");
+ goto onerr;