[antlr-interest] c++ libantlr: panic()

Ric Klaren klaren at cs.utwente.nl
Fri Mar 21 04:53:38 PST 2003


Hi,

On Thu, Mar 20, 2003 at 10:02:39AM +1100, Ross Bencina wrote:
> There may be an issue with panic() though:
...
> So panic() is currently declared as static in two of three base classes. One
> of these says "can be overridden in subclass" which is not possible for a
> non-virtual function.
>
> May I suggest that panic be changed to a virtual function as follows in all
> three classes?
..
> When exactly does panic() get called? It doesn't seem to be mentioned in the
> parsers and lexers that I've generated. I assume that if panic() is called,
> it's safe to throw an exception to escape from the parser, and delete the
> parser, rather than being forced to exit() - which is often undesirable.

I think panic is carry over from the Java version, in the java version it
is used inside makeToken of the CharScanner (in case instantiation fails).
In C++ mode it is never called from the support code nor from the generated
code. Basically I could remove them. For now I'll implement your
suggestion. Thanks for noting this.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     "Evil will always triumph, because Good is dumb." ---  Spaceballs


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list