[antlr-interest] NOOB question, antlr giving a "mismatched input" result.....

Keith Nicholas keith.nicholas at gmail.com
Tue Dec 21 20:07:56 PST 2010


ok.... problem solved.

I had a token defined which was incorrectly matching.

On Wed, Dec 22, 2010 at 4:14 PM, Keith Nicholas <keith.nicholas at gmail.com>wrote:

> given the grammar
>
> test    : 'test' ID '\n' 'begin' '\n'  'end' '\n' -> ^(TEST ID);
>
> ID  :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
>     ;
> and a test string of
>
> "test blah\n begin\n end\n"
> resulting in
>
> line 1:0 mismatched input 'test blah\\n begin\\n end\\n' expecting 'test'
> <mismatched token: [@0,0:21='test blah\\n begin\\n end\\n',<12>,1:0],
> resync=test blah
>  begin
>  end
> >
>


More information about the antlr-interest mailing list