[antlr-interest] How to feedback to users the string expected on MismatchedTokenException

John B. Brodie jbb at acm.org
Tue Jun 12 12:07:10 PDT 2007


>In the java runtime, when the antlr 3.0 encounter a mismatched token
>parser error it issue a message like:
>
>	"line 1:7 mismatched input 'update' expecting SELECT"
>
>What this basically means is that parser got an 'update' string while
>expecting the SELECT token. 
>
>The problem is that SELECT token is defined as:
>...snipped...
>And that I should prefer to respond to such erroneous input with the
>string that is expected ('select') and not with the token type (SELECT).
>...snipped...

Does the tokenNames array published by the generated parser help you
to build your own error reporting method to solve this?



More information about the antlr-interest mailing list