mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 00:03:03 +00:00
c++: comment and style changes
* data/c++.m4, data/lalr1.cc: More documentation. Tidy. * tests/c++.at (string_cast): Rename as... (to_string): this C++11 name.
This commit is contained in:
@@ -209,6 +209,7 @@ m4_define([b4_public_types_declare],
|
|||||||
const semantic_type& v]b4_locations_if([,
|
const semantic_type& v]b4_locations_if([,
|
||||||
const location_type& l])[);
|
const location_type& l])[);
|
||||||
|
|
||||||
|
/// Destroy the symbol.
|
||||||
~basic_symbol ();
|
~basic_symbol ();
|
||||||
|
|
||||||
/// Destructive move, \a s is emptied into this.
|
/// Destructive move, \a s is emptied into this.
|
||||||
@@ -244,16 +245,17 @@ m4_define([b4_public_types_declare],
|
|||||||
void move (by_type& that);
|
void move (by_type& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a type).
|
/// The (internal) type number (corresponding to \a type).
|
||||||
/// -1 when this symbol is empty.
|
/// \a empty when empty.
|
||||||
symbol_number_type type_get () const;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
/// The token.
|
/// The token.
|
||||||
token_type token () const;
|
token_type token () const;
|
||||||
|
|
||||||
|
/// The type number used to denote an empty symbol.
|
||||||
enum { empty = 0 };
|
enum { empty = 0 };
|
||||||
|
|
||||||
/// The symbol type.
|
/// The symbol type.
|
||||||
/// -1 when this symbol is empty.
|
/// \a empty when empty.
|
||||||
token_number_type type;
|
token_number_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -292,12 +292,14 @@ b4_location_define])])[
|
|||||||
void move (by_state& that);
|
void move (by_state& that);
|
||||||
|
|
||||||
/// The (internal) type number (corresponding to \a state).
|
/// The (internal) type number (corresponding to \a state).
|
||||||
/// "empty" when empty.
|
/// \a empty when empty.
|
||||||
symbol_number_type type_get () const;
|
symbol_number_type type_get () const;
|
||||||
|
|
||||||
|
/// The state number used to denote an empty symbol.
|
||||||
enum { empty = 0 };
|
enum { empty = 0 };
|
||||||
|
|
||||||
/// The state.
|
/// The state.
|
||||||
|
/// \a empty when empty.
|
||||||
state_type state;
|
state_type state;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -338,7 +340,7 @@ b4_location_define])])[
|
|||||||
/// Pop \a n symbols the three stacks.
|
/// Pop \a n symbols the three stacks.
|
||||||
void yypop_ (unsigned int n = 1);
|
void yypop_ (unsigned int n = 1);
|
||||||
|
|
||||||
// Constants.
|
/// Constants.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yyeof_ = 0,
|
yyeof_ = 0,
|
||||||
@@ -695,9 +697,6 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
int
|
int
|
||||||
]b4_parser_class_name[::parse ()
|
]b4_parser_class_name[::parse ()
|
||||||
{
|
{
|
||||||
/// Whether yyla contains a lookahead.
|
|
||||||
bool yyempty = true;
|
|
||||||
|
|
||||||
// State.
|
// State.
|
||||||
int yyn;
|
int yyn;
|
||||||
/// Length of the RHS of the rule being reduced.
|
/// Length of the RHS of the rule being reduced.
|
||||||
@@ -707,6 +706,9 @@ m4_if(b4_prefix, [yy], [],
|
|||||||
int yynerrs_ = 0;
|
int yynerrs_ = 0;
|
||||||
int yyerrstatus_ = 0;
|
int yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
/// Whether yyla contains a lookahead.
|
||||||
|
bool yyempty = true;
|
||||||
|
|
||||||
/// The lookahead symbol.
|
/// The lookahead symbol.
|
||||||
symbol_type yyla;]b4_locations_if([[
|
symbol_type yyla;]b4_locations_if([[
|
||||||
|
|
||||||
@@ -1011,7 +1013,6 @@ b4_dollar_popdef])[]dnl
|
|||||||
b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
||||||
[state_type, symbol_number_type])[) const
|
[state_type, symbol_number_type])[) const
|
||||||
{]b4_error_verbose_if([[
|
{]b4_error_verbose_if([[
|
||||||
std::string yyres;
|
|
||||||
// Number of reported tokens (one for the "unexpected", one per
|
// Number of reported tokens (one for the "unexpected", one per
|
||||||
// "expected").
|
// "expected").
|
||||||
size_t yycount = 0;
|
size_t yycount = 0;
|
||||||
@@ -1089,6 +1090,7 @@ b4_error_verbose_if([state_type yystate, symbol_number_type yytoken],
|
|||||||
#undef YYCASE_
|
#undef YYCASE_
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string yyres;
|
||||||
// Argument number.
|
// Argument number.
|
||||||
size_t yyi = 0;
|
size_t yyi = 0;
|
||||||
for (char const* yyp = yyformat; *yyp; ++yyp)
|
for (char const* yyp = yyformat; *yyp; ++yyp)
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ typedef std::list<std::string> strings_type;
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline
|
inline
|
||||||
std::string
|
std::string
|
||||||
string_cast (const T& t)
|
to_string (const T& t)
|
||||||
{
|
{
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << t;
|
o << t;
|
||||||
@@ -266,7 +266,7 @@ list:
|
|||||||
|
|
||||||
item:
|
item:
|
||||||
TEXT { std::swap ($$,$][1); }
|
TEXT { std::swap ($$,$][1); }
|
||||||
| NUMBER { if ($][1 == 3) YYERROR; else $$ = string_cast ($][1); }
|
| NUMBER { if ($][1 == 3) YYERROR; else $$ = to_string ($][1); }
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
]AT_TOKEN_CTOR_IF([],
|
]AT_TOKEN_CTOR_IF([],
|
||||||
@@ -304,8 +304,8 @@ namespace yy
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{]AT_TOKEN_CTOR_IF([[
|
{]AT_TOKEN_CTOR_IF([[
|
||||||
return parser::make_TEXT (string_cast (stage)]AT_LOCATION_IF([, location ()])[);]], [[
|
return parser::make_TEXT (to_string (stage)]AT_LOCATION_IF([, location ()])[);]], [[
|
||||||
yylval->BUILD (std::string, string_cast (stage));]AT_LOCATION_IF([
|
yylval->BUILD (std::string, to_string (stage));]AT_LOCATION_IF([
|
||||||
*yylloc = location ();])[
|
*yylloc = location ();])[
|
||||||
return parser::token::TEXT;]])[
|
return parser::token::TEXT;]])[
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user