mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
yacc.c: make sure we properly propagated the user's number for error
* data/skeletons/yacc.c (YYERRCODE): Be truthful. * tests/input.at (Redefining the error token): Check that.
This commit is contained in:
9
TODO
9
TODO
@@ -315,13 +315,8 @@ It would be a very nice source of inspiration for the other languages.
|
|||||||
Valentin Tolmer is working on this.
|
Valentin Tolmer is working on this.
|
||||||
|
|
||||||
** YYERRCODE
|
** YYERRCODE
|
||||||
Defined to 256, but not used, not documented. Probably the token
|
Why don't we output the token name of the error token in the output? It is
|
||||||
number for the error token, which POSIX wants to be 256, but which
|
explicitly skipped:
|
||||||
Bison might renumber if the user used number 256. Keep fix and doc?
|
|
||||||
Throw away?
|
|
||||||
|
|
||||||
Also, why don't we output the token name of the error token in the
|
|
||||||
output? It is explicitly skipped:
|
|
||||||
|
|
||||||
/* Skip error token and tokens without identifier. */
|
/* Skip error token and tokens without identifier. */
|
||||||
if (sym != errtoken && id)
|
if (sym != errtoken && id)
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
|
|
||||||
/* Error token number */
|
/* Error token number */
|
||||||
#define YYTERROR 1
|
#define YYTERROR 1
|
||||||
#define YYERRCODE 256
|
#define YYERRCODE ]b4_symbol(1, user_number)[
|
||||||
|
|
||||||
]b4_locations_if([[
|
]b4_locations_if([[
|
||||||
]b4_yylloc_default_define[
|
]b4_yylloc_default_define[
|
||||||
|
|||||||
@@ -326,6 +326,21 @@ input.y:2.14-16: error: redefining user token number of error
|
|||||||
| ^~~
|
| ^~~
|
||||||
]])
|
]])
|
||||||
|
|
||||||
|
# While at it, make sure we properly used the user's number for
|
||||||
|
# "error".
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[%token error 123
|
||||||
|
%%
|
||||||
|
exp:
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_BISON_CHECK([input.y])
|
||||||
|
|
||||||
|
AT_CHECK([$EGREP -E '123|256' input.tab.c], [],
|
||||||
|
[[ 0, 123, 257
|
||||||
|
#define YYERRCODE 123
|
||||||
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user