[antlr-interest] org.antlr.runtime.tree.RewriteEmptyStreamException

Jim Idle jimi at temporal-wave.com
Wed Jul 7 10:42:08 PDT 2010



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of David Maier
> Sent: Wednesday, July 07, 2010 10:18 AM
> To: Andrew Haley
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest]
> org.antlr.runtime.tree.RewriteEmptyStreamException
> 
> Hi Andrew,
> 
> yes it worked by using the (?) operator on one level above. However, it
> seems that the problem does occur dependent on the input. So there may
> be other rules in my grammar those are affected. So this is the reason
> why I would appreciate that it works as expected.

It works as it should, but your expectations are not correct I am afraid. Generally you are falling over on style:


X : a* b -> ^(NODE a* b) ;

Rather than

x : a b  -> ^(NODE a* b) ;
a: x* ;

Then what you think happens does happen. It also removes extra method calls (generally).

Jim







More information about the antlr-interest mailing list