[antlr-interest] How to use greedy in antlr3

Pantzagias, Martina Martina.Pantzagias at Elektrobit.com
Tue Nov 28 07:00:21 PST 2006


Hi everybody,
 
I´m using ANTLR3 with AW since some weeks and I have a problem with one of my lexer rules.Consider the following pseudocode:
 
alternative 1:
    eat everything between '{' ... '}' until you get the token '}'
 
alternative 2:
    eat everything between '{!{' ... '}!}' until you get '}!}'
 
 
Here is my lexer rule "Tag"
 
Tag
    :    '{' (options{greedy=false;}: .)* '}'
    ;
 
This works fine, but if I add the second alternative an warning occurs (--> multiple alternatives):
 
Tag
    :    '{' (options{greedy=false;}: .)* '}'
    |    '{!{' (options{greedy=false;}: .)* '}!}'
 
 
How can I solve this problem?
 
 
 
best regards,
Martina


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061128/776cf6d0/attachment.html 


More information about the antlr-interest mailing list