* data/bison.c++: Catch up with bison.simple:

2002-05-24  Paul Hilfinger  <Hilfinger@CS.Berkeley.EDU>
and Paul Eggert  <eggert@twinsun.com>: `error' handing.
2002-05-26  Akim Demaille  <akim@epita.fr>: stos_, token_number_,
and popping traces.
This commit is contained in:
Akim Demaille
2002-05-28 09:53:35 +00:00
parent 7067cb3620
commit 769b430fce
3 changed files with 85 additions and 41 deletions

View File

@@ -1,13 +1,21 @@
2002-05-28 Akim Demaille <akim@epita.fr>
* data/bison.c++: Catch up with bison.simple:
2002-05-24 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
and Paul Eggert <eggert@twinsun.com>: `error' handing.
2002-05-26 Akim Demaille <akim@epita.fr>: stos_, token_number_,
and popping traces.
2002-05-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU> 2002-05-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* src/output.c (output_skeleton): Put an explicit path in front of * src/output.c (output_skeleton): Put an explicit path in front of
the skeleton file name, rather than relying on the -I directory, the skeleton file name, rather than relying on the -I directory,
to partially alleviate effects of having a skeleton file lying around to partially alleviate effects of having a skeleton file lying around
in the current directory. in the current directory.
2002-05-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU> 2002-05-27 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
* src/conflicts.c (log_resolution): Correct typo: * src/conflicts.c (log_resolution): Correct typo:
obstack_printf should be obstack_fgrow1. obstack_printf should be obstack_fgrow1.
2002-05-26 Akim Demaille <akim@epita.fr> 2002-05-26 Akim Demaille <akim@epita.fr>
@@ -75,7 +83,7 @@
2002-05-24 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU> 2002-05-24 Paul Hilfinger <Hilfinger@CS.Berkeley.EDU>
and Paul Eggert <eggert@twinsun.com> and Paul Eggert <eggert@twinsun.com>
* data/bison.simple (yyparse): Correct error handling to conform to * data/bison.simple (yyparse): Correct error handling to conform to
POSIX and yacc. Specifically, after syntax error is discovered, POSIX and yacc. Specifically, after syntax error is discovered,
do not reduce further before shifting the error token. do not reduce further before shifting the error token.
@@ -88,15 +96,15 @@
* data/bison.simple (yyr1): Don't use yy_token_number_type as element * data/bison.simple (yyr1): Don't use yy_token_number_type as element
type; it isn't always big enough, since it doesn't necessarily type; it isn't always big enough, since it doesn't necessarily
include non-terminals. include non-terminals.
(yytranslate): Expand definition of yy_token_number_type, so that (yytranslate): Expand definition of yy_token_number_type, so that
the latter can be removed. the latter can be removed.
(yy_token_number_type): Remove, only one use. (yy_token_number_type): Remove, only one use.
* data/bison.c++ (r1_): Parallel change to yyr1 in bison.simple--- * data/bison.c++ (r1_): Parallel change to yyr1 in bison.simple---
don't use TokenNumberType as element type. don't use TokenNumberType as element type.
* tests/regression.at: Modify expected output to agree with change * tests/regression.at: Modify expected output to agree with change
to yyr1 and yytranslate. to yyr1 and yytranslate.
2002-05-13 Florian Krohm <florian@edamail.fishkill.ibm.com> 2002-05-13 Florian Krohm <florian@edamail.fishkill.ibm.com>
* src/reader.c (parse_action): Use copy_character instead of * src/reader.c (parse_action): Use copy_character instead of

View File

@@ -272,6 +272,8 @@ namespace yy
static const RhsNumberType rhs_[[]]; static const RhsNumberType rhs_[[]];
static const b4_uint_type(b4_prhs_max) prhs_[[]]; static const b4_uint_type(b4_prhs_max) prhs_[[]];
static const b4_uint_type(b4_rline_max) rline_[[]]; static const b4_uint_type(b4_rline_max) rline_[[]];
static const b4_uint_type(b4_stos_max) stos_[[]];
static const short token_number_[[]];
#endif #endif
/* Even more tables. */ /* Even more tables. */
@@ -567,47 +569,62 @@ yy::b4_name::parse ()
token. */ token. */
errstatus = 3; errstatus = 3;
goto yyerrhandle;
/* Pop the current state because it cannot handle the error token. */ for (;;)
yyerrdefault: {
yyerrpop: n_ = pact_[[state_]];
if (!state_stack_.height ()) if (n_ != flag_)
goto yyabortlab; {
state_ = (state_stack_.pop (), state_stack_[[0]]); n_ += terror_;
semantic_stack_.pop (); if (0 <= n_ && n_ <= last_ && check_[[n_]] == terror_)
location_stack_.pop ();; {
n_ = table_[[n_]];
if (0 < n_)
break;
}
}
/* Pop the current state because it cannot handle the error token. */
if (!state_stack_.height ())
goto yyabortlab;
#if YYDEBUG #if YYDEBUG
if (debug_) if (debug_)
{ {
YYFPRINTF (stderr, "Error: state stack now"); if (stos_[[state_]] < ntokens_)
for (StateStack::ConstIterator i = state_stack_.begin (); {
i != state_stack_.end (); ++i) YYFPRINTF (stderr, "Error: popping token %d (%s",
YYFPRINTF (stderr, " %d", *i); token_number_[[stos_[state_]]],
YYFPRINTF (stderr, "\n"); name_[[stos_[state_]]]);
} # ifdef YYPRINT
YYPRINT (stderr, token_number_[[stos_[state_]]],
semantic_stack_.top ());
# endif
YYFPRINTF (stderr, ")\n");
}
else
{
YYFPRINTF (stderr, "Error: popping nonterminal (%s)\n",
name_[[stos_[state_]]]);
}
}
#endif #endif
yyerrhandle: state_ = (state_stack_.pop (), state_stack_[[0]]);
n_ = pact_[[state_]]; semantic_stack_.pop ();
if (n_ == flag_) location_stack_.pop ();;
goto yyerrdefault;
n_ += terror_; #if YYDEBUG
if (n_ < 0 || n_ > last_ || check_[[n_]] != terror_) if (debug_)
goto yyerrdefault; {
YYFPRINTF (stderr, "Error: state stack now");
n_ = table_[[n_]]; for (StateStack::ConstIterator i = state_stack_.begin ();
if (n_ < 0) i != state_stack_.end (); ++i)
{ YYFPRINTF (stderr, " %d", *i);
if (n_ == flag_) YYFPRINTF (stderr, "\n");
goto yyerrpop; }
n_ = -n_; #endif
goto yyreduce;
} }
else if (!n_)
goto yyerrpop;
if (n_ == final_) if (n_ == final_)
goto yyacceptlab; goto yyacceptlab;
@@ -686,6 +703,24 @@ yy::b4_name::check_[[]] =
b4_check b4_check
}; };
#if YYDEBUG
/* STOS_[[STATE-NUM]] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
const b4_uint_type(b4_stos_max)
yy::b4_name::stos_[[]] =
{
b4_stos
};
/* TOKEN_NUMBER_[[YYLEX-NUM]] -- Internal token number corresponding
to YYLEX-NUM. */
const short
yy::b4_name::token_number_[[]] =
{
b4_toknum
};
#endif
/* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */ /* YYR1[[YYN]] -- Symbol number of symbol that rule YYN derives. */
const b4_uint_type(b4_r1_max) const b4_uint_type(b4_r1_max)
yy::b4_name::r1_[[]] = yy::b4_name::r1_[[]] =

View File

@@ -371,7 +371,8 @@ static const char *const yytname[[]] =
}; };
#endif #endif
/* YYTOKNUM[[YYN]] -- Index in YYTNAME corresponding to YYLEX. */ /* YYTOKNUM[[YYLEX-NUM]] -- Internal token number corresponding to
token YYLEX-NUM. */
static const short yytoknum[[]] = static const short yytoknum[[]] =
{ {
b4_toknum b4_toknum