help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Debugging Bison Under Windows


From: Bob Smith
Subject: Re: Debugging Bison Under Windows
Date: Thu, 26 Oct 2006 11:58:20 -0400
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

I must be missing something. I am already using yyerror () to capture error messages ("syntax error", "memory exhausted", etc.), but I want to capture debugging output as well. That output is, by default, sent directly to stderr by the YYFPRINTF #define.

Also, I see no reference to a global yytext in the C output file (perhaps you meant ctxt?).

Sorry, but I don't see how yyerror can be used to accomplish this.

On 10/26/2006 2:50 AM, Ramaswamy R wrote:
You should be able to use the function yyerror to capture the debug
messages. The function prototype would be like this in a re-entrant parser -


int yyerror(void *ctxt, const char *msg)
{
 if ( 0 == yytext[0] )
   return fprintf(stderr, "\n%s.", msg);
 else
   return fprintf(stderr, "\n%s at '%s'.", msg, asntext);
}

I believe the ctxt would not be there in a non re-entrant version (globals
being used if context information is required). You can use this function to
do what you want with the message. Hope this helps.

Regards
Ramaswamy

--
_______________________________________________________________
Bob Smith - address@hidden - http://www.sudleyplace.com

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]