the generated code and the preview report an error for input a(b*b). If I replace
postfix_expr ::= expr '(' expr ')'
by
postfix_expr ::= expr '(' index ')'
index ::= expr
the input is accepted. The issue seems to be in the generated code:
public static boolean expr_0(PsiBuilder b, int l, int g) {
...
else if (g < 1 && consumeTokenSmart(b, OPEN_PAR)) {
r = report_error_(b, expr(b, l, 1));
r = consumeToken(b, CLOSE_PAR) && r;
exit_section_(b, l, m, POSTFIX_EXPR, r, true, null);
}
...
return r;
}
I'd have expected:
r = report_error_(b, expr(b, l, -1));
as we are matching CLOSE_PAR afterwards. (If there had been a third expression -- let's say ternary_expr ::= expr '?' expr ':' expr -- then that third expression should be parser with g=1 or whatever the priority for the rule is, but priority shouldn't play a role for the middle expression).
For the grammar
the generated code and the preview report an error for input
a(b*b)
. If I replaceby
the input is accepted. The issue seems to be in the generated code:
I'd have expected:
as we are matching CLOSE_PAR afterwards. (If there had been a third expression -- let's say
ternary_expr ::= expr '?' expr ':' expr
-- then that third expression should be parser with g=1 or whatever the priority for the rule is, but priority shouldn't play a role for the middle expression).