mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 10:43:02 +00:00
Fix %error-verbose for conflicts resolved by %nonassoc.
* NEWS (2.5): Document. * data/glr.c (yyreportSyntaxError): Fix this by checking yyis_table_ninf. * data/yacc.c (yysyntax_error): Likewise. * data/lalr1.cc (yysyntax_error_): Fix this by checking yytable_ninf_. * data/lalr1.java (yysyntax_error): Likewise. * tests/conflicts.at (%nonassoc and eof): Update expected output and remove FIXME.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
|
Fix %error-verbose for conflicts resolved by %nonassoc.
|
||||||
|
* NEWS (2.5): Document.
|
||||||
|
* data/glr.c (yyreportSyntaxError): Fix this by checking
|
||||||
|
yyis_table_ninf.
|
||||||
|
* data/yacc.c (yysyntax_error): Likewise.
|
||||||
|
* data/lalr1.cc (yysyntax_error_): Fix this by checking
|
||||||
|
yytable_ninf_.
|
||||||
|
* data/lalr1.java (yysyntax_error): Likewise.
|
||||||
|
* tests/conflicts.at (%nonassoc and eof): Update expected output
|
||||||
|
and remove FIXME.
|
||||||
|
|
||||||
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
Some code and documentation improvements.
|
Some code and documentation improvements.
|
||||||
|
|||||||
9
NEWS
9
NEWS
@@ -146,6 +146,15 @@ Bison News
|
|||||||
Bison now warns when a character literal is not of length one. In
|
Bison now warns when a character literal is not of length one. In
|
||||||
some future release, Bison will report an error instead.
|
some future release, Bison will report an error instead.
|
||||||
|
|
||||||
|
** Verbose error messages fixed for nonassociative tokens.
|
||||||
|
|
||||||
|
When %error-verbose is specified, syntax error messages produced by
|
||||||
|
the generated parser include the unexpected token as well as a list of
|
||||||
|
expected tokens. Previously, this list erroneously included tokens
|
||||||
|
that would actually induce a syntax error because conflicts for them
|
||||||
|
were resolved with %nonassoc. Such tokens are now properly omitted
|
||||||
|
from the list.
|
||||||
|
|
||||||
* Changes in version 2.4.2 (????-??-??):
|
* Changes in version 2.4.2 (????-??-??):
|
||||||
|
|
||||||
** Detection of GNU M4 1.4.6 or newer during configure is improved.
|
** Detection of GNU M4 1.4.6 or newer during configure is improved.
|
||||||
|
|||||||
@@ -2060,7 +2060,8 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
yyarg[yycount++] = yytokenName (yytoken);
|
yyarg[yycount++] = yytokenName (yytoken);
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
|
&& !yyis_table_ninf (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -971,7 +971,8 @@ b4_error_verbose_if([state_type yystate, int yytoken],
|
|||||||
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
|
||||||
yyarg[yycount++] = yytname_[yytoken];
|
yyarg[yycount++] = yytname_[yytoken];
|
||||||
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (int yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_)
|
if (yycheck_[yyx + yyn] == yyx && yyx != yyterror_
|
||||||
|
&& yytable_[yyx + yyn] != yytable_ninf_)
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -744,7 +744,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
int yyxend = yychecklim < yyntokens_ ? yychecklim : yyntokens_;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_)
|
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||||
|
&& yycheck_[x + yyn] != yytable_ninf_)
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
@@ -755,7 +756,8 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
for (int x = yyxbegin; x < yyxend; ++x)
|
for (int x = yyxbegin; x < yyxend; ++x)
|
||||||
if (yycheck_[x + yyn] == x && x != yyterror_)
|
if (yycheck_[x + yyn] == x && x != yyterror_
|
||||||
|
&& yycheck_[x + yyn] != yytable_ninf_)
|
||||||
{
|
{
|
||||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
res.append (yytnamerr_ (yytname_[x]));
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
|
|||||||
@@ -869,7 +869,8 @@ yysyntax_error (char *yyresult, int yystate, int yytoken)
|
|||||||
yyarg[yycount++] = yytname[yytoken];
|
yyarg[yycount++] = yytname[yytoken];
|
||||||
|
|
||||||
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
||||||
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
|
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
|
||||||
|
&& !yyis_table_ninf (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
|
|||||||
652
src/parse-gram.c
652
src/parse-gram.c
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.4.343-83ea. */
|
/* A Bison parser, made by GNU Bison 2.4.386-e6c849. */
|
||||||
|
|
||||||
/* Interface for Bison's Yacc-like parsers in C
|
/* Interface for Bison's Yacc-like parsers in C
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@
|
|||||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
/* Line 1600 of yacc.c */
|
/* Line 1608 of yacc.c */
|
||||||
#line 94 "parse-gram.y"
|
#line 94 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -171,8 +171,8 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
/* Line 1600 of yacc.c */
|
/* Line 1608 of yacc.c */
|
||||||
#line 176 "../master/src/parse-gram.h"
|
#line 176 "src/parse-gram.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
|||||||
@@ -99,20 +99,17 @@ AT_BISON_CHECK([-o input.c input.y])
|
|||||||
AT_COMPILE([input])
|
AT_COMPILE([input])
|
||||||
|
|
||||||
AT_PARSER_CHECK([./input '0<0'])
|
AT_PARSER_CHECK([./input '0<0'])
|
||||||
# FIXME: This is an actual bug, but a new one, in the sense that
|
|
||||||
# no one has ever spotted it! The messages are *wrong*: there should
|
|
||||||
# be nothing there, it should be expected eof.
|
|
||||||
AT_PARSER_CHECK([./input '0<0<0'], [1], [],
|
AT_PARSER_CHECK([./input '0<0<0'], [1], [],
|
||||||
[syntax error, unexpected '<', expecting '<' or '>'
|
[syntax error, unexpected '<'
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_PARSER_CHECK([./input '0>0'])
|
AT_PARSER_CHECK([./input '0>0'])
|
||||||
AT_PARSER_CHECK([./input '0>0>0'], [1], [],
|
AT_PARSER_CHECK([./input '0>0>0'], [1], [],
|
||||||
[syntax error, unexpected '>', expecting '<' or '>'
|
[syntax error, unexpected '>'
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_PARSER_CHECK([./input '0<0>0'], [1], [],
|
AT_PARSER_CHECK([./input '0<0>0'], [1], [],
|
||||||
[syntax error, unexpected '>', expecting '<' or '>'
|
[syntax error, unexpected '>'
|
||||||
])
|
])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|||||||
Reference in New Issue
Block a user