help-bison
[Top][All Lists]
Advanced

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

Re: Is there an option to change the message produced by YYERROR_VERBOSE


From: Simon Sobisch
Subject: Re: Is there an option to change the message produced by YYERROR_VERBOSE?
Date: Thu, 28 Apr 2016 00:04:46 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

Searching a translatable string likely isn't a good idea...
An own skeleton file (as part of the source tarball) looks like a big
cannon, therefore we may go with tweaking the parser sources via
makefile (the good part: people "normally" get the parser sources via
this makefile and if they don't they only miss a descriptive message).

Simon

Am 27.04.2016 um 23:53 schrieb Hans Åberg:
> 
>> On 27 Apr 2016, at 23:15, Simon Sobisch <address@hidden> wrote:
>>
>> this could work if we pass the current token, using
>>
>>      %parse-param (char * yytext)
>>
>> tehn use a wrapper for the current yyerror function.
>> If we get this specific error we we can do the checks on the passed yytext.
>>
>> The problem here:
>> How do we know that the error message "Unexpected %s" occured? A string
>> compare against all the translated texts (all 5 versions) looks stupid
>> and brake if the message is ever changed.
> 
> The problem with tweaking the parser sources is that when it is recompiled it 
> is lost, and a similar thing may happen if you make your own skeleton file 
> and Bison is updated. Properly it would be a feature request, I think, but 
> development seems not very active right now.
> 
> So it looks best with a search of the yyerror() argument text. If your 
> keywords are not  one of the error message words (“unexpected" etc.), it may 
> suffice to search for them, adding a line when they appear.
> 
> The %parse-param would make the parser pure, by adding the lookup table 
> reference there.
> 
> 
> 
> 



reply via email to

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