[antlr-interest] Rewrite only if rule returns non-empty result

Christian chwchw at gmx.de
Wed Oct 26 03:29:13 PDT 2011


Hi community,

I have the following rule:

unary_expression
  : unary_expr -> ^(UNARY_EXPRESSION unary_expr)
  ;

I want to rewrite it only if unary_expr returns a non-empty result.
Actually, I want to solve the
org.antlr.runtime.tree.RewriteEmptyStreamException: rule unary_expr. I
think, it is quite easy, but I am too new to ANTLR.

Regards,
Christian


More information about the antlr-interest mailing list