Am Dienstag, 4. August 2009 14:52:40 schrieb Tom:
> I have a pretty simply grammar to construct; it must find balanced
> tokens in a stream. For example:
> aaa %{ bbb }% ccc
>
> These may be nested:
> aaa %{ aaa %{ bbb }% ccc }% ccc
>
> or not present at all:
> aaa
>
> or consequtive:
> aaa %{ bbb }% ccc %{ bbb }% ccc
>
> So all a need to do is find the tokens with non-tokens in between. This
> is the grammar I expected that would do that:
>
> /*------------------------------------------------------------------
> * PARSER RULES
> *------------------------------------------------------------------*/
>
> noloop: (~( LOOPSTART | LOOPEND ))*
> ;
this combination of scanner rules, negation and parser rule is not easy to get
to work.
Have you tried to add a lexer rule:
NOLOOP: (~( LOOPSTART | LOOPEND ))*;
this should match all other characters, then use this token in your parser
rules...
allthough Ihave not tried it...
cheers
Michael
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
-~----------~----~----~----~------~----~------~--~---