> On 27 Apr 2016, at 23:15, Simon Sobisch <simonsobi...@gnu.org> 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.



_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to