[antlr-interest] Lexer problem with multiple syntactic predicates passing down to other rules

Sam Barnett-Cormack sdb at geekworld.co.uk
Wed Apr 12 16:28:47 PDT 2006


As the amazingly verbose subject suggests, I have a lexer problem. The
file is at http://shed.geekworld.co.uk/~sdb/jguru/antlr/csv.g

Basically, it's reading a file with the first line:

Dept,X,Y

The parser is expecting a token of type MIXEDTEXT, QUOTEDSTRING, INT or
FLOAT. Of course, the lexer is matching to type FIELD, but the actions
and syntactic predicates send it down to match a MIXEDTEXT, and I
thought it would be setting the token type. However, it seems only the
first one or two $setType()s are acting, as it actually ends up as a
FLOAT_OR_INT_OR_STRING (or that might be a FLOAT_OR_STRING). I'm
confused. Can anyone shed any light on this?

Sam


More information about the antlr-interest mailing list