[antlr-interest] Parser seems to confuse strings and literals
charles.felstead at gmail.com
Mon Aug 14 17:02:31 PDT 2006
after I sent this request, I tried what you just proposed; I created on .g
file for both the lexer and the parser. But it does seem to change anything.
I did a clean build and everything.
I'm using ANTLRv2 so I can't use ['] instead of ["] in the parser rules. My
WORD definition sets the testLiterals option to true (even if that's the
case by default).
I'll check the *tokens files but I really don't know what else to check for,
thanks for your reply.
On 8/14/06, John B. Brodie <jbb at acm.org> wrote:
> on Mon, 14 Aug 2006 17:24:31, Charles Felstead asked:
> >I'm getting a message that says something like: Expecting "aaabbb", Found
> >'aaabbb'. The only apparent difference is the single quotes versus double
> >My parser has a rule that look like this:
> > :
> > TOPEN "aaabbb" WORD EQ ATTR_VAL TCLOSE
> > TOPEN "aaabbb" TCLOSE
> > ;
> >I've based my lexer/parser on the IDLv3 grammar from Gary Duzan. I know
> >problem has to do with the parser trying to match some LITERAL_aaabbb but
> >can't figure out a way of making it work. I'm sure this is a basic
> >... can someone help me out?
> if you are using ANTLR v3, use ' instead of " to surround literals in
> the grammar.
> if you are using ANTLR v2 and have separate lexer and parser .g files,
> token definitions are probably out of sync between the two .g files.
> check your usage of the importVocab/exportVocab options and ensure you
> are running the Tool on the .g files in the proper order. inspect the
> *Token.txt files to ensure that consistent numbering of the tokens has
> been used.
> if neither of the above, then can't help further. need more info...
> Hope this helps
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest