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,
> Petteri
> 
> 

Ok by attaching a Netbeans debugger I figured out what's going on. I have:
state_suffix
        : '_' ('alpha'|'beta'|'pre'|'rc'|'p') integer?;

From here antlr creates a token that matches 'p' when parsing alphanum.
Is there a better way than changing this to a validating semantic
predicated?

Regards,
Petteri

Attachment: signature.asc
Description: OpenPGP digital signature

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to