[antlr-interest] Rewrite problem.

craig at palantir.co.za craig at palantir.co.za
Thu Jun 18 23:35:16 PDT 2009


Hi,

I am trying to rewrite this tree so that the 'or' always appears, with either
one or more of the nodes. Unfortunately I get a runtime error saying that the
stream is empty RewriteEmptyStreamException.

I am using csharp2.


   orExpr      : andExpr (or='or' andExpr)*
                 -> {null != or}? ^('or' andExpr+)
                 -> ^('or' andExpr)
               ;

I actually just wanted
  orExpr : andExpr ('or' andExpr)* -> ^('or' andExpr+);

I thought this would work, but it doesn't.

Any work arounds?

Thanks
Regards
Craig.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the antlr-interest mailing list