2010/2/22 Daniels, Troy (US SSA) <[email protected]> > So > > Super; [TYPE] method > > Should resolve as (1) followed by 3, but > > Super [TYPE] method > > Should resolve as (2)? >
Exactly > > I think you probably want to include the semicolons in your default token > stream. You would then have rules like > > type_method : TYPE METHOD SEMI? ; > > super : SUPER ( SEMI | type_method | /* nothing */ ) ; > > You could even rewrite super in the standard style for this grammar: > > super : SUPER type_method_base? SEMI? ; > > type_method : type_method_base SEMI? ; > > type_method_base : TYPE METHOD ; > > Well, yes, I am starting reconsidering my approach and probably I will include these in my grammar. Only that this whole SEMI? clutter everywhere makes me sick, but overall effect is probably better. I did not think of all implications before, I am afraid, because now I see that ignoring semicolons in the lexer, as I did, causes that they may appear in places where they are not allowed, and my parser clearly had no chance to spot this error. > > It seems that would also be a more straightforward representation of the > grammar. Even if you can get the channel switching to work, will you > remember why you are doing it six months from now? Will you still > understand the corner cases? Even if you do, what about the guy who works > on this after you? What I outlined fairly clearly says "semi colons are > optional" and makes it clear that "super ; [TYPE] ..." is two statements. > > Yes, and it probably will make my syntactic predicates work as expected. Probably that is the right way. Thanks -- Greetings Marcin Rzeźnicki 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.
