mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* data/lalr1.cc: Move the body of the ctor and dtor into the
parser file (instead of the header). Wrap the implementations in a "namespace yy".
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
||||
2005-11-12 Akim <akim@epita.fr>
|
||||
|
||||
* data/lalr1.cc: Move the body of the ctor and dtor into the
|
||||
parser file (instead of the header).
|
||||
Wrap the implementations in a "namespace yy".
|
||||
|
||||
2005-11-12 Akim Demaille <akim@epita.fr>
|
||||
|
||||
Have glr.c include its header file when created.
|
||||
* data/glr.c (b4_shared_declarations): New.
|
||||
Output them verbatim in the parser if !%defines, otherwise
|
||||
output then in the header file, and include it instead.
|
||||
|
||||
2005-11-11 Akim Demaille <akim@epita.fr>
|
||||
|
||||
* data/glr.c: Comment changes.
|
||||
|
||||
108
data/lalr1.cc
108
data/lalr1.cc
@@ -117,15 +117,8 @@ b4_syncline([@oline@], [@ofile@])],
|
||||
};
|
||||
|
||||
/// Build a parser object.
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[) :
|
||||
yydebug_ (false),
|
||||
yycdebug_ (&std::cerr)]b4_parse_param_cons[
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~]b4_parser_class_name[ ()
|
||||
{
|
||||
}
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
@@ -404,13 +397,26 @@ yy::]b4_parser_class_name[::yytnamerr_ (const char *yystr)
|
||||
|
||||
#endif
|
||||
|
||||
namespace yy
|
||||
{
|
||||
/// Build a parser object.
|
||||
]b4_parser_class_name::b4_parser_class_name[ (]b4_parse_param_decl[)
|
||||
: yydebug_ (false),
|
||||
yycdebug_ (&std::cerr)]b4_parse_param_cons[
|
||||
{
|
||||
}
|
||||
|
||||
]b4_parser_class_name::~b4_parser_class_name[ ()
|
||||
{
|
||||
}
|
||||
|
||||
#if YYDEBUG
|
||||
/*--------------------------------.
|
||||
| Print this symbol on YYOUTPUT. |
|
||||
`--------------------------------*/
|
||||
|
||||
void
|
||||
yy::]b4_parser_class_name[::yysymprint_ (int yytype,
|
||||
]b4_parser_class_name[::yysymprint_ (int yytype,
|
||||
const semantic_type* yyvaluep, const location_type* yylocationp)
|
||||
{
|
||||
/* Backward compatibility, but should be removed eventually. */
|
||||
@@ -434,7 +440,7 @@ yy::]b4_parser_class_name[::yysymprint_ (int yytype,
|
||||
#endif /* ! YYDEBUG */
|
||||
|
||||
void
|
||||
yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg,
|
||||
]b4_parser_class_name[::yydestruct_ (const char* yymsg,
|
||||
int yytype, semantic_type* yyvaluep, location_type* yylocationp)
|
||||
{
|
||||
YYUSE (yylocationp);
|
||||
@@ -452,7 +458,7 @@ yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg,
|
||||
}
|
||||
|
||||
void
|
||||
yy::]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||
]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||
{
|
||||
yystate_stack_.pop (n);
|
||||
yysemantic_stack_.pop (n);
|
||||
@@ -460,33 +466,33 @@ yy::]b4_parser_class_name[::yypop_ (unsigned int n)
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
yy::]b4_parser_class_name[::debug_stream () const
|
||||
]b4_parser_class_name[::debug_stream () const
|
||||
{
|
||||
return *yycdebug_;
|
||||
}
|
||||
|
||||
void
|
||||
yy::]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||
]b4_parser_class_name[::set_debug_stream (std::ostream& o)
|
||||
{
|
||||
yycdebug_ = &o;
|
||||
}
|
||||
|
||||
|
||||
yy::]b4_parser_class_name[::debug_level_type
|
||||
yy::]b4_parser_class_name[::debug_level () const
|
||||
]b4_parser_class_name[::debug_level_type
|
||||
]b4_parser_class_name[::debug_level () const
|
||||
{
|
||||
return yydebug_;
|
||||
}
|
||||
|
||||
void
|
||||
yy::]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||
]b4_parser_class_name[::set_debug_level (debug_level_type l)
|
||||
{
|
||||
yydebug_ = l;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
yy::]b4_parser_class_name[::parse ()
|
||||
]b4_parser_class_name[::parse ()
|
||||
{
|
||||
/// Look-ahead and look-ahead in internal form.
|
||||
int yychar = yyempty_;
|
||||
@@ -798,7 +804,7 @@ yyreturn:
|
||||
|
||||
// Generate an error message.
|
||||
std::string
|
||||
yy::]b4_parser_class_name[::yysyntax_error_ (int yystate]dnl
|
||||
]b4_parser_class_name[::yysyntax_error_ (int yystate]dnl
|
||||
b4_error_verbose_if([, int tok])[)
|
||||
{
|
||||
std::string res;
|
||||
@@ -848,9 +854,9 @@ b4_error_verbose_if([, int tok])[)
|
||||
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) yy::b4_parser_class_name::yypact_ninf_ = b4_pact_ninf[;
|
||||
const ]b4_int_type(b4_pact_ninf, b4_pact_ninf) b4_parser_class_name::yypact_ninf_ = b4_pact_ninf[;
|
||||
const ]b4_int_type_for([b4_pact])[
|
||||
yy::]b4_parser_class_name[::yypact_[] =
|
||||
]b4_parser_class_name[::yypact_[] =
|
||||
{
|
||||
]b4_pact[
|
||||
};
|
||||
@@ -859,21 +865,21 @@ yy::]b4_parser_class_name[::yypact_[] =
|
||||
doesn't specify something else to do. Zero means the default is an
|
||||
error. */
|
||||
const ]b4_int_type_for([b4_defact])[
|
||||
yy::]b4_parser_class_name[::yydefact_[] =
|
||||
]b4_parser_class_name[::yydefact_[] =
|
||||
{
|
||||
]b4_defact[
|
||||
};
|
||||
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
const ]b4_int_type_for([b4_pgoto])[
|
||||
yy::]b4_parser_class_name[::yypgoto_[] =
|
||||
]b4_parser_class_name[::yypgoto_[] =
|
||||
{
|
||||
]b4_pgoto[
|
||||
};
|
||||
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
const ]b4_int_type_for([b4_defgoto])[
|
||||
yy::]b4_parser_class_name[::yydefgoto_[] =
|
||||
]b4_parser_class_name[::yydefgoto_[] =
|
||||
{
|
||||
]b4_defgoto[
|
||||
};
|
||||
@@ -881,16 +887,16 @@ yy::]b4_parser_class_name[::yydefgoto_[] =
|
||||
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
|
||||
positive, shift that token. If negative, reduce the rule which
|
||||
number is the opposite. If zero, do what YYDEFACT says. */
|
||||
const ]b4_int_type(b4_table_ninf, b4_table_ninf) yy::b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
|
||||
const ]b4_int_type(b4_table_ninf, b4_table_ninf) b4_parser_class_name::yytable_ninf_ = b4_table_ninf[;
|
||||
const ]b4_int_type_for([b4_table])[
|
||||
yy::]b4_parser_class_name[::yytable_[] =
|
||||
]b4_parser_class_name[::yytable_[] =
|
||||
{
|
||||
]b4_table[
|
||||
};
|
||||
|
||||
/* YYCHECK. */
|
||||
const ]b4_int_type_for([b4_check])[
|
||||
yy::]b4_parser_class_name[::yycheck_[] =
|
||||
]b4_parser_class_name[::yycheck_[] =
|
||||
{
|
||||
]b4_check[
|
||||
};
|
||||
@@ -898,7 +904,7 @@ yy::]b4_parser_class_name[::yycheck_[] =
|
||||
/* STOS_[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
const ]b4_int_type_for([b4_stos])[
|
||||
yy::]b4_parser_class_name[::yystos_[] =
|
||||
]b4_parser_class_name[::yystos_[] =
|
||||
{
|
||||
]b4_stos[
|
||||
};
|
||||
@@ -907,7 +913,7 @@ yy::]b4_parser_class_name[::yystos_[] =
|
||||
/* TOKEN_NUMBER_[YYLEX-NUM] -- Internal symbol number corresponding
|
||||
to YYLEX-NUM. */
|
||||
const ]b4_int_type_for([b4_toknum])[
|
||||
yy::]b4_parser_class_name[::yytoken_number_[] =
|
||||
]b4_parser_class_name[::yytoken_number_[] =
|
||||
{
|
||||
]b4_toknum[
|
||||
};
|
||||
@@ -915,14 +921,14 @@ yy::]b4_parser_class_name[::yytoken_number_[] =
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
const ]b4_int_type_for([b4_r1])[
|
||||
yy::]b4_parser_class_name[::yyr1_[] =
|
||||
]b4_parser_class_name[::yyr1_[] =
|
||||
{
|
||||
]b4_r1[
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
const ]b4_int_type_for([b4_r2])[
|
||||
yy::]b4_parser_class_name[::yyr2_[] =
|
||||
]b4_parser_class_name[::yyr2_[] =
|
||||
{
|
||||
]b4_r2[
|
||||
};
|
||||
@@ -931,7 +937,7 @@ yy::]b4_parser_class_name[::yyr2_[] =
|
||||
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
||||
First, the terminals, then, starting at \a yyntokens_, nonterminals. */
|
||||
const char*
|
||||
const yy::]b4_parser_class_name[::yytname_[] =
|
||||
const ]b4_parser_class_name[::yytname_[] =
|
||||
{
|
||||
]b4_tname[
|
||||
};
|
||||
@@ -939,8 +945,8 @@ const yy::]b4_parser_class_name[::yytname_[] =
|
||||
|
||||
#if YYDEBUG
|
||||
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
|
||||
const yy::]b4_parser_class_name[::rhs_number_type
|
||||
yy::]b4_parser_class_name[::yyrhs_[] =
|
||||
const ]b4_parser_class_name[::rhs_number_type
|
||||
]b4_parser_class_name[::yyrhs_[] =
|
||||
{
|
||||
]b4_rhs[
|
||||
};
|
||||
@@ -948,21 +954,21 @@ yy::]b4_parser_class_name[::yyrhs_[] =
|
||||
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
|
||||
YYRHS. */
|
||||
const ]b4_int_type_for([b4_prhs])[
|
||||
yy::]b4_parser_class_name[::yyprhs_[] =
|
||||
]b4_parser_class_name[::yyprhs_[] =
|
||||
{
|
||||
]b4_prhs[
|
||||
};
|
||||
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
const ]b4_int_type_for([b4_rline])[
|
||||
yy::]b4_parser_class_name[::yyrline_[] =
|
||||
]b4_parser_class_name[::yyrline_[] =
|
||||
{
|
||||
]b4_rline[
|
||||
};
|
||||
|
||||
// Print the state stack on the debug stream.
|
||||
void
|
||||
yy::]b4_parser_class_name[::yystack_print_ ()
|
||||
]b4_parser_class_name[::yystack_print_ ()
|
||||
{
|
||||
*yycdebug_ << "Stack now";
|
||||
for (state_stack_type::const_iterator i = yystate_stack_.begin ();
|
||||
@@ -973,7 +979,7 @@ yy::]b4_parser_class_name[::yystack_print_ ()
|
||||
|
||||
// Report on the debug stream that the rule \a yyrule is going to be reduced.
|
||||
void
|
||||
yy::]b4_parser_class_name[::yyreduce_print_ (int yyrule)
|
||||
]b4_parser_class_name[::yyreduce_print_ (int yyrule)
|
||||
{
|
||||
unsigned int yylno = yyrline_[yyrule];
|
||||
/* Print the symbols being reduced, and their result. */
|
||||
@@ -987,8 +993,8 @@ yy::]b4_parser_class_name[::yyreduce_print_ (int yyrule)
|
||||
#endif // YYDEBUG
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
|
||||
yy::]b4_parser_class_name[::token_number_type
|
||||
yy::]b4_parser_class_name[::yytranslate_ (int token)
|
||||
]b4_parser_class_name[::token_number_type
|
||||
]b4_parser_class_name[::yytranslate_ (int token)
|
||||
{
|
||||
static
|
||||
const token_number_type
|
||||
@@ -1002,17 +1008,19 @@ yy::]b4_parser_class_name[::yytranslate_ (int token)
|
||||
return yyundef_token_;
|
||||
}
|
||||
|
||||
const int yy::]b4_parser_class_name[::yyeof_ = 0;
|
||||
const int yy::]b4_parser_class_name[::yylast_ = ]b4_last[;
|
||||
const int yy::]b4_parser_class_name[::yynnts_ = ]b4_nterms_number[;
|
||||
const int yy::]b4_parser_class_name[::yyempty_ = -2;
|
||||
const int yy::]b4_parser_class_name[::yyfinal_ = ]b4_final_state_number[;
|
||||
const int yy::]b4_parser_class_name[::yyterror_ = 1;
|
||||
const int yy::]b4_parser_class_name[::yyerrcode_ = 256;
|
||||
const int yy::]b4_parser_class_name[::yyntokens_ = ]b4_tokens_number[;
|
||||
const int ]b4_parser_class_name[::yyeof_ = 0;
|
||||
const int ]b4_parser_class_name[::yylast_ = ]b4_last[;
|
||||
const int ]b4_parser_class_name[::yynnts_ = ]b4_nterms_number[;
|
||||
const int ]b4_parser_class_name[::yyempty_ = -2;
|
||||
const int ]b4_parser_class_name[::yyfinal_ = ]b4_final_state_number[;
|
||||
const int ]b4_parser_class_name[::yyterror_ = 1;
|
||||
const int ]b4_parser_class_name[::yyerrcode_ = 256;
|
||||
const int ]b4_parser_class_name[::yyntokens_ = ]b4_tokens_number[;
|
||||
|
||||
const unsigned int yy::]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const yy::]b4_parser_class_name[::token_number_type yy::]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[;
|
||||
const unsigned int ]b4_parser_class_name[::yyuser_token_number_max_ = ]b4_user_token_number_max[;
|
||||
const ]b4_parser_class_name[::token_number_type ]b4_parser_class_name[::yyundef_token_ = ]b4_undef_token_number[;
|
||||
|
||||
} // namespace yy
|
||||
|
||||
]b4_epilogue
|
||||
dnl
|
||||
|
||||
Reference in New Issue
Block a user