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

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Sat Oct 22 00:29:59 PDT 2011


On 10/21/11 7:48 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:

Aha, 

So I was stupid enough (shame on me :-) to not see that I can do things as

void* recoverFromMismatchedToken_off(
    pANTLR3_BASE_RECOGNIZER recognizer,
    ANTLR3_UINT32 ttype,
    pANTLR3_BITSET_LIST follow)
{
    recognizer->mismatch( recognizer, ttype, follow );
    ^^^^^^^^^^^^ magic :) 

   return NULL;
}


Thank you for point, Jim.  I will try this way,
but as I have pointed query

    DRO TABLE T1;

Even do not call recoverFromMismatchedToken handler,
Because here no viable alternative happens  ...
So I was need override recover()

> 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.

Of course I have read sources and even debug them, and have see that
pointers, because I already did override error builder func ...

Just, try please understand, that reading sources is not best way to catch
HOW TO USE library.

I think if even me - C++ developer 20 years, have not to see that way of
call indirectly your internal methods ...it will be not easy for other
developers also ...

Because this is quite unusual for LIBRARIES ... You use very smart
techniques in ANTLR/C, this is cool ... But they are not so obvious for
others as you may think :)

Will be very helpful to have such
    C/Examples/DisableRevocer

Thank you for patience :)
 
> 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.


-- 
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]




More information about the antlr-interest mailing list