help-bison
[Top][All Lists]
Advanced

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

Re: Redefining the literal string associated to the YYerror symbol


From: Akim Demaille
Subject: Re: Redefining the literal string associated to the YYerror symbol
Date: Thu, 18 Jun 2020 08:44:21 +0200

Daniele,

> Le 18 juin 2020 à 07:57, Daniele Nicolodi <daniele@grinta.net> a écrit :
> 
> Hello,
> 
> in Bison 3.6 is it possible to redefine the literal string associated to
> the YYerror symbol (and to the YYEOF, YYUNDEF ones, although I don't
> have immediate need for this)?

YYerror is exactly the error token, the one in

exp: '(' error ')'

> Doing it in the naive way:
> 
> %token YYerror "ERROR"
> 
> results in a warning:
> 
> warning: symbol YYerror given more than one literal string [-Wother]
>  180 | %token YYerror "ERROR"
>      |                ^~~~~~~
> 
> and in the literal string not being updated.

There is no way to rename it, and it wouldn't make sense as the error
token is never presented as an "expected token".  The error token never
shows to the (end) user.  It appears in the debug traces, but that's
for the developer.

Cheers!


reply via email to

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