Petteri Räty wrote:
> The relevant stuff from a grammar:
>
> category: (alphanum|'+'|'_'|DOT) ( alphanum|'+'|'_'|DOT|'-')* {
> System.out.println($category.text); };
>
> alphanum: LOWER|UPPER|DIGIT;
>
> DOT : '.';
>
> DIGIT : '0'..'9';
> LOWER : 'a'..'z';
> UPPER : 'A'..'Z';
>
> Why does it only take the first character for category? Isn't * supposed
> to be greedy? I also tried adding options {greedy=true;} to the subrule
> but it doesn't make a difference.
>
> betelge...@pena ~/python/depend $ ATOM="app-foo" make
> java -cp <snip long cp> Main app-foo
> a
>
> Regards,
Read the 5 minute getting started stuff. YOur lexer rules for alphanum
are total conflict with the others, which should be fragments if really
want this. However, you are also confusing lexer rules with parser rules
I think. Your lexer rule should do the composite matching unless there
is some really good reason not to.
Jim
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
-~----------~----~----~----~------~----~------~--~---