1 # C++ skeleton for Bison
3 # Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 m4_include(b4_skeletonsdir
/[c
++.m4
])
20 # api.value.type=variant is valid.
21 m4_define([b4_value_type_setup_variant
])
23 # Check the value of %define parse.lac, where LAC stands for lookahead
25 b4_percent_define_default([[parse
.lac
]], [[none
]])
26 b4_percent_define_check_values([[[[parse
.lac
]], [[full
]], [[none
]]]])
27 b4_define_flag_if([lac
])
28 m4_define([b4_lac_flag
],
29 [m4_if(b4_percent_define_get([[parse
.lac
]]),
30 [none
], [[0]], [[1]])])
33 # b4_tname_if(TNAME-NEEDED, TNAME-NOT-NEEDED)
34 # -------------------------------------------
35 m4_define([b4_tname_if
],
36 [m4_case(b4_percent_define_get([[parse
.error
]]),
38 [b4_token_table_if([$
1],
42 # b4_integral_parser_table_declare(TABLE-NAME, CONTENT, COMMENT)
43 # --------------------------------------------------------------
44 # Declare "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
45 m4_define([b4_integral_parser_table_declare
],
46 [m4_ifval([$
3], [b4_comment([$
3], [ ])
48 static const b4_int_type_for([$
2]) yy$
1_
[[]];dnl
51 # b4_integral_parser_table_define(TABLE-NAME, CONTENT, COMMENT)
52 # -------------------------------------------------------------
53 # Define "parser::yy<TABLE-NAME>_" whose contents is CONTENT.
54 m4_define([b4_integral_parser_table_define
],
55 [ const b4_int_type_for([$
2])
56 b4_parser_class::yy$
1_
[[]] =
65 m4_define([b4_symbol_kind
],
66 [symbol_kind::b4_symbol_kind_base($@
)])
69 # b4_symbol_value_template(VAL, SYMBOL-NUM, [TYPE])
70 # -------------------------------------------------
71 # Same as b4_symbol_value, but used in a template method. It makes
72 # a difference when using variants. Note that b4_value_type_setup_union
73 # overrides b4_symbol_value, so we must override it again.
74 m4_copy([b4_symbol_value
], [b4_symbol_value_template
])
75 m4_append([b4_value_type_setup_union
],
76 [m4_copy_force([b4_symbol_value_union
], [b4_symbol_value_template
])])
78 # b4_lhs_value(SYMBOL-NUM, [TYPE])
79 # --------------------------------
81 m4_define([b4_lhs_value
],
82 [b4_symbol_value([yylhs
.value
], [$
1], [$
2])])
88 m4_define([b4_lhs_location
],
92 # b4_rhs_data(RULE-LENGTH, POS)
93 # -----------------------------
95 m4_define([b4_rhs_data
],
96 [yystack_@
{b4_subtract($@
)@
}])
99 # b4_rhs_state(RULE-LENGTH, POS)
100 # ------------------------------
101 # The state corresponding to the symbol #POS, where the current
102 # rule has RULE-LENGTH symbols on RHS.
103 m4_define([b4_rhs_state
],
104 [b4_rhs_data([$
1], [$
2]).state
])
107 # b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
108 # --------------------------------------------------
110 m4_define([_b4_rhs_value
],
111 [b4_symbol_value([b4_rhs_data([$
1], [$
2]).value
], [$
3], [$
4])])
113 m4_define([b4_rhs_value
],
114 [b4_percent_define_ifdef([api
.value
.automove
],
115 [YY_MOVE (_b4_rhs_value($@
))],
116 [_b4_rhs_value($@
)])])
119 # b4_rhs_location(RULE-LENGTH, POS)
120 # ---------------------------------
121 # Expansion of @POS, where the current rule has RULE-LENGTH symbols
123 m4_define([b4_rhs_location
],
124 [b4_rhs_data([$
1], [$
2]).location
])
127 # b4_symbol_action(SYMBOL-NUM, KIND)
128 # ----------------------------------
129 # Run the action KIND (destructor or printer) for SYMBOL-NUM.
130 # Same as in C, but using references instead of pointers.
131 m4_define([b4_symbol_action
],
132 [b4_symbol_if([$
1], [has_$
2],
133 [m4_pushdef([b4_symbol_value
], m4_defn([b4_symbol_value_template
]))[]dnl
134 b4_dollar_pushdef([yysym
.value
],
138 _b4_symbol_case([$
1])[]dnl
139 b4_syncline([b4_symbol([$
1], [$
2_line
])], [b4_symbol([$
1], [$
2_file
])])dnl
140 b4_symbol([$
1], [$
2])
141 b4_syncline([@oline@
], [@ofile@
])dnl
144 m4_popdef([b4_symbol_value
])[]dnl
145 b4_dollar_popdef
[]dnl
154 [b4_function_call([yylex
],
155 [symbol_type
], m4_ifdef([b4_lex_param
], b4_lex_param
))],
156 [b4_function_call([yylex
], [int],
157 [b4_api_PREFIX
[STYPE
*], [&yyla
.value
]][]dnl
158 b4_locations_if([, [[location
*], [&yyla
.location
]]])dnl
159 m4_ifdef([b4_lex_param
], [, ]b4_lex_param
))])])
162 m4_pushdef([b4_copyright_years
],
163 [2002-2015, 2018-2020])
165 m4_define([b4_parser_class
],
166 [b4_percent_define_get([[api
.parser
.class]])])
168 b4_bison_locations_if([# Backward compatibility.
169 m4_define([b4_location_constructors
])
170 m4_include(b4_skeletonsdir
/[location
.cc
])])
171 m4_include(b4_skeletonsdir
/[stack
.hh
])
172 b4_variant_if([m4_include(b4_skeletonsdir
/[variant
.hh
])])
175 # b4_shared_declarations(hh|cc)
176 # -----------------------------
177 # Declaration that might either go into the header (if --header, $1 = hh)
178 # or in the implementation file.
179 m4_define([b4_shared_declarations
],
180 [b4_percent_code_get([[requires
]])[
181 ]b4_parse_assert_if([# include <cassert>])[
182 # include <cstdlib> // std::abort
184 # include <stdexcept>
189 ]m4_ifdef([b4_location_include
],
190 [[# include ]b4_location_include])[
191 ]b4_variant_if([b4_variant_includes
])[
193 ]b4_attribute_define
[
201 ]b4_bison_locations_if([m4_ifndef([b4_location_file
],
202 [b4_location_define
])])[
205 class ]b4_parser_class
[
208 ]b4_public_types_declare
[
209 ]b4_symbol_type_define
[
210 /// Build a parser object.
211 ]b4_parser_class
[ (]b4_parse_param_decl
[);
212 virtual ~]b4_parser_class
[ ();
214 #if 201103L <= YY_CPLUSPLUS
216 ]b4_parser_class
[ (const ]b4_parser_class
[&) = delete;
218 ]b4_parser_class
[& operator= (const ]b4_parser_class
[&) = delete;
221 /// Parse. An alias for parse ().
222 /// \returns 0 iff parsing succeeded.
226 /// \returns 0 iff parsing succeeded.
227 virtual int parse ();
229 #if ]b4_api_PREFIX[DEBUG
230 /// The current debugging stream.
231 std::ostream
& debug_stream () const YY_ATTRIBUTE_PURE
;
232 /// Set the current debugging stream.
233 void set_debug_stream (std::ostream
&);
235 /// Type for debugging levels.
236 typedef int debug_level_type
;
237 /// The current debugging level.
238 debug_level_type
debug_level () const YY_ATTRIBUTE_PURE
;
239 /// Set the current debugging level.
240 void set_debug_level (debug_level_type l
);
243 /// Report a syntax error.]b4_locations_if([[
244 /// \param loc where the syntax error is found.]])[
245 /// \param msg a description of the syntax error.
246 virtual void error (]b4_locations_if([[const location_type
& loc
, ]])[const std::string
& msg
);
248 /// Report a syntax error.
249 void error (const syntax_error
& err
);
251 ]b4_parse_error_bmatch(
253 [[ /// The user-facing name of the symbol whose (internal) number is
254 /// YYSYMBOL. No bounds checking.
255 static const char *symbol_name (symbol_kind_type yysymbol
);]],
257 [[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
258 /// The user-facing name of the symbol whose (internal) number is
259 /// YYSYMBOL. No bounds checking.
260 static const char *symbol_name (symbol_kind_type yysymbol
);
261 #endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
264 [[ /// The user-facing name of the symbol whose (internal) number is
265 /// YYSYMBOL. No bounds checking.
266 static std::string
symbol_name (symbol_kind_type yysymbol
);]])[
268 ]b4_token_constructor_define
[
269 ]b4_parse_error_bmatch([custom\
|detailed\
|verbose
], [[
273 context (const ]b4_parser_class
[& yyparser
, const symbol_type
& yyla
);
274 const symbol_type
& lookahead () const { return yyla_
; }
275 symbol_kind_type
token () const { return yyla_
.kind (); }]b4_locations_if([[
276 const location_type
& location () const { return yyla_
.location
; }
278 /// Put in YYARG at most YYARGN of the expected tokens, and return the
279 /// number of tokens stored in YYARG. If YYARG is null, return the
280 /// number of expected tokens (guaranteed to be less than YYNTOKENS).
281 int expected_tokens (symbol_kind_type yyarg
[], int yyargn
) const;
284 const ]b4_parser_class
[& yyparser_
;
285 const symbol_type
& yyla_
;
289 #if YY_CPLUSPLUS < 201103L
291 ]b4_parser_class
[ (const ]b4_parser_class
[&);
293 ]b4_parser_class
[& operator= (const ]b4_parser_class
[&);
296 /// Check the lookahead yytoken.
297 /// \returns true iff the token will be eventually shifted.
298 bool yy_lac_check_ (symbol_kind_type yytoken
) const;
299 /// Establish the initial context if no initial context currently exists.
300 /// \returns true iff the token will be eventually shifted.
301 bool yy_lac_establish_ (symbol_kind_type yytoken
);
302 /// Discard any previous initial lookahead context because of event.
303 /// \param event the event which caused the lookahead to be discarded.
304 /// Only used for debbuging output.
305 void yy_lac_discard_ (const char* event
);]])[
307 /// Stored state numbers (used for stacks).
308 typedef ]b4_int_type(0, m4_eval(b4_states_number
- 1))[ state_type
;
309 ]b4_parse_error_bmatch(
311 /// Report a syntax error
312 /// \param yyctx the context in which the error occurred.
313 void report_syntax_error (const context
& yyctx
) const;]],
314 [detailed\
|verbose
], [[
315 /// The arguments of the error message.
316 int yy_syntax_error_arguments_ (const context
& yyctx
,
317 symbol_kind_type yyarg
[], int yyargn
) const;
319 /// Generate an error message.
320 /// \param yyctx the context in which the error occurred.
321 virtual std::string
yysyntax_error_ (const context
& yyctx
) const;]])[
322 /// Compute post-reduction state.
323 /// \param yystate the current state
324 /// \param yysym the nonterminal to push on the stack
325 static state_type
yy_lr_goto_state_ (state_type yystate
, int yysym
);
327 /// Whether the given \c yypact_ value indicates a defaulted state.
328 /// \param yyvalue the value to check
329 static bool yy_pact_value_is_default_ (int yyvalue
);
331 /// Whether the given \c yytable_ value indicates a syntax error.
332 /// \param yyvalue the value to check
333 static bool yy_table_value_is_error_ (int yyvalue
);
335 static const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
)[ yypact_ninf_
;
336 static const ]b4_int_type(b4_table_ninf
, b4_table_ninf
)[ yytable_ninf_
;
338 /// Convert a scanner token kind \a t to a symbol kind.
339 /// In theory \a t should be a token_kind_type, but character literals
340 /// are valid, yet not members of the token_type enum.
341 static symbol_kind_type
yytranslate_ (int t
);
343 ]b4_parse_error_bmatch(
345 [[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
346 /// For a symbol, its name in clear.
347 static const char* const yytname_
[];
348 #endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
351 [[ /// Convert the symbol name \a n to a form suitable for a diagnostic.
352 static std::string
yytnamerr_ (const char *yystr
);
354 /// For a symbol, its name in clear.
355 static const char* const yytname_
[];
359 ]b4_parser_tables_declare
[
361 #if ]b4_api_PREFIX[DEBUG
362 ]b4_integral_parser_table_declare([rline
], [b4_rline
],
363 [[YYRLINE
[YYN
] -- Source line where rule number YYN was defined
.]])[
364 /// Report on the debug stream that the rule \a r is going to be reduced.
365 virtual void yy_reduce_print_ (int r
) const;
366 /// Print the state stack on the debug stream.
367 virtual void yy_stack_print_ () const;
372 std::ostream
* yycdebug_
;
374 /// \brief Display a symbol kind, value and location.
375 /// \param yyo The output stream.
376 /// \param yysym The symbol.
377 template <typename Base
>
378 void yy_print_ (std::ostream
& yyo
, const basic_symbol
<Base
>& yysym
) const;
381 /// \brief Reclaim the memory associated to a symbol.
382 /// \param yymsg Why this token is reclaimed.
383 /// If null, print nothing.
384 /// \param yysym The symbol.
385 template <typename Base
>
386 void yy_destroy_ (const char* yymsg
, basic_symbol
<Base
>& yysym
) const;
389 /// Type access provider for state based symbols.
392 /// Default constructor.
393 by_state () YY_NOEXCEPT
;
395 /// The symbol kind as needed by the constructor.
396 typedef state_type kind_type
;
399 by_state (kind_type s
) YY_NOEXCEPT
;
401 /// Copy constructor.
402 by_state (const by_state
& that
) YY_NOEXCEPT
;
404 /// Record that this symbol is empty.
405 void clear () YY_NOEXCEPT
;
407 /// Steal the symbol kind from \a that.
408 void move (by_state
& that
);
410 /// The symbol kind (corresponding to \a state).
411 /// \a ]b4_symbol(-2, kind)[ when empty.
412 symbol_kind_type
kind () const YY_NOEXCEPT
;
414 /// The state number used to denote an empty symbol.
415 /// We use the initial state, as it does not have a value.
416 enum { empty_state
= 0 };
419 /// \a empty when empty.
423 /// "Internal" symbol: element of the stack.
424 struct stack_symbol_type
: basic_symbol
<by_state
>
427 typedef basic_symbol
<by_state
> super_type
;
428 /// Construct an empty symbol.
429 stack_symbol_type ();
430 /// Move or copy construction.
431 stack_symbol_type (YY_RVREF (stack_symbol_type
) that
);
432 /// Steal the contents from \a sym to build this.
433 stack_symbol_type (state_type s
, YY_MOVE_REF (symbol_type
) sym
);
434 #if YY_CPLUSPLUS < 201103L
435 /// Assignment, needed by push_back by some old implementations.
436 /// Moves the contents of that.
437 stack_symbol_type
& operator= (stack_symbol_type
& that
);
439 /// Assignment, needed by push_back by other implementations.
440 /// Needed by some other old implementations.
441 stack_symbol_type
& operator= (const stack_symbol_type
& that
);
448 typedef stack
<stack_symbol_type
> stack_type
;
451 stack_type yystack_
;]b4_lac_if([[
452 /// The stack for LAC.
453 /// Logically, the yy_lac_stack's lifetime is confined to the function
454 /// yy_lac_check_. We just store it as a member of this class to hold
455 /// on to the memory and to avoid frequent reallocations.
456 /// Since yy_lac_check_ is const, this member must be mutable.
457 mutable std::vector
<state_type
> yylac_stack_
;
458 /// Whether an initial LAC context was established.
459 bool yy_lac_established_
;
462 /// Push a new state on the stack.
463 /// \param m a debug message to display
464 /// if null, no trace is output.
465 /// \param sym the symbol
466 /// \warning the contents of \a s.value is stolen.
467 void yypush_ (const char* m
, YY_MOVE_REF (stack_symbol_type
) sym
);
469 /// Push a new look ahead token on the state on the stack.
470 /// \param m a debug message to display
471 /// if null, no trace is output.
472 /// \param s the state
473 /// \param sym the symbol (for its value and location).
474 /// \warning the contents of \a sym.value is stolen.
475 void yypush_ (const char* m
, state_type s
, YY_MOVE_REF (symbol_type
) sym
);
477 /// Pop \a n symbols from the stack.
478 void yypop_ (int n
= 1);
483 yylast_
= ]b4_last
[, ///< Last index in yytable_.
484 yynnts_
= ]b4_nterms_number
[, ///< Number of nonterminal symbols.
485 yyfinal_
= ]b4_final_state_number
[ ///< Termination state number.
488 ]b4_parse_param_vars
[
489 ]b4_percent_code_get([[yy_bison_internal_hook
]])[
492 ]b4_token_ctor_if([b4_yytranslate_define([$
1])[
493 ]b4_public_types_define([$
1])])[
496 ]b4_percent_code_get([[provides
]])[
504 [b4_output_begin([b4_spec_header_file
])
505 b4_copyright([Skeleton interface
for Bison
LALR(1) parsers in C
++])
508 ** \file ]b4_spec_mapped_header_file[
509 ** Define the ]b4_namespace_ref[::parser class.
512 // C++ LALR(1) parser skeleton written by Akim Demaille.
515 ]b4_cpp_guard_open([b4_spec_mapped_header_file
])[
516 ]b4_shared_declarations(hh
)[
517 ]b4_cpp_guard_close([b4_spec_mapped_header_file
])[
522 b4_output_begin([b4_parser_file_name
])[
523 ]b4_copyright([Skeleton implementation
for Bison
LALR(1) parsers in C
++])[
525 ]b4_percent_code_get([[top
]])[]dnl
526 m4_if(b4_prefix
, [yy
], [],
528 // Take the name prefix into account.
529 [#]define yylex b4_prefix[]lex])[
531 ]b4_user_pre_prologue
[
533 ]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
534 [b4_shared_declarations([cc
])])[
536 ]b4_user_post_prologue
[
537 ]b4_percent_code_get
[
540 # if defined YYENABLE_NLS && YYENABLE_NLS
542 # include <libintl.h> // FIXME: INFRINGES ON USER NAME SPACE.
543 # define YY_(msgid) dgettext ("bison-runtime", msgid)
547 # define YY_(msgid) msgid
550 ]b4_has_translations_if([
552 # define N_(Msgid) Msgid
556 // Whether we are compiled with exception support.
557 #ifndef YY_EXCEPTIONS
558 # if defined __GNUC__ && !defined __EXCEPTIONS
559 # define YY_EXCEPTIONS 0
561 # define YY_EXCEPTIONS 1
565 ]b4_locations_if([dnl
566 [#define YYRHSLOC(Rhs, K) ((Rhs)[K].location)
567 ]b4_yylloc_default_define
])[
569 // Enable debugging if requested.
570 #if ]b4_api_PREFIX[DEBUG
572 // A pseudo ostream that takes yydebug_ into account.
573 # define YYCDEBUG if (yydebug_) (*yycdebug_)
575 # define YY_SYMBOL_PRINT(Title, Symbol) \
579 *yycdebug_ << Title << ' '; \
580 yy_print_ (*yycdebug_, Symbol); \
581 *yycdebug_ << '\n'; \
585 # define YY_REDUCE_PRINT(Rule) \
588 yy_reduce_print_ (Rule); \
591 # define YY_STACK_PRINT() \
594 yy_stack_print_ (); \
597 #else // !]b4_api_PREFIX[DEBUG
599 # define YYCDEBUG if (false) std::cerr
600 # define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol)
601 # define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
602 # define YY_STACK_PRINT() static_cast<void> (0)
604 #endif // !]b4_api_PREFIX[DEBUG
606 #define yyerrok (yyerrstatus_ = 0)
607 #define yyclearin (yyla.clear ())
609 #define YYACCEPT goto yyacceptlab
610 #define YYABORT goto yyabortlab
611 #define YYERROR goto yyerrorlab
612 #define YYRECOVERING() (!!yyerrstatus_)
615 /// Build a parser object.
616 ]b4_parser_class::b4_parser_class
[ (]b4_parse_param_decl
[)
617 #if ]b4_api_PREFIX[DEBUG
619 yycdebug_ (&std::cerr
)]b4_lac_if([,], [m4_ifset([b4_parse_param
], [,])])[
621 ]b4_lac_if([ :], [m4_ifset([b4_parse_param
], [ :])])[
623 yy_lac_established_ (false)]m4_ifset([b4_parse_param
], [,])])[]b4_parse_param_cons
[
626 ]b4_parser_class::~b4_parser_class
[ ()
629 ]b4_parser_class
[::syntax_error::~syntax_error () YY_NOEXCEPT YY_NOTHROW
636 ]b4_token_ctor_if([], [b4_public_types_define([cc
])])[
639 ]b4_parser_class
[::by_state::by_state () YY_NOEXCEPT
640 : state (empty_state
)
643 ]b4_parser_class
[::by_state::by_state (const by_state
& that
) YY_NOEXCEPT
648 ]b4_parser_class
[::by_state::clear () YY_NOEXCEPT
654 ]b4_parser_class
[::by_state::move (by_state
& that
)
660 ]b4_parser_class
[::by_state::by_state (state_type s
) YY_NOEXCEPT
664 ]b4_parser_class
[::symbol_kind_type
665 ]b4_parser_class
[::by_state::kind () const YY_NOEXCEPT
667 if (state
== empty_state
)
668 return ]b4_symbol(-2, kind
)[;
670 return YY_CAST (symbol_kind_type
, yystos_
[+state
]);
673 ]b4_parser_class
[::stack_symbol_type::stack_symbol_type ()
676 ]b4_parser_class
[::stack_symbol_type::stack_symbol_type (YY_RVREF (stack_symbol_type
) that
)
677 : super_type (YY_MOVE (that
.state
)]b4_variant_if([], [, YY_MOVE (that
.value
)])b4_locations_if([, YY_MOVE (that
.location
)])[)
679 b4_symbol_variant([that
.kind ()],
680 [value
], [YY_MOVE_OR_COPY
], [YY_MOVE (that
.value
)])])[
681 #if 201103L <= YY_CPLUSPLUS
683 that
.state
= empty_state
;
687 ]b4_parser_class
[::stack_symbol_type::stack_symbol_type (state_type s
, YY_MOVE_REF (symbol_type
) that
)
688 : super_type (s
]b4_variant_if([], [, YY_MOVE (that
.value
)])[]b4_locations_if([, YY_MOVE (that
.location
)])[)
690 b4_symbol_variant([that
.kind ()],
691 [value
], [move
], [YY_MOVE (that
.value
)])])[
693 that
.kind_
= ]b4_symbol(-2, kind
)[;
696 #if YY_CPLUSPLUS < 201103L
697 ]b4_parser_class
[::stack_symbol_type
&
698 ]b4_parser_class
[::stack_symbol_type::operator= (const stack_symbol_type
& that
)
701 ]b4_variant_if([b4_symbol_variant([that
.kind ()],
702 [value
], [copy
], [that
.value
])],
703 [[value
= that
.value
;]])[]b4_locations_if([
704 location
= that
.location
;])[
708 ]b4_parser_class
[::stack_symbol_type
&
709 ]b4_parser_class
[::stack_symbol_type::operator= (stack_symbol_type
& that
)
712 ]b4_variant_if([b4_symbol_variant([that
.kind ()],
713 [value
], [move
], [that
.value
])],
714 [[value
= that
.value
;]])[]b4_locations_if([
715 location
= that
.location
;])[
717 that
.state
= empty_state
;
722 template <typename Base
>
724 ]b4_parser_class
[::yy_destroy_ (const char* yymsg
, basic_symbol
<Base
>& yysym
) const
727 YY_SYMBOL_PRINT (yymsg
, yysym
);]b4_variant_if([], [
730 b4_symbol_actions([destructor
], [yysym
.kind ()])])[
733 #if ]b4_api_PREFIX[DEBUG
734 template <typename Base
>
736 ]b4_parser_class
[::yy_print_ (std::ostream
& yyo
, const basic_symbol
<Base
>& yysym
) const
738 std::ostream
& yyoutput
= yyo
;
741 yyo
<< "empty symbol";
744 symbol_kind_type yykind
= yysym
.kind ();
745 yyo
<< (yykind
< YYNTOKENS
? "token" : "nterm")
746 << ' ' << yysym
.name () << " ("]b4_locations_if([
747 << yysym
.location
<< ": "])[;
748 ]b4_symbol_actions([printer
])[
755 ]b4_parser_class
[::yypush_ (const char* m
, YY_MOVE_REF (stack_symbol_type
) sym
)
758 YY_SYMBOL_PRINT (m
, sym
);
759 yystack_
.push (YY_MOVE (sym
));
763 ]b4_parser_class
[::yypush_ (const char* m
, state_type s
, YY_MOVE_REF (symbol_type
) sym
)
765 #if 201103L <= YY_CPLUSPLUS
766 yypush_ (m
, stack_symbol_type (s
, std::move (sym
)));
768 stack_symbol_type
ss (s
, sym
);
774 ]b4_parser_class
[::yypop_ (int n
)
779 #if ]b4_api_PREFIX[DEBUG
781 ]b4_parser_class
[::debug_stream () const
787 ]b4_parser_class
[::set_debug_stream (std::ostream
& o
)
793 ]b4_parser_class
[::debug_level_type
794 ]b4_parser_class
[::debug_level () const
800 ]b4_parser_class
[::set_debug_level (debug_level_type l
)
804 #endif // ]b4_api_PREFIX[DEBUG
806 ]b4_parser_class
[::state_type
807 ]b4_parser_class
[::yy_lr_goto_state_ (state_type yystate
, int yysym
)
809 int yyr
= yypgoto_
[yysym
- YYNTOKENS
] + yystate
;
810 if (0 <= yyr
&& yyr
<= yylast_
&& yycheck_
[yyr
] == yystate
)
811 return yytable_
[yyr
];
813 return yydefgoto_
[yysym
- YYNTOKENS
];
817 ]b4_parser_class
[::yy_pact_value_is_default_ (int yyvalue
)
819 return yyvalue
== yypact_ninf_
;
823 ]b4_parser_class
[::yy_table_value_is_error_ (int yyvalue
)
825 return yyvalue
== yytable_ninf_
;
829 ]b4_parser_class
[::operator() ()
835 ]b4_parser_class
[::parse ()
838 /// Length of the RHS of the rule being reduced.
843 int yyerrstatus_
= 0;
845 /// The lookahead symbol.
846 symbol_type yyla
;]b4_locations_if([[
848 /// The locations where the error started and ended.
849 stack_symbol_type yyerror_range
[3];]])[
851 /// The return value of parse ().
852 int yyresult
;]b4_lac_if([[
854 /// Discard the LAC context in case there still is one left from a
855 /// previous invocation.
856 yy_lac_discard_ ("init");]])[
860 #endif // YY_EXCEPTIONS
862 YYCDEBUG
<< "Starting parse\n";
864 ]m4_ifdef([b4_initial_action
], [
865 b4_dollar_pushdef([yyla
.value
], [], [], [yyla
.location
])dnl
866 b4_user_initial_action
867 b4_dollar_popdef
])[]dnl
869 [ /* Initialize the stack. The initial state will be set in
870 yynewstate, since the latter expects the semantical and the
871 location values to have been already stored, initialize these
872 stacks with a primary value. */
874 yypush_ (YY_NULLPTR
, 0, YY_MOVE (yyla
));
876 /*-----------------------------------------------.
877 | yynewstate -- push a new symbol on the stack. |
878 `-----------------------------------------------*/
880 YYCDEBUG
<< "Entering state " << int (yystack_
[0].state
) << '\n';
884 if (yystack_
[0].state
== yyfinal_
)
894 // Try to take a decision without lookahead.
895 yyn
= yypact_
[+yystack_
[0].state
];
896 if (yy_pact_value_is_default_ (yyn
))
899 // Read a lookahead token.
902 YYCDEBUG
<< "Reading a token\n";
905 #endif // YY_EXCEPTIONS
906 {]b4_token_ctor_if([[
907 symbol_type
yylookahead (]b4_lex
[);
908 yyla
.move (yylookahead
);]], [[
909 yyla
.kind_
= yytranslate_ (]b4_lex
[);]])[
912 catch (const syntax_error
& yyexc
)
914 YYCDEBUG
<< "Caught exception: " << yyexc
.what() << '\n';
918 #endif // YY_EXCEPTIONS
920 YY_SYMBOL_PRINT ("Next token is", yyla
);
922 if (yyla
.kind () == ]b4_symbol(1, kind
)[)
924 // The scanner already issued an error message, process directly
925 // to error recovery. But do not keep the error token as
926 // lookahead, it is too special and may lead us to an endless
927 // loop in error recovery. */
928 yyla
.kind_
= ]b4_symbol(2, kind
)[;
932 /* If the proper action on seeing token YYLA.TYPE is to reduce or
933 to detect an error, take that action. */
935 if (yyn
< 0 || yylast_
< yyn
|| yycheck_
[yyn
] != yyla
.kind ())
937 if (!yy_lac_establish_ (yyla
.kind ()))
946 if (yy_table_value_is_error_ (yyn
))
947 goto yyerrlab
;]b4_lac_if([[
948 if (!yy_lac_establish_ (yyla
.kind ()))
955 // Count tokens shifted since error; after three, turn off error status.
959 // Shift the lookahead token.
960 yypush_ ("Shifting", state_type (yyn
), YY_MOVE (yyla
));]b4_lac_if([[
961 yy_lac_discard_ ("shift");]])[
965 /*-----------------------------------------------------------.
966 | yydefault -- do the default action for the current state. |
967 `-----------------------------------------------------------*/
969 yyn
= yydefact_
[+yystack_
[0].state
];
975 /*-----------------------------.
976 | yyreduce -- do a reduction. |
977 `-----------------------------*/
981 stack_symbol_type yylhs
;
982 yylhs
.state
= yy_lr_goto_state_ (yystack_
[yylen
].state
, yyr1_
[yyn
]);]b4_variant_if([
983 /* Variants are always initialized to an empty instance of the
984 correct type. The default '$$ = $1' action is NOT applied
985 when using variants. */
986 b4_symbol_variant([[yyr1_@
{yyn@
}]], [yylhs
.value
], [emplace
])], [
987 /* If YYLEN is nonzero, implement the default value of the
988 action: '$$ = $1'. Otherwise, use the top of the stack.
990 Otherwise, the following line sets YYLHS.VALUE to garbage.
991 This behavior is undocumented and Bison users should not rely
994 yylhs
.value
= yystack_@
{yylen
- 1@
}.value
;
996 yylhs
.value
= yystack_@
{0@
}.value
;])[
997 ]b4_locations_if([dnl
1001 stack_type::slice
range (yystack_
, yylen
);
1002 YYLLOC_DEFAULT (yylhs
.location
, range
, yylen
);
1003 yyerror_range
[1].location
= yylhs
.location
;
1006 // Perform the reduction.
1007 YY_REDUCE_PRINT (yyn
);
1010 #endif // YY_EXCEPTIONS
1020 catch (const syntax_error
& yyexc
)
1022 YYCDEBUG
<< "Caught exception: " << yyexc
.what() << '\n';
1026 #endif // YY_EXCEPTIONS
1027 YY_SYMBOL_PRINT ("-> $$ =", yylhs
);
1031 // Shift the result of the reduction.
1032 yypush_ (YY_NULLPTR
, YY_MOVE (yylhs
));
1037 /*--------------------------------------.
1038 | yyerrlab -- here on detecting error. |
1039 `--------------------------------------*/
1041 // If not already recovering from an error, report this error.
1044 ++yynerrs_
;]b4_parse_error_case(
1046 std::string msg
= YY_("syntax error");
1047 error (]b4_join(b4_locations_if([yyla
.location
]), [[YY_MOVE (msg
)]])[);]],
1049 context
yyctx (*this, yyla
);
1050 report_syntax_error (yyctx
);]],
1052 context
yyctx (*this, yyla
);
1053 std::string msg
= yysyntax_error_ (yyctx
);
1054 error (]b4_join(b4_locations_if([yyla
.location
]), [[YY_MOVE (msg
)]])[);]])[
1058 yyerror_range
[1].location
= yyla
.location
;]])[
1059 if (yyerrstatus_
== 3)
1061 /* If just tried and failed to reuse lookahead token after an
1062 error, discard it. */
1064 // Return failure if at end of input.
1065 if (yyla
.kind () == ]b4_symbol(0, kind
)[)
1067 else if (!yyla
.empty ())
1069 yy_destroy_ ("Error: discarding", yyla
);
1074 // Else will try to reuse lookahead token after shifting the error token.
1078 /*---------------------------------------------------.
1079 | yyerrorlab -- error raised explicitly by YYERROR. |
1080 `---------------------------------------------------*/
1082 /* Pacify compilers when the user code never invokes YYERROR and
1083 the label yyerrorlab therefore never appears in user code. */
1087 /* Do not reclaim the symbols of the rule whose action triggered
1095 /*-------------------------------------------------------------.
1096 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1097 `-------------------------------------------------------------*/
1099 yyerrstatus_
= 3; // Each real token shifted decrements this.
1100 // Pop stack until we find a state that shifts the error token.
1103 yyn
= yypact_
[+yystack_
[0].state
];
1104 if (!yy_pact_value_is_default_ (yyn
))
1106 yyn
+= ]b4_symbol(1, kind
)[;
1107 if (0 <= yyn
&& yyn
<= yylast_
1108 && yycheck_
[yyn
] == ]b4_symbol(1, kind
)[)
1110 yyn
= yytable_
[yyn
];
1116 // Pop the current state because it cannot handle the error token.
1117 if (yystack_
.size () == 1)
1120 yyerror_range
[1].location
= yystack_
[0].location
;]])[
1121 yy_destroy_ ("Error: popping", yystack_
[0]);
1126 stack_symbol_type error_token
;
1128 yyerror_range
[2].location
= yyla
.location
;
1129 YYLLOC_DEFAULT (error_token
.location
, yyerror_range
, 2);]])[
1131 // Shift the error token.]b4_lac_if([[
1132 yy_lac_discard_ ("error recovery");]])[
1133 error_token
.state
= state_type (yyn
);
1134 yypush_ ("Shifting", YY_MOVE (error_token
));
1139 /*-------------------------------------.
1140 | yyacceptlab -- YYACCEPT comes here. |
1141 `-------------------------------------*/
1147 /*-----------------------------------.
1148 | yyabortlab -- YYABORT comes here. |
1149 `-----------------------------------*/
1155 /*-----------------------------------------------------.
1156 | yyreturn -- parsing is finished, return the result. |
1157 `-----------------------------------------------------*/
1160 yy_destroy_ ("Cleanup: discarding lookahead", yyla
);
1162 /* Do not reclaim the symbols of the rule whose action triggered
1163 this YYABORT or YYACCEPT. */
1166 while (1 < yystack_
.size ())
1168 yy_destroy_ ("Cleanup: popping", yystack_
[0]);
1177 YYCDEBUG
<< "Exception caught: cleaning lookahead and stack\n";
1178 // Do not try to display the values of the reclaimed symbols,
1179 // as their printers might throw an exception.
1181 yy_destroy_ (YY_NULLPTR
, yyla
);
1183 while (1 < yystack_
.size ())
1185 yy_destroy_ (YY_NULLPTR
, yystack_
[0]);
1190 #endif // YY_EXCEPTIONS
1194 ]b4_parser_class
[::error (const syntax_error
& yyexc
)
1196 error (]b4_join(b4_locations_if([yyexc
.location
]),
1197 [[yyexc
.what ()]])[);
1200 ]b4_parse_error_bmatch([custom\
|detailed
],
1202 ]b4_parser_class
[::symbol_name (symbol_kind_type yysymbol
)
1204 static const char *const yy_sname
[] =
1207 };]b4_has_translations_if([[
1208 /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
1209 internationalizable. */
1210 static ]b4_int_type_for([b4_translatable
])[ yytranslatable
[] =
1214 return (yysymbol
< YYNTOKENS
&& yytranslatable
[yysymbol
]
1215 ? _(yy_sname
[yysymbol
])
1216 : yy_sname
[yysymbol
]);]], [[
1217 return yy_sname
[yysymbol
];]])[
1221 [[#if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
1223 ]b4_parser_class
[::symbol_name (symbol_kind_type yysymbol
)
1225 return yytname_
[yysymbol
];
1227 #endif // #if ]b4_api_PREFIX[DEBUG || ]b4_token_table_flag[
1230 [[ /* Return YYSTR after stripping away unnecessary quotes and
1231 backslashes, so that it's suitable for yyerror. The heuristic is
1232 that double-quoting is unnecessary unless the string contains an
1233 apostrophe, a comma, or backslash (other than backslash-backslash).
1234 YYSTR is taken from yytname. */
1236 ]b4_parser_class
[::yytnamerr_ (const char *yystr
)
1241 char const *yyp
= yystr
;
1248 goto do_not_strip_quotes
;
1252 goto do_not_strip_quotes
;
1264 do_not_strip_quotes
: ;
1271 ]b4_parser_class
[::symbol_name (symbol_kind_type yysymbol
)
1273 return yytnamerr_ (yytname_
[yysymbol
]);
1277 ]b4_parse_error_bmatch([custom\
|detailed\
|verbose
], [[
1278 // ]b4_parser_class[::context.
1279 ]b4_parser_class
[::context::context (const ]b4_parser_class
[& yyparser
, const symbol_type
& yyla
)
1280 : yyparser_ (yyparser
)
1285 ]b4_parser_class
[::context::expected_tokens (symbol_kind_type yyarg
[], int yyargn
) const
1287 // Actual number of expected tokens
1290 #if ]b4_api_PREFIX[DEBUG
1291 // Execute LAC once. We don't care if it is successful, we
1292 // only do it for the sake of debugging output.
1293 if (!yyparser_
.yy_lac_established_
)
1294 yyparser_
.yy_lac_check_ (yyla_
.kind ());
1297 for (int yyx
= 0; yyx
< YYNTOKENS
; ++yyx
)
1299 symbol_kind_type yysym
= YY_CAST (symbol_kind_type
, yyx
);
1300 if (yysym
!= ]b4_symbol(1, kind
)[
1301 && yysym
!= ]b4_symbol(2, kind
)[
1302 && yyparser_
.yy_lac_check_ (yysym
))
1306 else if (yycount
== yyargn
)
1309 yyarg
[yycount
++] = yysym
;
1312 int yyn
= yypact_
[+yyparser_
.yystack_
[0].state
];
1313 if (!yy_pact_value_is_default_ (yyn
))
1315 /* Start YYX at -YYN if negative to avoid negative indexes in
1316 YYCHECK. In other words, skip the first -YYN actions for
1317 this state because they are default actions. */
1318 int yyxbegin
= yyn
< 0 ? -yyn
: 0;
1319 // Stay within bounds of both yycheck and yytname.
1320 int yychecklim
= yylast_
- yyn
+ 1;
1321 int yyxend
= yychecklim
< YYNTOKENS
? yychecklim
: YYNTOKENS
;
1322 for (int yyx
= yyxbegin
; yyx
< yyxend
; ++yyx
)
1323 if (yycheck_
[yyx
+ yyn
] == yyx
&& yyx
!= ]b4_symbol(1, kind
)[
1324 && !yy_table_value_is_error_ (yytable_
[yyx
+ yyn
]))
1328 else if (yycount
== yyargn
)
1331 yyarg
[yycount
++] = YY_CAST (symbol_kind_type
, yyx
);
1335 if (yyarg
&& yycount
== 0 && 0 < yyargn
)
1336 yyarg
[0] = ]b4_symbol(-2, kind
)[;
1342 ]b4_parser_class
[::yy_lac_check_ (symbol_kind_type yytoken
) const
1344 // Logically, the yylac_stack's lifetime is confined to this function.
1345 // Clear it, to get rid of potential left-overs from previous call.
1346 yylac_stack_
.clear ();
1347 // Reduce until we encounter a shift and thereby accept the token.
1348 #if ]b4_api_PREFIX[DEBUG
1349 YYCDEBUG
<< "LAC: checking lookahead " << symbol_name (yytoken
) << ':';
1351 std::ptrdiff_t lac_top
= 0;
1354 state_type top_state
= (yylac_stack_
.empty ()
1355 ? yystack_
[lac_top
].state
1356 : yylac_stack_
.back ());
1357 int yyrule
= yypact_
[+top_state
];
1358 if (yy_pact_value_is_default_ (yyrule
)
1359 || (yyrule
+= yytoken
) < 0 || yylast_
< yyrule
1360 || yycheck_
[yyrule
] != yytoken
)
1362 // Use the default action.
1363 yyrule
= yydefact_
[+top_state
];
1366 YYCDEBUG
<< " Err\n";
1372 // Use the action from yytable.
1373 yyrule
= yytable_
[yyrule
];
1374 if (yy_table_value_is_error_ (yyrule
))
1376 YYCDEBUG
<< " Err\n";
1381 YYCDEBUG
<< " S" << yyrule
<< '\n';
1386 // By now we know we have to simulate a reduce.
1387 YYCDEBUG
<< " R" << yyrule
- 1;
1388 // Pop the corresponding number of values from the stack.
1390 std::ptrdiff_t yylen
= yyr2_
[yyrule
];
1391 // First pop from the LAC stack as many tokens as possible.
1392 std::ptrdiff_t lac_size
= std::ptrdiff_t (yylac_stack_
.size ());
1393 if (yylen
< lac_size
)
1395 yylac_stack_
.resize (std::size_t (lac_size
- yylen
));
1400 yylac_stack_
.clear ();
1403 // Only afterwards look at the main stack.
1404 // We simulate popping elements by incrementing lac_top.
1407 // Keep top_state in sync with the updated stack.
1408 top_state
= (yylac_stack_
.empty ()
1409 ? yystack_
[lac_top
].state
1410 : yylac_stack_
.back ());
1411 // Push the resulting state of the reduction.
1412 state_type state
= yy_lr_goto_state_ (top_state
, yyr1_
[yyrule
]);
1413 YYCDEBUG
<< " G" << int (state
);
1414 yylac_stack_
.push_back (state
);
1418 // Establish the initial context if no initial context currently exists.
1420 ]b4_parser_class
[::yy_lac_establish_ (symbol_kind_type yytoken
)
1422 /* Establish the initial context for the current lookahead if no initial
1423 context is currently established.
1425 We define a context as a snapshot of the parser stacks. We define
1426 the initial context for a lookahead as the context in which the
1427 parser initially examines that lookahead in order to select a
1428 syntactic action. Thus, if the lookahead eventually proves
1429 syntactically unacceptable (possibly in a later context reached via a
1430 series of reductions), the initial context can be used to determine
1431 the exact set of tokens that would be syntactically acceptable in the
1432 lookahead's place. Moreover, it is the context after which any
1433 further semantic actions would be erroneous because they would be
1434 determined by a syntactically unacceptable token.
1436 yy_lac_establish_ should be invoked when a reduction is about to be
1437 performed in an inconsistent state (which, for the purposes of LAC,
1438 includes consistent states that don't know they're consistent because
1439 their default reductions have been disabled).
1441 For parse.lac=full, the implementation of yy_lac_establish_ is as
1442 follows. If no initial context is currently established for the
1443 current lookahead, then check if that lookahead can eventually be
1444 shifted if syntactic actions continue from the current context. */
1445 if (!yy_lac_established_
)
1447 #if ]b4_api_PREFIX[DEBUG
1448 YYCDEBUG
<< "LAC: initial context established for "
1449 << symbol_name (yytoken
) << '\n';
1451 yy_lac_established_
= true;
1452 return yy_lac_check_ (yytoken
);
1457 // Discard any previous initial lookahead context.
1459 ]b4_parser_class
[::yy_lac_discard_ (const char* evt
)
1461 /* Discard any previous initial lookahead context because of Event,
1462 which may be a lookahead change or an invalidation of the currently
1463 established initial context for the current lookahead.
1465 The most common example of a lookahead change is a shift. An example
1466 of both cases is syntax error recovery. That is, a syntax error
1467 occurs when the lookahead is syntactically erroneous for the
1468 currently established initial context, so error recovery manipulates
1469 the parser stacks to try to find a new initial context in which the
1470 current lookahead is syntactically acceptable. If it fails to find
1471 such a context, it discards the lookahead. */
1472 if (yy_lac_established_
)
1474 YYCDEBUG
<< "LAC: initial context discarded due to "
1476 yy_lac_established_
= false;
1478 }]])b4_parse_error_bmatch([detailed\
|verbose
], [[
1481 ]b4_parser_class
[::yy_syntax_error_arguments_ (const context
& yyctx
,
1482 symbol_kind_type yyarg
[], int yyargn
) const
1484 /* There are many possibilities here to consider:
1485 - If this state is a consistent state with a default action, then
1486 the only way this function was invoked is if the default action
1487 is an error action. In that case, don't check for expected
1488 tokens because there are none.
1489 - The only way there can be no lookahead present (in yyla) is
1490 if this state is a consistent state with a default action.
1491 Thus, detecting the absence of a lookahead is sufficient to
1492 determine that there is no unexpected or expected token to
1493 report. In that case, just report a simple "syntax error".
1494 - Don't assume there isn't a lookahead just because this state is
1495 a consistent state with a default action. There might have
1496 been a previous inconsistent state, consistent state with a
1497 non-default action, or user semantic action that manipulated
1498 yyla. (However, yyla is currently not documented for users.)]b4_lac_if([[
1499 In the first two cases, it might appear that the current syntax
1500 error should have been detected in the previous state when
1501 yy_lac_check was invoked. However, at that time, there might
1502 have been a different syntax error that discarded a different
1503 initial context during error recovery, leaving behind the
1504 current lookahead.]], [[
1505 - Of course, the expected token list depends on states to have
1506 correct lookahead information, and it depends on the parser not
1507 to perform extra reductions after fetching a lookahead from the
1508 scanner and before detecting a syntax error. Thus, state merging
1509 (from LALR or IELR) and default reductions corrupt the expected
1510 token list. However, the list is correct for canonical LR with
1511 one exception: it will still contain any token that will not be
1512 accepted due to an error action in a later state.]])[
1515 if (!yyctx
.lookahead ().empty ())
1518 yyarg
[0] = yyctx
.token ();
1519 int yyn
= yyctx
.expected_tokens (yyarg
? yyarg
+ 1 : yyarg
, yyargn
- 1);
1525 // Generate an error message.
1527 ]b4_parser_class
[::yysyntax_error_ (const context
& yyctx
) const
1530 enum { YYARGS_MAX
= 5 };
1531 // Arguments of yyformat.
1532 symbol_kind_type yyarg
[YYARGS_MAX
];
1533 int yycount
= yy_syntax_error_arguments_ (yyctx
, yyarg
, YYARGS_MAX
);
1535 char const* yyformat
= YY_NULLPTR
;
1538 #define YYCASE_(N, S) \
1542 default: // Avoid compiler warnings.
1543 YYCASE_ (0, YY_("syntax error"));
1544 YYCASE_ (1, YY_("syntax error, unexpected %s"));
1545 YYCASE_ (2, YY_("syntax error, unexpected %s, expecting %s"));
1546 YYCASE_ (3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1547 YYCASE_ (4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1548 YYCASE_ (5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1554 std::ptrdiff_t yyi
= 0;
1555 for (char const* yyp
= yyformat
; *yyp
; ++yyp
)
1556 if (yyp
[0] == '%' && yyp
[1] == 's' && yyi
< yycount
)
1558 yyres
+= symbol_name (yyarg
[yyi
++]);
1567 const ]b4_int_type(b4_pact_ninf
, b4_pact_ninf
) b4_parser_class::yypact_ninf_
= b4_pact_ninf
[;
1569 const ]b4_int_type(b4_table_ninf
, b4_table_ninf
) b4_parser_class::yytable_ninf_
= b4_table_ninf
[;
1571 ]b4_parser_tables_define
[
1573 ]b4_parse_error_bmatch([simple\
|verbose
],
1574 [[#if ]b4_api_PREFIX[DEBUG]b4_tname_if([[ || 1]])[
1575 // YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1576 // First, the terminals, then, starting at \a YYNTOKENS, nonterminals.
1578 const ]b4_parser_class
[::yytname_
[] =
1585 #if ]b4_api_PREFIX[DEBUG][
1586 ]b4_integral_parser_table_define([rline
], [b4_rline
])[
1589 ]b4_parser_class
[::yy_stack_print_ () const
1591 *yycdebug_
<< "Stack now";
1592 for (stack_type::const_iterator
1593 i
= yystack_
.begin (),
1594 i_end
= yystack_
.end ();
1596 *yycdebug_
<< ' ' << int (i
->state
);
1601 ]b4_parser_class
[::yy_reduce_print_ (int yyrule
) const
1603 int yylno
= yyrline_
[yyrule
];
1604 int yynrhs
= yyr2_
[yyrule
];
1605 // Print the symbols being reduced, and their result.
1606 *yycdebug_
<< "Reducing stack by rule " << yyrule
- 1
1607 << " (line " << yylno
<< "):\n";
1608 // The symbols being reduced.
1609 for (int yyi
= 0; yyi
< yynrhs
; yyi
++)
1610 YY_SYMBOL_PRINT (" $" << yyi
+ 1 << " =",
1611 ]b4_rhs_data(yynrhs
, yyi
+ 1)[);
1613 #endif // ]b4_api_PREFIX[DEBUG
1615 ]b4_token_ctor_if([], [b4_yytranslate_define([cc
])])[
1616 ]b4_namespace_close
[
1621 m4_popdef([b4_copyright_years
])dnl