* data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and

yacc.c: be sure to stay within yycheck_.
* tests/actions.at: Re-enable C++ tests.
This commit is contained in:
Akim Demaille
2004-12-16 14:39:42 +00:00
parent 10454ea42f
commit fd19f2714f
3 changed files with 30 additions and 20 deletions

View File

@@ -1,3 +1,9 @@
2004-12-16 Akim Demaille <akim@epita.fr>
* data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and
yacc.c: be sure to stay within yycheck_.
* tests/actions.at: Re-enable C++ tests.
2004-12-16 Akim Demaille <akim@epita.fr> 2004-12-16 Akim Demaille <akim@epita.fr>
* src/print_graph.c (print_graph): Remove layoutalgorithm uses for * src/print_graph.c (print_graph): Remove layoutalgorithm uses for

View File

@@ -810,24 +810,30 @@ yy::]b4_parser_class_name[::yyreport_syntax_error_ ()
yyn_ = yypact_[yystate_]; yyn_ = yypact_[yystate_];
if (yypact_ninf_ < yyn_ && yyn_ < yylast_) if (yypact_ninf_ < yyn_ && yyn_ < yylast_)
{ {
/* Start YYX at -YYN if negative to avoid negative indexes in
YYCHECK. */
int yyxbegin = yyn_ < 0 ? -yyn_ : 0;
/* Stay within bounds of both yycheck and yytname. */
int yychecklim = yylast_ - yyn_;
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
int count = 0;
for (int x = yyxbegin; x < yyxend; ++x)
if (yycheck_[x + yyn_] == x && x != yyterror_)
++count;
message = "syntax error, unexpected "; message = "syntax error, unexpected ";
message += yyname_[yyilooka_]; message += yyname_[yyilooka_];
{ if (count < 5)
int count = 0; {
for (int x = (yyn_ < 0 ? -yyn_ : 0); x < yyntokens_ + yynnts_; ++x) count = 0;
if (yycheck_[x + yyn_] == x && x != yyterror_) for (int x = yyxbegin; x < yyxend; ++x)
++count; if (yycheck_[x + yyn_] == x && x != yyterror_)
if (count < 5) {
{ message += (!count++) ? ", expecting " : " or ";
count = 0; message += yyname_[x];
for (int x = (yyn_ < 0 ? -yyn_ : 0); x < yyntokens_ + yynnts_; ++x) }
if (yycheck_[x + yyn_] == x && x != yyterror_) }
{
message += (!count++) ? ", expecting " : " or ";
message += yyname_[x];
}
}
}
} }
else else
#endif #endif

View File

@@ -468,10 +468,8 @@ AT_CHECK_PRINTER_AND_DESTRUCTOR([], [with union])
# These tests currently fail on a Debian GNU/Linux 3.0r2 x86 host, # These tests currently fail on a Debian GNU/Linux 3.0r2 x86 host,
# but the 2nd test succeeds on a Solaris 9 sparc hosts (Forte 7 cc). # but the 2nd test succeeds on a Solaris 9 sparc hosts (Forte 7 cc).
# Skip them until we figure out what the problem is. # Skip them until we figure out what the problem is.
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], , AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"])
[AT_CHECK([exit 77])]) AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union])
AT_CHECK_PRINTER_AND_DESTRUCTOR([%defines %skeleton "lalr1.cc"], [with union],
[AT_CHECK([exit 77])])
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser]) AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser])
AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union]) AT_CHECK_PRINTER_AND_DESTRUCTOR([%glr-parser], [with union])