commit b5d4eb8913c762de9115aecc2926f70b35b11930 Author: Akim Demaille <[email protected]> Date: Sun Aug 26 07:38:52 2018 +0200 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. diff --git a/data/lalr1.cc b/data/lalr1.cc index ab48d506..693536a3 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -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) @@ -647,18 +646,18 @@ m4_if(b4_prefix, [yy], [], #endif void - ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym) + ]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& sym) { - stack_symbol_type t (s, sym); - yypush_ (m, t); + if (m) + YY_SYMBOL_PRINT (m, sym); + yystack_.push (sym); } void - ]b4_parser_class_name[::yypush_ (const char* m, stack_symbol_type& s) + ]b4_parser_class_name[::yypush_ (const char* m, state_type s, symbol_type& sym) { - if (m) - YY_SYMBOL_PRINT (m, s); - yystack_.push (s); + stack_symbol_type t (s, sym); + yypush_ (m, t); } void
