[antlr-interest] Reading a string of fixed size

Edwards, Waverly Waverly.Edwards at genesys.com
Mon Aug 27 06:41:01 PDT 2007



>>This error is because you have both CAMI_STRING and CAMI_STRING2 in
your lexer, and they conflict....

Excellent.  I'm learning more and more daily.  Before I know it, I'll
have something
that is fully functional.  I'm still learning how ANTLR works. 

Thanks,


W.

-----Original Message-----
From: Gavin Lambert [mailto:antlr at mirality.co.nz] 
Sent: Monday, August 27, 2007 9:02 AM
To: Edwards, Waverly; antlr-interest at antlr.org
Subject: Re: [antlr-interest] Reading a string of fixed size

At 22:24 27/08/2007, Edwards, Waverly wrote:
 >The error:
 >line 1:0 required (...)+ loop did not match anything at input
>'5:abcde'
[...]
 >start         : CAMI_STRING2
[...]
 >CAMI_STRING   : Digit+ ':' Letter AlphaNum*
[...]
 >CAMI_STRING2   : Number ':' AlphaNumStr

This error is because you have both CAMI_STRING and CAMI_STRING2 in your
lexer, and they conflict.  The result is that the lexer will be
outputting CAMI_STRING tokens (since they both consume the same amount,
the first listed one wins), and your parser will only accept
CAMI_STRING2 tokens, which don't exist.

Comment out the CAMI_STRING rule and it should work.

(The important thing to bear in mind is that all lexing is done before
parsing begins.  The parser cannot influence the lexer in any way.)



More information about the antlr-interest mailing list