[antlr-interest] Help please, is 'bactrack=true' working?
Lloyd Dupont
ld at galador.net
Fri Jul 13 08:30:11 PDT 2007
I am running and debugging with ANTLR 1.0.2
When I try to debug the rule below
====
classname
options { greedy=true; backtrack=true; }
: (( { IsXamlPrefix(input.LT(1).getText()) }? xaml=ID COLON )? id0=ID -> ^( ID[$id0] $id0 ^( XAMLNS $xaml )? ) )
( DOT id1=ID -> ^( DOT $classname $id1 ) )*
( /*(LT classname (COMMA classname)* GT)=> */ LT gt+=classname (COMMA gt+=classname)* GT -> ^( GENERICTYPE $classname $gt+ ) )?
;
====
compilation fails, telling me to solve the problem by using 'backtrack=true'.
But, as you can see, backtrack is already set to true?!?!?!?
furthermore if I use predictae like that
=======
classname
options { greedy=true; backtrack=true; }
: (( { IsXamlPrefix(input.LT(1).getText()) }? xaml=ID COLON )? id0=ID -> ^( ID[$id0] $id0 ^( XAMLNS $xaml )? ) )
( DOT id1=ID -> ^( DOT $classname $id1 ) )*
( /*(LT classname (COMMA classname)* GT)=> */ LT gt+=classname (COMMA gt+=classname)* GT -> ^( GENERICTYPE $classname $gt+ ) )?
;
=======
when I try to debug and evaluate:
==========
identifier
options { greedy=true; backtrack=true; }
: (classname) => classname -> classname
| ID -> ^(ID ID)
;
==========
with a simple string like: "a.b<c,d>" it fails to read the class name and just return the ID: 'a' instead of the classname "a.b<c,d>"
(in ANTLRWork I have classname in red, reading twice "a.c<c,d>" (and the next char) and then returning just the ID a)
Any way to debug this ANTLR bug please??!?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070714/2979209e/attachment-0001.html
More information about the antlr-interest
mailing list