[antlr-interest] Getting mismatched input error - 'find' expecting 'find' !!

Terence Parr parrt at cs.usfca.edu
Fri Oct 26 18:22:42 PDT 2007


Hi. it sounds like a token type coherency problem. Token types in  
lexer grammar are different from parser.  make sure you importVocab
Ter
On Oct 27, 2007, at 1:26 AM, Sumanto Biswas wrote:

> Hi,
>
> We were using Antlr 2.77, but are migrating to Antlr 3.0. We had  
> three sections for lexer, parser and tree-walker but have merged  
> all that now. I am getting the exception "line 1:0 mismatched input  
> 'find' expecting 'find'" when executing debugging via ANTLRWorks  
> 1.1.3. The same grammar when run with a test program just chokes up  
> and doesn't finish.
>
> My grammar file is attached. The input I used is : "find{$name}".
>
> The exception I got in ANTLRWorks 1.1.3 is pasted below:
> ---------------------------------------------------------------------- 
> ---
> recoverFromMismatchedToken
> BR.recoverFromMismatchedToken
> line 1:0 mismatched input 'find' expecting 'find'
> Exception in thread "main"  
> org.antlr.runtime.tree.RewriteEmptyStreamException: rule searchSpec
>         at org.antlr.runtime.tree.RewriteRuleElementStream._next 
> (RewriteRuleElementStream.java:158)
>         at org.antlr.runtime.tree.RewriteRuleElementStream.next 
> (RewriteRuleElementStream.java:145)
>         at testParser.sosl(testParser.java:183)
>         at __Test__.main(__Test__.java:14)
> ---------------------------------------------------------------------- 
> ---
>
> I am stumped where it says "mismatched input 'find' expecting  
> 'find'". How can it not match find with find?
>
> Any help would be appreciated.
>
> Regards,
> Sumanto
>
>
>
> <test.g>



More information about the antlr-interest mailing list