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.
However, thanks for your advise! Regards, David -- David Maier Senior Software Engineer Ingres Germany GmbH Weimarer Straße 1a D-98693 Ilmenau PHONE: +49.3677.6785-59 FAX: +49.3677.6785-23 MAIL: [email protected] This transmission is confidential and intended solely for the use of the recipient named above. It may contain confidential, proprietary, or legally privileged information. If you are not the intended recipient, you are hereby notified that any unauthorized review, use, disclosure or distribution is strictly prohibited. If you have received this transmission in error, please contact the sender by reply e-mail and delete the original transmission and all copies from your system. -----Ursprüngliche Nachricht----- Von: Andrew Haley [mailto:[email protected]] Gesendet: Mi 07.07.2010 18:49 An: David Maier Cc: [email protected] Betreff: Re: AW: [antlr-interest]org.antlr.runtime.tree.RewriteEmptyStreamException On 07/07/2010 05:42 PM, David Maier wrote: > thanks for your quick reply Andrew. But shouldn't the following rule be > enough to make ANTRL aware of that it can be void: > > sp_decls: (sp_decl ';')* -> (sp_decl)*; That part is fine. sp_block_content, however, don't know that sp_decls might return a void result. > I mean that the Kleene operator (*) means to also match the empty word, > right? So I think the following is true for rules named 'a', 'b' and 'c': > > > (1) My variant > > a : b; > b : c*; > > > with > > c* := /*empty*/ | c+ > > and if I resolve it then 'a' means: > > a: /*empty*/ | c+ > > > (2) Your variant > > a: b?; > b: c*; > > with > > b?:= /*empty*/ | b > > b:= /*empty*/ | c+ > > and so > > a:= /*empty*/ | /*empty*/ | c+ := /*empty*/ | c+ > > > So you can see that both should mean the same. So is it a kind of ANTLR > issue that I would have to use the (?) operator here? Did you try it? If so, did it work? The rewrite rules are not part of the formal grammar as such, and you may need to do things you don't expect. As to whether this is an ANTLR bug, I don't know. I can't find anything in the spec one way or the other. Andrew. List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
