...
No Format |
---|
e : parse_expr[0] ; // rewrite e to this rule, which invokes the precedence engine /** "Precedence climbing" engine parse_expr[int p] : (primary->primary) ( {prec[input.LA(1)]>=p}?=> bop r=e parse_expr[nextp(p)] -> ^(bop $e $r) | {postprec[input.LA(1)]>=p}?=> suffix[$e.tree] -> {$suffix.tree} )* ; |
where rule suffix
is described below (basically we remove e
references from the left edge). If there are no suffix operators, the 2nd alt of the (...)* is not generated.
If you specify a rule with option parser=precedence, ANTLR does the new magical thing:
...