c++: formatting and comment changes

* data/c++.m4, data/lalr1.cc, data/stack.hh, data/variant.hh:
Fix indentation.
Fix some comments.
This commit is contained in:
Akim Demaille
2013-01-28 14:22:51 +01:00
parent 9e62f1a657
commit 5f87211cb4
4 changed files with 21 additions and 22 deletions

View File

@@ -176,20 +176,18 @@ m4_define([b4_public_types_declare],
inline basic_symbol (const basic_symbol& other); inline basic_symbol (const basic_symbol& other);
/// Constructor for valueless symbols. /// Constructor for valueless symbols.
inline basic_symbol (]b4_join( inline basic_symbol (typename Base::value_type t]b4_locations_if([,
[typename Base::value_type t], const location_type& l])[);
b4_locations_if([const location_type& l]))[);
/// Constructor for symbols with semantic value. /// Constructor for symbols with semantic value.
inline basic_symbol (]b4_join( inline basic_symbol (typename Base::value_type t,
[typename Base::value_type t], const semantic_type& v]b4_locations_if([,
[const semantic_type& v], const location_type& l])[);
b4_locations_if([const location_type& l]))[);
/// Assignment operator. /// Assignment operator.
inline basic_symbol& operator= (const basic_symbol& other); inline basic_symbol& operator= (const basic_symbol& other);
/// Destructive move, \a s is emptied. /// Destructive move, \a s is emptied into this.
inline void move (basic_symbol& s); inline void move (basic_symbol& s);
/// The semantic value. /// The semantic value.
@@ -220,6 +218,7 @@ m4_define([b4_public_types_declare],
/// The token. /// The token.
inline token_type token () const; inline token_type token () const;
/// The type used to store the symbol type.
typedef token_type value_type; typedef token_type value_type;
}; };

View File

@@ -287,6 +287,7 @@ b4_location_define])])[
/// The type (corresponding to \a state). /// The type (corresponding to \a state).
inline int type_get () const; inline int type_get () const;
/// The type used to store the symbol type.
typedef state_type value_type; typedef state_type value_type;
}; };
@@ -497,12 +498,10 @@ m4_if(b4_prefix, [yy], [],
]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false), ]m4_ifset([b4_parse_param], [ ], [ :])[yydebug_ (false),
yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[ yycdebug_ (&std::cerr)]m4_ifset([b4_parse_param], [,])[
#endif]b4_parse_param_cons[ #endif]b4_parse_param_cons[
{ {}
}
]b4_parser_class_name::~b4_parser_class_name[ () ]b4_parser_class_name::~b4_parser_class_name[ ()
{ {}
}
/*---------------. /*---------------.
@@ -530,10 +529,10 @@ m4_if(b4_prefix, [yy], [],
return yystos_[state]; return yystos_[state];
} }
template <typename Base> template <typename Base>
void void
]b4_parser_class_name[::yy_destroy_ (const char* yymsg, ]b4_parser_class_name[::yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const
basic_symbol<Base>& yysym) const
{ {
if (yymsg) if (yymsg)
YY_SYMBOL_PRINT (yymsg, yysym); YY_SYMBOL_PRINT (yymsg, yysym);
@@ -574,8 +573,7 @@ m4_if(b4_prefix, [yy], [],
#endif #endif
void void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
symbol_type& sym)
{ {
if (m) if (m)
YY_SYMBOL_PRINT (m, sym); YY_SYMBOL_PRINT (m, sym);

View File

@@ -41,14 +41,14 @@ m4_define([b4_stack_define],
inline inline
T& T&
operator [] (unsigned int i) operator[] (unsigned int i)
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }
inline inline
const T& const T&
operator [] (unsigned int i) const operator[] (unsigned int i) const
{ {
return seq_[seq_.size () - 1 - i]; return seq_[seq_.size () - 1 - i];
} }

View File

@@ -159,11 +159,12 @@ m4_define([b4_variant_define],
} }
/// Swap the content with \a other, of same type. /// Swap the content with \a other, of same type.
///
/// Both variants must be built beforehand, because swapping the actual /// Both variants must be built beforehand, because swapping the actual
/// data requires reading it (with as()), and this is not possible on /// data requires reading it (with as()), and this is not possible on
/// unconstructed variants: it would require some dynamic testing, which /// unconstructed variants: it would require some dynamic testing, which
/// should not be the variant's responsability. /// should not be the variant's responsability.
/// Swapping between built and ((possibly) non-built is done with /// Swapping between built and (possibly) non-built is done with
/// variant::move (). /// variant::move ().
template <typename T> template <typename T>
void void
@@ -175,7 +176,8 @@ m4_define([b4_variant_define],
std::swap (as<T>(), other.as<T>()); std::swap (as<T>(), other.as<T>());
} }
/// Assign the content of \a other to this. /// Move the content of \a other to this.
///
/// Destroys \a other. /// Destroys \a other.
template <typename T> template <typename T>
void void
@@ -188,7 +190,6 @@ m4_define([b4_variant_define],
} }
/// Copy the content of \a other to this. /// Copy the content of \a other to this.
/// Destroys \a other.
template <typename T> template <typename T>
void void
copy (const variant<S>& other) copy (const variant<S>& other)
@@ -227,7 +228,8 @@ m4_define([b4_variant_define],
long double align_me; long double align_me;
char raw[S]; char raw[S];
} buffer;]b4_parse_assert_if([ } buffer;]b4_parse_assert_if([
/// Whether something is contained.
/// Whether the content is built.
bool built; bool built;
/// If defined, the name of the stored type. /// If defined, the name of the stored type.
const char* tname;])[ const char* tname;])[