Thank you! My problem was that I was testing the solution with the
interpreter.
thanks again for your help,
Robert
On Mon, Nov 3, 2008 at 3:00 PM, Gavin Lambert <[EMAIL PROTECTED]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---