c++: style changes

Instead of

    parser::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
      : super_type (that.state, that.location)
    {
      value = that.value;
    }

generate

    parser::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
      : super_type (that.state, that.value, that.location)
    {}

* data/lalr1.cc (stack_symbol_type): Improve the copy ctor, when not
using the variants.
(yypush_): Rename arguments for clarity.
This commit is contained in:
Akim Demaille
2018-08-26 07:38:52 +02:00
parent 2116ad3a28
commit b5d4eb8913

View File

@@ -332,9 +332,9 @@ b4_location_define])])[
/// Push a new state on the stack.
/// \param m a debug message to display
/// if null, no trace is output.
/// \param s the symbol
/// \param sym the symbol
/// \warning the contents of \a s.value is stolen.
void yypush_ (const char* m, stack_symbol_type& s);
void yypush_ (const char* m, stack_symbol_type& sym);
/// Push a new look ahead token on the state on the stack.
/// \param m a debug message to display
@@ -586,11 +586,10 @@ m4_if(b4_prefix, [yy], [],
{}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (const stack_symbol_type& that)
: super_type (that.state]b4_locations_if([, that.location])[)
{
]b4_variant_if([b4_symbol_variant([that.type_get ()],
[value], [copy], [that.value])],
[[value = that.value;]])[
: super_type (that.state]b4_variant_if([], [, that.value])[]b4_locations_if([, that.location])[)
{]b4_variant_if([
b4_symbol_variant([that.type_get ()],
[value], [copy], [that.value])])[
}
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (state_type s, symbol_type& that)
@@ -646,6 +645,14 @@ m4_if(b4_prefix, [yy], [],
}
#endif
void
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& sym)
{
if (m)
YY_SYMBOL_PRINT (m, sym);
yystack_.push (sym);
}
void
]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym)
{
@@ -653,14 +660,6 @@ m4_if(b4_prefix, [yy], [],
yypush_ (m, t);
}
void
]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s)
{
if (m)
YY_SYMBOL_PRINT (m, s);
yystack_.push (s);
}
void
]b4_parser_class_name[::yypop_ (unsigned n)
{