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: Hans Åberg
Subject: Re: Is there an option to change the message produced by YYERROR_VERBOSE?
Date: Wed, 27 Apr 2016 23:53:42 +0200

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