[antlr-interest] [C Target] @parser::apifuncs ...

Jim Idle jimi at temporal-wave.com
Mon Aug 18 14:42:04 PDT 2008


On Mon, 2008-08-18 at 17:28 -0400, Garry Iglesias wrote:
> Hi again :),
>  
> Sorry to bother you, but I also just realize that if you do :
>  
> @parser::members
> {
>  static void MY_displayError(pANTLR3_BASE_RECOGNIZER _pRec, pANTLR3_UINT8* _tokenNames) {
>   //do something...
>  }
> }
> @parser::apifuncs
> {
>  // Install custom error message display:
>  RECOGNIZER->displayRecognitionError = MY_displayError;
> }
>  
> the generated c parser doesn't compile because the 'members' code is
> inserted after the parser constructor... So the compiler doesn't know
> the function yet...

Please read the API docs on these sections. Like any other C function,
you need to protoype it before using it and not rely on code order. It
is also a much better idea to keep your functions outside the grammar,
as recommended in the documentation. 

I will try to reinstate the documentation for these sections tonight.

Jim
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080818/30166cbd/attachment.html 


More information about the antlr-interest mailing list