[antlr-interest] Bug in Python Filter Lexers

Dave Dutcher dave at tridecap.com
Wed Apr 1 11:22:54 PDT 2009


Hello,

I am writing a lexer grammar with Antlr 3.1.3, and I've turned the filter
option turned on and I'm targeting Python.  I tried to set the text of a
particular token calling self.setText in an action.  The token I wanted to
change is changed, but every token in the stream after that point is also
changed.  For example a rule like:

grammar test;
options 
{ 
   filter = true;
   language = Python;
}
[snip]
ID : '[' i=INT ']' { self.setText($i.text) };
[snip]

Will cause every following lexer rule to have the text of the int.  I tried
the Java target, and it worked fine, so I think this is a bug.  I can post a
full example if that would help.

Thanks,

Dave





More information about the antlr-interest mailing list