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

Keith Nicholas keith.nicholas at gmail.com
Tue Dec 21 19:14:18 PST 2010


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