[antlr-interest] Lexer token gating predicate problems
redrackem at yahoo.com
Fri Nov 12 07:46:35 PST 2010
Hi I'm new so please go easy on me. I have a situation where I have a PATH_ID
that has to allow many characters, and a general ID that has to match many
characters, but have their unique patterns.
So in my combined grammar in the lexer section, I have defined PATH_ID &
IDENTIFIER. I have also other tokens defined like INTEGER, STRING, etc.
So when I try to run input through the final implemenation (target=Python) I get
PATH_ID catching IDENTIFIERS, and just about anything else. What do I do to
make PATH_ID only activate in context of "include PATH_ID" or "log PATH_ID", and
never for other identifiers?
I've tried a lot of stuff with reordering tokens, predicates and gating symbols
and no matter what I've tried it doesn't compile AND run right. ("The following
token definitions can never be matched because prior tokens match the same
input", "rule PATH_ID has no defined parameters", "failed prediate", &c). If I
comment out PATH_ID then IDENTIFIER works fine, but I can't have a grammar
Thanks in advance!
More information about the antlr-interest