[antlr-interest] case sensitivity for ANTLR v3 lexers

Don Caton dcaton at shorelinesoftware.com
Tue May 16 17:39:42 PDT 2006


Ter:

> > I understand that you're using ST to generate code in 3.0, 
> but how is 
> > that relevant at runtime?  Will ST be required at runtime as well?
> 
> Oh, sorry...i meant ANTLR v3 errors not parse errors.  Just 
> override reportError(Exception e) and you're groovy!

That doesn't work, at least not in 2.x.  By the time reportError() is
called, the exception object (and its textual message) have already been
created, using strings that are hard-coded in the various exception classes.

Take a look at MismatchedCharExpression:getMessage(), for example.  Even if
I subclassed this object, there's no way to get the generated code to use
it.  The only way to fix this is to modify the code every time a new version
is released.

> > All I'm really looking for is an overridable "getErrorString()"  
> > method, or
> > something like that, so I can supply an appropriate error message 
> > depending on the end user's locale.  The default 
> implementation could 
> > use the English messages, please just allow some clean way of 
> > overriding them at runtime.
> 
> You have, sir!  See the runtime stuff...doesn't use ST at all.

I thought the C++ runtime stuff wasn't written yet?  Or am I not looking in
the right place?

Don




More information about the antlr-interest mailing list