You just don't consume after the '@' then and that token will stop there.
Jim On Sep 17, 2009, at 9:59 AM, Soren Holstebroe <[email protected]> wrote: > Thank you for your answer, > > As i understand it, your suggestion considers the whole template > line as a single token, but I don't want the template token to eat > up the rest of the line, since this is where my template wrapping > grammar would be. > > My grammar will have rules like this: > > wrap_option > : WRAP_OPTION_BEGIN > ( 'WRAP' > | 'TEMPLATE' '<' type_specifier (',' type_specifier)* '>' > ) > ; > > so I need something to match '//' WS* '@' as my WRAP_OPTION_BEGIN. > > Soren > > 2009/9/17 Indhu Bharathi <[email protected]> > Try using semantic predicates to look-ahead and decide whether to > emit SLCOMMENT or TEMPLATE > > > > Something like: > > > > fragment SLCOMMENT > > : ; > > > > fragment TEMPLATE > > : ; > > > > SLCOMMENT_OR_TEMPLATE > > : '//' ( > > { input.LA(1)=='@' }? > => ( options {greedy=false;} : . )* EOL { $type=TEMPLATE; } > > | ( options > {greedy=false;} : . )* EOL { $type=SLCOMMENT; } > > ) > > ; > > > 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 -~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
