[antlr-interest] [C target][HEELP :-] About disable recovery ... Override recoverFromMismatchedToken() ... Linker error

Jim Idle jimi at temporal-wave.com
Fri Oct 21 09:48:29 PDT 2011


In the baserecognizer code, the functions are called directly, but they
are all available indirectly via the pointer interface. I think you are
not fundamentally understanding this. So, they are all static to their
source code files and do not pollute the namespace, and when they are not
being called internally, you call them via their pointers in the
interface.

Do you see this in the antlr3BaseRecognizerNew():

recognizer->match                       = match;
    recognizer->matchAny                    = matchAny;
    recognizer->memoize                     = memoize;
    recognizer->mismatch                    = mismatch;
    recognizer->mismatchIsUnwantedToken     = mismatchIsUnwantedToken;
    recognizer->mismatchIsMissingToken      = mismatchIsMissingToken;
    recognizer->recover                     = recover;
    recognizer->recoverFromMismatchedElement=
recoverFromMismatchedElement;
    recognizer->recoverFromMismatchedSet    = recoverFromMismatchedSet;
    recognizer->recoverFromMismatchedToken  = recoverFromMismatchedToken;

etc


So, install your own versions of whatever you like, then in your external
version, call the methods via the pointers in the interface. Easy. This is
true of ALL the interfaces, so that you can override any method you like.
Now, perhaps I should have called the error recovery methods indirectly in
the library itself, but they are all bound together and it is a trivial
matter for you to call mismatch indirectly instead of directly in your
code.

Jim



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Ruslan Zasukhin
> Sent: Thursday, October 20, 2011 2:55 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] [C target][HEELP :-] About disable
> recovery ... Override recoverFromMismatchedToken() ... Linker error
>
> On 10/21/11 12:41 AM, "Ruslan Zasukhin" <ruslan_zasukhin at valentina-
> db.com>
> wrote:
>
> >> You need to copy the mismatch locally or call it via a pointer (if
> it
> >> is in the interface, but I think it is not).
>
> Jim,
>
> This not works, because mismatch() calls other static hidden functions.
> Oops ... E.g.
>
>
> error: 'mismatchIsUnwantedToken' was not declared in this scope
>
>
> Something is not good here
>
> Anybody really was able do this for C Target?  :-)
>
>
>
> --
> Best regards,
>
> Ruslan Zasukhin
> VP Engineering and New Technology
> Paradigma Software, Inc
>
> Valentina - Joining Worlds of Information http://www.paradigmasoft.com
>
> [I feel the need: the need for speed]
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list