mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Some actions of web2c.y are improperly triggered.
Reported by Mike Castle. * src/lalr.c (traverse): s/F (i)[k] = F (j)[k]/F (j)[k] = F (i)[k]/. * tests/regression.at (Web2c): Rename as... (Web2c Report): this. (Web2c Actions): New.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
2001-12-22 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Some actions of web2c.y are improperly triggered.
|
||||
Reported by Mike Castle.
|
||||
|
||||
* src/lalr.c (traverse): s/F (i)[k] = F (j)[k]/F (j)[k] = F (i)[k]/.
|
||||
* tests/regression.at (Web2c): Rename as...
|
||||
(Web2c Report): this.
|
||||
(Web2c Actions): New.
|
||||
|
||||
2001-12-22 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Reductions in web2c.y are improperly reported.
|
||||
|
||||
@@ -103,7 +103,7 @@ traverse (int i)
|
||||
break;
|
||||
|
||||
for (k = 0; k < size; ++k)
|
||||
F (i)[k] = F (j)[k];
|
||||
F (j)[k] = F (i)[k];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -608,16 +608,16 @@ AT_TEST_CPP_GUARD_H([9foo])
|
||||
|
||||
|
||||
|
||||
## ------- ##
|
||||
## Web2c. ##
|
||||
## ------- ##
|
||||
## -------------- ##
|
||||
## Web2c Report. ##
|
||||
## -------------- ##
|
||||
|
||||
# The generation of the reduction was once wrong in Bison, and made it
|
||||
# miss some reductions. In the following test case, the reduction on
|
||||
# `undef_id_tok' in state 1 was missing. This is stripped down from
|
||||
# the actual web2c.y.
|
||||
|
||||
AT_SETUP([Web2c])
|
||||
AT_SETUP([Web2c Report])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%token undef_id_tok const_id_tok
|
||||
@@ -708,3 +708,132 @@ state 10
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## --------------- ##
|
||||
## Web2c Actions. ##
|
||||
## --------------- ##
|
||||
|
||||
# The generation of the mapping `state -> action' was once wrong in
|
||||
# extremely specific situations. web2c.y exhibits this situation.
|
||||
# Below is a stripped version of the grammar. It looks like one can
|
||||
# simplify it further, but just don't: it is tuned to exhibit a bug,
|
||||
# which disapears when applying sane grammar transformations.
|
||||
#
|
||||
# It used to be wrong on yydefact only:
|
||||
#
|
||||
# static const short yydefact[] =
|
||||
# {
|
||||
# - 2, 0, 1, 0, 0, 2, 3, 2, 5, 4,
|
||||
# + 2, 0, 1, 0, 0, 0, 3, 2, 5, 4,
|
||||
# 0, 0
|
||||
# };
|
||||
#
|
||||
# but let's check all the tables.
|
||||
|
||||
|
||||
AT_SETUP([Web2c Actions])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%%
|
||||
statement: struct_stat;
|
||||
struct_stat: /* empty. */ | if else;
|
||||
if: "if" "const" "then" statement;
|
||||
else: "else" statement;
|
||||
%%
|
||||
]])
|
||||
|
||||
AT_CHECK([bison -v input.y -o input.c])
|
||||
|
||||
# Check only the tables. We don't use --no-parser, because it is
|
||||
# still to be implemented in the experimental branch of Bison.
|
||||
AT_CHECK([[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c]], 0,
|
||||
[[static const char yytranslate[] =
|
||||
{
|
||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
|
||||
6
|
||||
};
|
||||
static const short yyprhs[] =
|
||||
{
|
||||
0, 0, 2, 3, 6, 11
|
||||
};
|
||||
static const short yyrhs[] =
|
||||
{
|
||||
8, 0, 0, 9, 10, 0, 3, 4, 5, 7,
|
||||
0, 6, 7, 0
|
||||
};
|
||||
static const short yyrline[] =
|
||||
{
|
||||
0, 2, 3, 3, 4, 5
|
||||
};
|
||||
static const char *const yytname[] =
|
||||
{
|
||||
"$", "error", "$undefined.", "\"if\"", "\"const\"", "\"then\"",
|
||||
"\"else\"", "statement", "struct_stat", "if", "else", NULL
|
||||
};
|
||||
static const short yytoknum[] =
|
||||
{
|
||||
0, 256, 2, 257, 258, 259, 260, -1
|
||||
};
|
||||
static const short yyr1[] =
|
||||
{
|
||||
0, 7, 8, 8, 9, 10
|
||||
};
|
||||
static const short yyr2[] =
|
||||
{
|
||||
0, 1, 0, 2, 4, 2
|
||||
};
|
||||
static const short yydefact[] =
|
||||
{
|
||||
2, 0, 1, 0, 0, 2, 3, 2, 5, 4,
|
||||
0, 0
|
||||
};
|
||||
static const short yydefgoto[] =
|
||||
{
|
||||
8, 2, 3, 6
|
||||
};
|
||||
static const short yypact[] =
|
||||
{
|
||||
-2, -1,-32768, -4, 1, -2,-32768, -2,-32768,-32768,
|
||||
4,-32768
|
||||
};
|
||||
static const short yypgoto[] =
|
||||
{
|
||||
0,-32768,-32768,-32768
|
||||
};
|
||||
static const short yytable[] =
|
||||
{
|
||||
10, 1, 5, 4, 11, 0, 7, 9
|
||||
};
|
||||
static const short yycheck[] =
|
||||
{
|
||||
0, 3, 6, 4, 0, -1, 5, 7
|
||||
};
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user