At 07:54 15/10/2008, `VL wrote:
>Hmm. This looks better. But it doesn't match construction
>like this: $(VAR)/some/path.
That's a different form than what you were showing before :)
To match that, you can treat them all as equals:
PATH : ('/' | ENVAR | ID | INT)+;
Of course, this no longer guarantees that there is a '/' present
at all.
Another option specifically for the leading-ENVAR case (basically
assuming that all paths must be absolute, but the base path may be
contained in an ENVAR):
PATH : ENVAR? ('/' (ID | INT)*)+;
You do need to be careful you're not doing too much work in the
lexer, though. Remember that the lexer is context-free, and all
top-level rules are always candidates to match the input. You may
therefore end up with a different token type than you're
expecting, if there is overlap between the token rules.
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---