mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
More fixes related to last two patches.
* data/bison.m4 (b4_integral_parser_tables_map): Fix YYTABLE comments: zero indicates syntax error not default action. * data/c.m4 (b4_table_value_equals): Comment that YYID must be defined. * data/glr.c (yyis_pact_ninf): Rename to... (yypact_value_is_default): ... this. (yyisDefaultedState): Update for rename. (yyis_table_ninf): Rename to... (yytable_value_is_error): ... this, and check for value zero besides just YYTABLE_NINF. (yygetLRActions): Check for default value from yypact. It appears that this check is always performed before this function is invoked, and so adding the check here is probably redundant. However, the code may evolve after this subtlety is forgotten. Also, update for rename to yytable_value_is_error. Because that macro now checks for zero, a different but equivalent branch of the if-then-else here is evaluated. (yyreportSyntaxError): Update for rename to yytable_value_is_error. The zero condition was mishandled before. (yyrecoverSyntaxError): Update for renames. No behavioral changes. * data/lalr1.cc, data/lalr1.java (yy_pact_value_is_default_): New function. (yy_table_value_is_error_): New function. (parse): Use new functions where possible. No behavioral changes. (yysyntax_error_, yysyntax_error): Use yy_table_value_is_error_. The zero condition was mishandled before. * data/yacc.c (yyis_pact_ninf): Rename to... (yypact_value_is_default): ... this. (yyis_table_ninf): Rename to... (yytable_value_is_error): ... this, and check for value zero besides just YYTABLE_NINF. (yysyntax_error): Update for rename to yytable_value_is_error. The zero condition was mishandled before. (yyparse): Update for renames. No behavioral changes. * src/tables.h: Improve comments about yypact, yytable, etc. more. Most importantly, say yytable value of zero means syntax error not default action.
This commit is contained in:
44
ChangeLog
44
ChangeLog
@@ -1,3 +1,47 @@
|
|||||||
|
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
|
More fixes related to last two patches.
|
||||||
|
* data/bison.m4 (b4_integral_parser_tables_map): Fix YYTABLE
|
||||||
|
comments: zero indicates syntax error not default action.
|
||||||
|
* data/c.m4 (b4_table_value_equals): Comment that YYID must be
|
||||||
|
defined.
|
||||||
|
* data/glr.c (yyis_pact_ninf): Rename to...
|
||||||
|
(yypact_value_is_default): ... this.
|
||||||
|
(yyisDefaultedState): Update for rename.
|
||||||
|
(yyis_table_ninf): Rename to...
|
||||||
|
(yytable_value_is_error): ... this, and check for value zero
|
||||||
|
besides just YYTABLE_NINF.
|
||||||
|
(yygetLRActions): Check for default value from yypact. It
|
||||||
|
appears that this check is always performed before this function
|
||||||
|
is invoked, and so adding the check here is probably redundant.
|
||||||
|
However, the code may evolve after this subtlety is forgotten.
|
||||||
|
Also, update for rename to yytable_value_is_error. Because that
|
||||||
|
macro now checks for zero, a different but equivalent branch of
|
||||||
|
the if-then-else here is evaluated.
|
||||||
|
(yyreportSyntaxError): Update for rename to
|
||||||
|
yytable_value_is_error. The zero condition was mishandled
|
||||||
|
before.
|
||||||
|
(yyrecoverSyntaxError): Update for renames. No behavioral
|
||||||
|
changes.
|
||||||
|
* data/lalr1.cc, data/lalr1.java (yy_pact_value_is_default_):
|
||||||
|
New function.
|
||||||
|
(yy_table_value_is_error_): New function.
|
||||||
|
(parse): Use new functions where possible. No behavioral
|
||||||
|
changes.
|
||||||
|
(yysyntax_error_, yysyntax_error): Use yy_table_value_is_error_.
|
||||||
|
The zero condition was mishandled before.
|
||||||
|
* data/yacc.c (yyis_pact_ninf): Rename to...
|
||||||
|
(yypact_value_is_default): ... this.
|
||||||
|
(yyis_table_ninf): Rename to...
|
||||||
|
(yytable_value_is_error): ... this, and check for value zero
|
||||||
|
besides just YYTABLE_NINF.
|
||||||
|
(yysyntax_error): Update for rename to yytable_value_is_error.
|
||||||
|
The zero condition was mishandled before.
|
||||||
|
(yyparse): Update for renames. No behavioral changes.
|
||||||
|
* src/tables.h: Improve comments about yypact, yytable, etc.
|
||||||
|
more. Most importantly, say yytable value of zero means syntax
|
||||||
|
error not default action.
|
||||||
|
|
||||||
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
2009-08-25 Joel E. Denny <jdenny@clemson.edu>
|
||||||
|
|
||||||
Fix %error-verbose for conflicts resolved by %nonassoc.
|
Fix %error-verbose for conflicts resolved by %nonassoc.
|
||||||
|
|||||||
@@ -266,8 +266,7 @@ $1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
|
|||||||
$1([table], [b4_table],
|
$1([table], [b4_table],
|
||||||
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
[[YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||||
positive, shift that token. If negative, reduce the rule which
|
positive, shift that token. If negative, reduce the rule which
|
||||||
number is the opposite. If zero, do what YYDEFACT says.
|
number is the opposite. If zero or YYTABLE_NINF, syntax error.]])
|
||||||
If YYTABLE_NINF, syntax error.]])
|
|
||||||
|
|
||||||
$1([check], [b4_check])
|
$1([check], [b4_check])
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,8 @@ m4_define([b4_int_type_for],
|
|||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# Without inducing a comparison warning from the compiler, check if the
|
# Without inducing a comparison warning from the compiler, check if the
|
||||||
# literal value LITERAL equals VALUE from table TABLE, which must have
|
# literal value LITERAL equals VALUE from table TABLE, which must have
|
||||||
# TABLE_min and TABLE_max defined.
|
# TABLE_min and TABLE_max defined. YYID must be defined as an identity
|
||||||
|
# function that suppresses warnings about constant conditions.
|
||||||
m4_define([b4_table_value_equals],
|
m4_define([b4_table_value_equals],
|
||||||
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
[m4_if(m4_eval($3 < m4_indir([b4_]$1[_min])
|
||||||
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
|| m4_indir([b4_]$1[_max]) < $3), [1],
|
||||||
|
|||||||
22
data/glr.c
22
data/glr.c
@@ -953,7 +953,7 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
return yyr1[yyrule];
|
return yyr1[yyrule];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yyis_pact_ninf(yystate) \
|
#define yypact_value_is_default(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
/** True iff LR state STATE has only a default reduction (regardless
|
/** True iff LR state STATE has only a default reduction (regardless
|
||||||
@@ -961,7 +961,7 @@ yylhsNonterm (yyRuleNum yyrule)
|
|||||||
static inline yybool
|
static inline yybool
|
||||||
yyisDefaultedState (yyStateNum yystate)
|
yyisDefaultedState (yyStateNum yystate)
|
||||||
{
|
{
|
||||||
return yyis_pact_ninf (yypact[yystate]);
|
return yypact_value_is_default (yypact[yystate]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The default reduction for STATE, assuming it has one. */
|
/** The default reduction for STATE, assuming it has one. */
|
||||||
@@ -971,8 +971,9 @@ yydefaultAction (yyStateNum yystate)
|
|||||||
return yydefact[yystate];
|
return yydefact[yystate];
|
||||||
}
|
}
|
||||||
|
|
||||||
#define yyis_table_ninf(yytable_value) \
|
#define yytable_value_is_error(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
(]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ \
|
||||||
|
|| ]b4_table_value_equals([[table]], [[yytable_value]], [[0]])[)
|
||||||
|
|
||||||
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
/** Set *YYACTION to the action to take in YYSTATE on seeing YYTOKEN.
|
||||||
* Result R means
|
* Result R means
|
||||||
@@ -987,12 +988,13 @@ yygetLRActions (yyStateNum yystate, int yytoken,
|
|||||||
int* yyaction, const short int** yyconflicts)
|
int* yyaction, const short int** yyconflicts)
|
||||||
{
|
{
|
||||||
int yyindex = yypact[yystate] + yytoken;
|
int yyindex = yypact[yystate] + yytoken;
|
||||||
if (yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
if (yypact_value_is_default (yypact[yystate])
|
||||||
|
|| yyindex < 0 || YYLAST < yyindex || yycheck[yyindex] != yytoken)
|
||||||
{
|
{
|
||||||
*yyaction = -yydefact[yystate];
|
*yyaction = -yydefact[yystate];
|
||||||
*yyconflicts = yyconfl;
|
*yyconflicts = yyconfl;
|
||||||
}
|
}
|
||||||
else if (! yyis_table_ninf (yytable[yyindex]))
|
else if (! yytable_value_is_error (yytable[yyindex]))
|
||||||
{
|
{
|
||||||
*yyaction = yytable[yyindex];
|
*yyaction = yytable[yyindex];
|
||||||
*yyconflicts = yyconfl + yyconflp[yyindex];
|
*yyconflicts = yyconfl + yyconflp[yyindex];
|
||||||
@@ -2061,7 +2063,7 @@ yyreportSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
|
|
||||||
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]))
|
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
@@ -2172,7 +2174,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
||||||
}
|
}
|
||||||
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
yyj = yypact[yystackp->yytops.yystates[0]->yylrState];
|
||||||
if (yyis_pact_ninf (yyj))
|
if (yypact_value_is_default (yyj))
|
||||||
return;
|
return;
|
||||||
yyj += yytoken;
|
yyj += yytoken;
|
||||||
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
if (yyj < 0 || YYLAST < yyj || yycheck[yyj] != yytoken)
|
||||||
@@ -2180,7 +2182,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
if (yydefact[yystackp->yytops.yystates[0]->yylrState] != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (yytable[yyj] != 0 && ! yyis_table_ninf (yytable[yyj]))
|
else if (! yytable_value_is_error (yytable[yyj]))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2201,7 +2203,7 @@ yyrecoverSyntaxError (yyGLRStack* yystackp]b4_user_formals[)
|
|||||||
{
|
{
|
||||||
yyGLRState *yys = yystackp->yytops.yystates[0];
|
yyGLRState *yys = yystackp->yytops.yystates[0];
|
||||||
yyj = yypact[yys->yylrState];
|
yyj = yypact[yys->yylrState];
|
||||||
if (! yyis_pact_ninf (yyj))
|
if (! yypact_value_is_default (yyj))
|
||||||
{
|
{
|
||||||
yyj += YYTERROR;
|
yyj += YYTERROR;
|
||||||
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
if (0 <= yyj && yyj <= YYLAST && yycheck[yyj] == YYTERROR
|
||||||
|
|||||||
@@ -245,6 +245,14 @@ do { \
|
|||||||
/// \param yylhs the nonterminal to push on the stack
|
/// \param yylhs the nonterminal to push on the stack
|
||||||
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
|
state_type yy_lr_goto_state_ (state_type yystate, int yylhs);
|
||||||
|
|
||||||
|
/// Whether the given \c yypact_ value indicates a defaulted state.
|
||||||
|
/// \param yyvalue the value to check
|
||||||
|
static bool yy_pact_value_is_default_ (int yyvalue);
|
||||||
|
|
||||||
|
/// Whether the given \c yytable_ value indicates a syntax error.
|
||||||
|
/// \param yyvalue the value to check
|
||||||
|
static bool yy_table_value_is_error_ (int yyvalue);
|
||||||
|
|
||||||
/// Internal symbol numbers.
|
/// Internal symbol numbers.
|
||||||
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
typedef ]b4_int_type_for([b4_translate])[ token_number_type;
|
||||||
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
static const ]b4_int_type(b4_pact_ninf, b4_pact_ninf)[ yypact_ninf_;
|
||||||
@@ -651,6 +659,18 @@ b4_percent_code_get[]dnl
|
|||||||
return yydefgoto_[yylhs - yyntokens_];
|
return yydefgoto_[yylhs - yyntokens_];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
]b4_parser_class_name[::yy_pact_value_is_default_ (int yyvalue)
|
||||||
|
{
|
||||||
|
return yyvalue == yypact_ninf_;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
]b4_parser_class_name[::yy_table_value_is_error_ (int yyvalue)
|
||||||
|
{
|
||||||
|
return yyvalue == 0 || yyvalue == yytable_ninf_;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
]b4_parser_class_name[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
@@ -709,7 +729,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Try to take a decision without lookahead. */
|
/* Try to take a decision without lookahead. */
|
||||||
yyn = yypact_[yystack_[0].state];
|
yyn = yypact_[yystack_[0].state];
|
||||||
if (yyn == yypact_ninf_)
|
if (yy_pact_value_is_default_ (yyn))
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Read a lookahead token. */
|
/* Read a lookahead token. */
|
||||||
@@ -737,7 +757,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
|
|||||||
yyn = yytable_[yyn];
|
yyn = yytable_[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yyn == 0 || yyn == yytable_ninf_)
|
if (yy_table_value_is_error_ (yyn))
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
@@ -887,7 +907,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystack_[0].state];
|
yyn = yypact_[yystack_[0].state];
|
||||||
if (yyn != yypact_ninf_)
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
@@ -972,7 +992,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
|
|||||||
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_)
|
&& !yy_table_value_is_error_ (yytable_[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
|
|
||||||
/* Take a decision. First try without lookahead. */
|
/* Take a decision. First try without lookahead. */
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (yyn == yypact_ninf_)
|
if (yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
label = YYDEFAULT;
|
label = YYDEFAULT;
|
||||||
break;
|
break;
|
||||||
@@ -572,7 +572,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
/* <= 0 means reduce or error. */
|
/* <= 0 means reduce or error. */
|
||||||
else if ((yyn = yytable_[yyn]) <= 0)
|
else if ((yyn = yytable_[yyn]) <= 0)
|
||||||
{
|
{
|
||||||
if (yyn == 0 || yyn == yytable_ninf_)
|
if (yy_table_value_is_error_ (yyn))
|
||||||
label = YYFAIL;
|
label = YYFAIL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -676,7 +676,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact_[yystate];
|
yyn = yypact_[yystate];
|
||||||
if (yyn != yypact_ninf_)
|
if (!yy_pact_value_is_default_ (yyn))
|
||||||
{
|
{
|
||||||
yyn += yyterror_;
|
yyn += yyterror_;
|
||||||
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
if (0 <= yyn && yyn <= yylast_ && yycheck_[yyn] == yyterror_)
|
||||||
@@ -745,7 +745,7 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
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_)
|
&& !yy_table_value_is_error_ (yycheck_[x + yyn]))
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
// FIXME: This method of building the message is not compatible
|
// FIXME: This method of building the message is not compatible
|
||||||
@@ -757,7 +757,7 @@ 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_)
|
&& !yy_table_value_is_error_ (yycheck_[x + yyn]))
|
||||||
{
|
{
|
||||||
res.append (count++ == 0 ? ", expecting " : " or ");
|
res.append (count++ == 0 ? ", expecting " : " or ");
|
||||||
res.append (yytnamerr_ (yytname_[x]));
|
res.append (yytnamerr_ (yytname_[x]));
|
||||||
@@ -770,6 +770,24 @@ m4_popdef([b4_at_dollar])])dnl
|
|||||||
return "syntax error";
|
return "syntax error";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the given <code>yypact_</code> value indicates a defaulted state.
|
||||||
|
* @@param yyvalue the value to check
|
||||||
|
*/
|
||||||
|
private static boolean yy_pact_value_is_default_ (int yyvalue)
|
||||||
|
{
|
||||||
|
return yyvalue == yypact_ninf_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the given <code>yytable_</code> value indicates a syntax error.
|
||||||
|
* @@param yyvalue the value to check
|
||||||
|
*/
|
||||||
|
private static boolean yy_table_value_is_error_ (int yyvalue)
|
||||||
|
{
|
||||||
|
return yyvalue == 0 || yyvalue == yytable_ninf_;
|
||||||
|
}
|
||||||
|
|
||||||
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
private static final ]b4_int_type_for([b4_pact])[ yypact_ninf_ = ]b4_pact_ninf[;
|
||||||
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
private static final ]b4_int_type_for([b4_table])[ yytable_ninf_ = ]b4_table_ninf[;
|
||||||
|
|
||||||
|
|||||||
15
data/yacc.c
15
data/yacc.c
@@ -525,13 +525,14 @@ static const ]b4_int_type_for([b4_toknum])[ yytoknum[] =
|
|||||||
|
|
||||||
#define YYPACT_NINF ]b4_pact_ninf[
|
#define YYPACT_NINF ]b4_pact_ninf[
|
||||||
|
|
||||||
#define yyis_pact_ninf(yystate) \
|
#define yypact_value_is_default(yystate) \
|
||||||
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
]b4_table_value_equals([[pact]], [[yystate]], [b4_pact_ninf])[
|
||||||
|
|
||||||
#define YYTABLE_NINF ]b4_table_ninf[
|
#define YYTABLE_NINF ]b4_table_ninf[
|
||||||
|
|
||||||
#define yyis_table_ninf(yytable_value) \
|
#define yytable_value_is_error(yytable_value) \
|
||||||
]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[
|
(]b4_table_value_equals([[table]], [[yytable_value]], [b4_table_ninf])[ \
|
||||||
|
|| ]b4_table_value_equals([[table]], [[yytable_value]], [[0]])[)
|
||||||
|
|
||||||
]b4_parser_tables_define[
|
]b4_parser_tables_define[
|
||||||
|
|
||||||
@@ -870,7 +871,7 @@ yysyntax_error (char *yyresult, int yystate, int 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]))
|
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
||||||
{
|
{
|
||||||
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
|
||||||
{
|
{
|
||||||
@@ -1279,7 +1280,7 @@ yybackup:
|
|||||||
|
|
||||||
/* First try to decide what to do without reference to lookahead token. */
|
/* First try to decide what to do without reference to lookahead token. */
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (yyis_pact_ninf (yyn))
|
if (yypact_value_is_default (yyn))
|
||||||
goto yydefault;
|
goto yydefault;
|
||||||
|
|
||||||
/* Not known => get a lookahead token if don't already have one. */
|
/* Not known => get a lookahead token if don't already have one. */
|
||||||
@@ -1329,7 +1330,7 @@ yyread_pushed_token:]])[
|
|||||||
yyn = yytable[yyn];
|
yyn = yytable[yyn];
|
||||||
if (yyn <= 0)
|
if (yyn <= 0)
|
||||||
{
|
{
|
||||||
if (yyn == 0 || yyis_table_ninf (yyn))
|
if (yytable_value_is_error (yyn))
|
||||||
goto yyerrlab;
|
goto yyerrlab;
|
||||||
yyn = -yyn;
|
yyn = -yyn;
|
||||||
goto yyreduce;
|
goto yyreduce;
|
||||||
@@ -1513,7 +1514,7 @@ yyerrlab1:
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
yyn = yypact[yystate];
|
yyn = yypact[yystate];
|
||||||
if (!yyis_pact_ninf (yyn))
|
if (!yypact_value_is_default (yyn))
|
||||||
{
|
{
|
||||||
yyn += YYTERROR;
|
yyn += YYTERROR;
|
||||||
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
|
||||||
|
|||||||
438
src/parse-gram.c
438
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.386-e6c849. */
|
/* A Bison parser, made by GNU Bison 2.4.388-53f03. */
|
||||||
|
|
||||||
/* 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 1608 of yacc.c */
|
/* Line 1609 of yacc.c */
|
||||||
#line 94 "parse-gram.y"
|
#line 94 "parse-gram.y"
|
||||||
|
|
||||||
symbol *symbol;
|
symbol *symbol;
|
||||||
@@ -171,7 +171,7 @@ typedef union YYSTYPE
|
|||||||
named_ref *named_ref;
|
named_ref *named_ref;
|
||||||
|
|
||||||
|
|
||||||
/* Line 1608 of yacc.c */
|
/* Line 1609 of yacc.c */
|
||||||
#line 176 "src/parse-gram.h"
|
#line 176 "src/parse-gram.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
|
|||||||
56
src/tables.h
56
src/tables.h
@@ -45,6 +45,24 @@
|
|||||||
|
|
||||||
YYSTOS[S] = the symbol number of the symbol that leads to state S.
|
YYSTOS[S] = the symbol number of the symbol that leads to state S.
|
||||||
|
|
||||||
|
YYFINAL = the state number of the termination state.
|
||||||
|
|
||||||
|
YYTABLE = a vector filled with portions for different uses, found
|
||||||
|
via YYPACT and YYPGOTO.
|
||||||
|
|
||||||
|
YYLAST ( = high) the number of the last element of YYTABLE, i.e.,
|
||||||
|
sizeof (YYTABLE) - 1.
|
||||||
|
|
||||||
|
YYCHECK = a vector indexed in parallel with YYTABLE. It indicates,
|
||||||
|
in a roundabout way, the bounds of the portion you are trying to
|
||||||
|
examine.
|
||||||
|
|
||||||
|
Suppose that the portion of YYTABLE starts at index P and the index
|
||||||
|
to be examined within the portion is I. Then if YYCHECK[P+I] != I,
|
||||||
|
I is outside the bounds of what is actually allocated, and the
|
||||||
|
default (from YYDEFACT or YYDEFGOTO) should be used. Otherwise,
|
||||||
|
YYTABLE[P+I] should be used.
|
||||||
|
|
||||||
YYDEFACT[S] = default reduction number in state s. Performed when
|
YYDEFACT[S] = default reduction number in state s. Performed when
|
||||||
YYTABLE doesn't specify something else to do. Zero means the default
|
YYTABLE doesn't specify something else to do. Zero means the default
|
||||||
is an error.
|
is an error.
|
||||||
@@ -58,10 +76,10 @@
|
|||||||
YYTABLE to find out what action to perform.
|
YYTABLE to find out what action to perform.
|
||||||
|
|
||||||
If YYPACT[S] == YYPACT_NINF, if YYPACT[S] + I is outside the bounds
|
If YYPACT[S] == YYPACT_NINF, if YYPACT[S] + I is outside the bounds
|
||||||
of YYTABLE (from 0 to YYLAST), or if YYCHECK indicates that I is
|
of YYTABLE (from 0 to YYLAST), or I is outside the bounds for portion
|
||||||
outside the bounds of the portion for S, then the default action
|
S (that is, YYCHECK[YYPACT[S] + I] != I), then the default action
|
||||||
(from YYDEFACT and YYDEFGOTO) should be used instead of YYTABLE.
|
(that is, YYDEFACT[S]) should be used instead of YYTABLE. Otherwise,
|
||||||
Otherwise, the value YYTABLE[YYPACT[S] + I] should be used even if
|
the value YYTABLE[YYPACT[S] + I] should be used even if
|
||||||
YYPACT[S] < 0.
|
YYPACT[S] < 0.
|
||||||
|
|
||||||
If the value in YYTABLE is positive, we shift the token and go to
|
If the value in YYTABLE is positive, we shift the token and go to
|
||||||
@@ -69,33 +87,19 @@
|
|||||||
|
|
||||||
If the value is negative, it is minus a rule number to reduce by.
|
If the value is negative, it is minus a rule number to reduce by.
|
||||||
|
|
||||||
If the value is zero, the default action from YYDEFACT[S] is used.
|
If the value is zero or YYTABLE_NINF, it's a syntax error.
|
||||||
|
|
||||||
If the value is YYTABLE_NINF, it's a syntax error.
|
|
||||||
|
|
||||||
YYPGOTO[I] = the index in YYTABLE of the portion describing what to
|
YYPGOTO[I] = the index in YYTABLE of the portion describing what to
|
||||||
do after reducing a rule that derives variable I + NTOKENS. This
|
do after reducing a rule that derives variable I + NTOKENS. This
|
||||||
portion is indexed by the parser state number, S, as of before the
|
portion is indexed by the parser state number, S, as of before the
|
||||||
text for this nonterminal was read. The value from YYTABLE is the
|
text for this nonterminal was read.
|
||||||
state to go to if the corresponding value in YYCHECK is S.
|
|
||||||
|
|
||||||
YYTABLE = a vector filled with portions for different uses, found
|
If YYPGOTO[I] + S is outside the bounds of YYTABLE (from 0 to YYLAST)
|
||||||
via YYPACT and YYPGOTO.
|
or if S is outside the bounds of the portion for I (that is,
|
||||||
|
YYCHECK[YYPGOTO[I] + S] != S), then the default state (that is,
|
||||||
YYCHECK = a vector indexed in parallel with YYTABLE. It indicates,
|
YYDEFGOTO[I]) should be used instead of YYTABLE. Otherwise,
|
||||||
in a roundabout way, the bounds of the portion you are trying to
|
YYTABLE[YYPGOTO[I] + S] is the state to go to even if YYPGOTO[I] < 0.
|
||||||
examine.
|
*/
|
||||||
|
|
||||||
Suppose that the portion of YYTABLE starts at index P and the index
|
|
||||||
to be examined within the portion is I. Then if YYCHECK[P+I] != I,
|
|
||||||
I is outside the bounds of what is actually allocated, and the
|
|
||||||
default (from YYDEFACT or YYDEFGOTO) should be used. Otherwise,
|
|
||||||
YYTABLE[P+I] should be used.
|
|
||||||
|
|
||||||
YYFINAL = the state number of the termination state.
|
|
||||||
|
|
||||||
YYLAST ( = high) the number of the last element of YYTABLE, i.e.,
|
|
||||||
sizeof (YYTABLE) - 1. */
|
|
||||||
|
|
||||||
extern int nvectors;
|
extern int nvectors;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user