At 04:59 4/11/2008, Robert Soule wrote:
 >start 
 >      : LSQUARE AB RSQUARE
 >      | A
 >      ;
 >AB    :       ('a'|'b')+;
 >
 >fragment A: '[a]';
 >LSQUARE
 > :  (A) => A { $type = A; }
 > |  '['
 > ;
 >
 >RSQUARE       :       ']';
 >
 >
 >When I test with inputs "[ba]" I pass, but "[ab]" fails.

It works for me (ANTLR 3.0.1).  You are using a real compiled 
parser, though, right (or ANTLRworks' debugger)?  Not the 
interpreter?  Because the interpreter doesn't execute predicates 
(so it almost never works properly).

If I change the start rule given above to this:

start : (LSQUARE AB RSQUARE | A)+ ;

then it'll successfully match the input "[ba][a][ab]".


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to