xref: /aosp_15_r20/external/angle/tools/flex-bison/third_party/skeletons/yacc.c (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 #                                                            -*- C -*-
2 # Yacc compatible skeleton for Bison
3 
4 # Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software
5 # Foundation, Inc.
6 
7 m4_pushdef([b4_copyright_years],
8            [1984, 1989-1990, 2000-2015, 2018-2021])
9 
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
22 
23 m4_include(b4_skeletonsdir/[c.m4])
24 
25 
26 ## ---------- ##
27 ## api.pure.  ##
28 ## ---------- ##
29 
30 b4_percent_define_default([[api.pure]], [[false]])
31 b4_percent_define_check_values([[[[api.pure]],
32                                  [[false]], [[true]], [[]], [[full]]]])
33 
34 m4_define([b4_pure_flag], [[0]])
35 m4_case(b4_percent_define_get([[api.pure]]),
36         [false], [m4_define([b4_pure_flag], [[0]])],
37         [true],  [m4_define([b4_pure_flag], [[1]])],
38         [],      [m4_define([b4_pure_flag], [[1]])],
39         [full],  [m4_define([b4_pure_flag], [[2]])])
40 
41 m4_define([b4_pure_if],
42 [m4_case(b4_pure_flag,
43          [0], [$2],
44          [1], [$1],
45          [2], [$1])])
46          [m4_fatal([invalid api.pure value: ]$1)])])
47 
48 ## --------------- ##
49 ## api.push-pull.  ##
50 ## --------------- ##
51 
52 # b4_pull_if, b4_push_if
53 # ----------------------
54 # Whether the pull/push APIs are needed.  Both can be enabled.
55 
56 b4_percent_define_default([[api.push-pull]], [[pull]])
57 b4_percent_define_check_values([[[[api.push-pull]],
58                                  [[pull]], [[push]], [[both]]]])
59 b4_define_flag_if([pull]) m4_define([b4_pull_flag], [[1]])
60 b4_define_flag_if([push]) m4_define([b4_push_flag], [[1]])
61 m4_case(b4_percent_define_get([[api.push-pull]]),
62         [pull], [m4_define([b4_push_flag], [[0]])],
63         [push], [m4_define([b4_pull_flag], [[0]])])
64 
65 # Handle BISON_USE_PUSH_FOR_PULL for the test suite.  So that push parsing
66 # tests function as written, do not let BISON_USE_PUSH_FOR_PULL modify the
67 # behavior of Bison at all when push parsing is already requested.
68 b4_define_flag_if([use_push_for_pull])
69 b4_use_push_for_pull_if([
70   b4_push_if([m4_define([b4_use_push_for_pull_flag], [[0]])],
71              [m4_define([b4_push_flag], [[1]])])])
72 
73 ## ----------- ##
74 ## parse.lac.  ##
75 ## ----------- ##
76 
77 b4_percent_define_default([[parse.lac]], [[none]])
78 b4_percent_define_default([[parse.lac.es-capacity-initial]], [[20]])
79 b4_percent_define_default([[parse.lac.memory-trace]], [[failures]])
80 b4_percent_define_check_values([[[[parse.lac]], [[full]], [[none]]]],
81                                [[[[parse.lac.memory-trace]],
82                                  [[failures]], [[full]]]])
83 b4_define_flag_if([lac])
84 m4_define([b4_lac_flag],
85           [m4_if(b4_percent_define_get([[parse.lac]]),
86                  [none], [[0]], [[1]])])
87 
88 ## ---------------- ##
89 ## Default values.  ##
90 ## ---------------- ##
91 
92 # Stack parameters.
93 m4_define_default([b4_stack_depth_max], [10000])
94 m4_define_default([b4_stack_depth_init],  [200])
95 
96 
97 # b4_yyerror_arg_loc_if(ARG)
98 # --------------------------
99 # Expand ARG iff yyerror is to be given a location as argument.
100 m4_define([b4_yyerror_arg_loc_if],
101 [b4_locations_if([m4_case(b4_pure_flag,
102                           [1], [m4_ifset([b4_parse_param], [$1])],
103                           [2], [$1])])])
104 
105 # b4_yyerror_formals
106 # ------------------
107 m4_define([b4_yyerror_formals],
108 [b4_pure_if([b4_locations_if([, [[const ]b4_api_PREFIX[LTYPE *yyllocp], [&yylloc]]])[]dnl
109 m4_ifdef([b4_parse_param], [, b4_parse_param])[]dnl
110 ,])dnl
111 [[const char *msg], [msg]]])
112 
113 
114 
115 # b4_yyerror_args
116 # ---------------
117 # Arguments passed to yyerror: user args plus yylloc.
118 m4_define([b4_yyerror_args],
119 [b4_yyerror_arg_loc_if([&yylloc, ])dnl
120 m4_ifset([b4_parse_param], [b4_args(b4_parse_param), ])])
121 
122 
123 
124 ## ----------------- ##
125 ## Semantic Values.  ##
126 ## ----------------- ##
127 
128 
129 # b4_accept([SYMBOL-NUM])
130 # -----------------------
131 # Used in actions of the rules of accept, the initial symbol, to call
132 # YYACCEPT.  If SYMBOL-NUM is specified, run "yyvalue->SLOT = $2;"
133 # before, using the slot of SYMBOL-NUM.
134 m4_define([b4_accept],
135 [m4_ifval([$1],
136           [b4_symbol_value(yyimpl->yyvalue, [$1]) = b4_rhs_value(2, 1, [$1]); ]) YYACCEPT])
137 
138 
139 # b4_lhs_value(SYMBOL-NUM, [TYPE])
140 # --------------------------------
141 # See README.
142 m4_define([b4_lhs_value],
143 [b4_symbol_value(yyval, [$1], [$2])])
144 
145 
146 # b4_rhs_value(RULE-LENGTH, POS, [SYMBOL-NUM], [TYPE])
147 # ----------------------------------------------------
148 # See README.
149 m4_define([b4_rhs_value],
150 [b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3], [$4])])
151 
152 
153 ## ----------- ##
154 ## Locations.  ##
155 ## ----------- ##
156 
157 # b4_lhs_location()
158 # -----------------
159 # Expansion of @$.
160 # Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
161 m4_define([b4_lhs_location],
162 [(yyloc)])
163 
164 
165 # b4_rhs_location(RULE-LENGTH, POS)
166 # ---------------------------------
167 # Expansion of @POS, where the current rule has RULE-LENGTH symbols
168 # on RHS.
169 # Overparenthetized to avoid obscure problems with "foo$$bar = foo$1bar".
170 m4_define([b4_rhs_location],
171 [(yylsp@{b4_subtract([$2], [$1])@})])
172 
173 
174 ## -------------- ##
175 ## Declarations.  ##
176 ## -------------- ##
177 
178 # _b4_declare_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
179 # ---------------------------------------------------------------------
180 # Define the return type of the parsing function for SYMBOL-NUM, and
181 # declare its parsing function.
182 m4_define([_b4_declare_sub_yyparse],
183 [[
184 // Return type when parsing one ]_b4_symbol($1, tag)[.
185 typedef struct
186 {]b4_symbol_if([$1], [has_type], [[
187   ]_b4_symbol($1, type)[ yyvalue;]])[
188   int yystatus;
189   int yynerrs;
190 } ]b4_prefix[parse_]_b4_symbol($1, id)[_t;
191 
192 // Parse one ]_b4_symbol($1, tag)[.
193 ]b4_prefix[parse_]_b4_symbol($1, id)[_t ]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
194 ]])
195 
196 
197 # _b4_first_switching_token
198 # -------------------------
199 m4_define([b4_first], [$1])
200 m4_define([b4_second], [$2])
201 m4_define([_b4_first_switching_token],
202 [b4_second(b4_first(b4_start_symbols))])
203 
204 
205 # _b4_define_sub_yyparse(START-SYMBOL-NUM, SWITCHING-TOKEN-SYMBOL-NUM)
206 # --------------------------------------------------------------------
207 # Define the parsing function for START-SYMBOL-NUM.
208 m4_define([_b4_define_sub_yyparse],
209 [[
210 ]b4_prefix[parse_]_b4_symbol($1, id)[_t
211 ]b4_prefix[parse_]_b4_symbol($1, id)[ (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
212 {
213   ]b4_prefix[parse_]_b4_symbol($1, id)[_t yyres;
214   yy_parse_impl_t yyimpl;
215   yyres.yystatus = yy_parse_impl (]b4_symbol($2, id)[, &yyimpl]m4_ifset([b4_parse_param],
216                            [[, ]b4_args(b4_parse_param)])[);]b4_symbol_if([$1], [has_type], [[
217   yyres.yyvalue = yyimpl.yyvalue.]b4_symbol($1, slot)[;]])[
218   yyres.yynerrs = yyimpl.yynerrs;
219   return yyres;
220 }
221 ]])
222 
223 
224 # b4_declare_scanner_communication_variables
225 # ------------------------------------------
226 # Declare the variables that are global, or local to YYPARSE if
227 # pure-parser.
228 m4_define([b4_declare_scanner_communication_variables], [[
229 ]m4_ifdef([b4_start_symbols], [],
230 [[/* Lookahead token kind.  */
231 int yychar;
232 ]])[
233 ]b4_pure_if([[
234 /* The semantic value of the lookahead symbol.  */
235 /* Default value used for initialization, for pacifying older GCCs
236    or non-GCC compilers.  */
237 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
238 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);]b4_locations_if([[
239 
240 /* Location data for the lookahead symbol.  */
241 static YYLTYPE yyloc_default]b4_yyloc_default[;
242 YYLTYPE yylloc = yyloc_default;]])],
243 [[/* The semantic value of the lookahead symbol.  */
244 YYSTYPE yylval;]b4_locations_if([[
245 /* Location data for the lookahead symbol.  */
246 YYLTYPE yylloc]b4_yyloc_default[;]])[
247 /* Number of syntax errors so far.  */
248 int yynerrs;]])])
249 
250 
251 # b4_declare_parser_state_variables([INIT])
252 # -----------------------------------------
253 # Declare all the variables that are needed to maintain the parser state
254 # between calls to yypush_parse.
255 # If INIT is non-null, initialize these variables.
256 m4_define([b4_declare_parser_state_variables],
257 [b4_pure_if([[
258     /* Number of syntax errors so far.  */
259     int yynerrs]m4_ifval([$1], [ = 0])[;
260 ]])[
261     yy_state_fast_t yystate]m4_ifval([$1], [ = 0])[;
262     /* Number of tokens to shift before error messages enabled.  */
263     int yyerrstatus]m4_ifval([$1], [ = 0])[;
264 
265     /* Refer to the stacks through separate pointers, to allow yyoverflow
266        to reallocate them elsewhere.  */
267 
268     /* Their size.  */
269     YYPTRDIFF_T yystacksize]m4_ifval([$1], [ = YYINITDEPTH])[;
270 
271     /* The state stack: array, bottom, top.  */
272     yy_state_t yyssa[YYINITDEPTH];
273     yy_state_t *yyss]m4_ifval([$1], [ = yyssa])[;
274     yy_state_t *yyssp]m4_ifval([$1], [ = yyss])[;
275 
276     /* The semantic value stack: array, bottom, top.  */
277     YYSTYPE yyvsa[YYINITDEPTH];
278     YYSTYPE *yyvs]m4_ifval([$1], [ = yyvsa])[;
279     YYSTYPE *yyvsp]m4_ifval([$1], [ = yyvs])[;]b4_locations_if([[
280 
281     /* The location stack: array, bottom, top.  */
282     YYLTYPE yylsa[YYINITDEPTH];
283     YYLTYPE *yyls]m4_ifval([$1], [ = yylsa])[;
284     YYLTYPE *yylsp]m4_ifval([$1], [ = yyls])[;]])[]b4_lac_if([[
285 
286     yy_state_t yyesa@{]b4_percent_define_get([[parse.lac.es-capacity-initial]])[@};
287     yy_state_t *yyes]m4_ifval([$1], [ = yyesa])[;
288     YYPTRDIFF_T yyes_capacity][]m4_ifval([$1],
289             [m4_do([ = b4_percent_define_get([[parse.lac.es-capacity-initial]]) < YYMAXDEPTH],
290                    [ ? b4_percent_define_get([[parse.lac.es-capacity-initial]])],
291                    [ : YYMAXDEPTH])])[;]])])
292 
293 
294 m4_define([b4_macro_define],
295 [[#]define $1 $2])
296 
297 m4_define([b4_macro_undef],
298 [[#]undef $1])
299 
300 m4_define([b4_pstate_macro_define],
301 [b4_macro_define([$1], [yyps->$1])])
302 
303 # b4_parse_state_variable_macros(b4_macro_define|b4_macro_undef)
304 # --------------------------------------------------------------
305 m4_define([b4_parse_state_variable_macros],
306 [b4_pure_if([$1([b4_prefix[]nerrs])])
307 $1([yystate])
308 $1([yyerrstatus])
309 $1([yyssa])
310 $1([yyss])
311 $1([yyssp])
312 $1([yyvsa])
313 $1([yyvs])
314 $1([yyvsp])[]b4_locations_if([
315 $1([yylsa])
316 $1([yyls])
317 $1([yylsp])])
318 $1([yystacksize])[]b4_lac_if([
319 $1([yyesa])
320 $1([yyes])
321 $1([yyes_capacity])])])
322 
323 
324 
325 
326 # _b4_declare_yyparse_push
327 # ------------------------
328 # Declaration of yyparse (and dependencies) when using the push parser
329 # (including in pull mode).
330 m4_define([_b4_declare_yyparse_push],
331 [[#ifndef YYPUSH_MORE_DEFINED
332 # define YYPUSH_MORE_DEFINED
333 enum { YYPUSH_MORE = 4 };
334 #endif
335 
336 typedef struct ]b4_prefix[pstate ]b4_prefix[pstate;
337 
338 ]b4_pull_if([[
339 int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);]])[
340 int ]b4_prefix[push_parse (]b4_prefix[pstate *ps]b4_pure_if([[,
341                   int pushed_char, ]b4_api_PREFIX[STYPE const *pushed_val]b4_locations_if([[, ]b4_api_PREFIX[LTYPE *pushed_loc]])])b4_user_formals[);
342 ]b4_pull_if([[int ]b4_prefix[pull_parse (]b4_prefix[pstate *ps]b4_user_formals[);]])[
343 ]b4_prefix[pstate *]b4_prefix[pstate_new (void);
344 void ]b4_prefix[pstate_delete (]b4_prefix[pstate *ps);
345 ]])
346 
347 
348 # _b4_declare_yyparse
349 # -------------------
350 # When not the push parser.
351 m4_define([_b4_declare_yyparse],
352 [[int ]b4_prefix[parse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[);
353 ]m4_ifdef([b4_start_symbols],
354           [m4_map([_b4_declare_sub_yyparse], m4_defn([b4_start_symbols]))])])
355 
356 
357 # b4_declare_yyparse
358 # ------------------
359 m4_define([b4_declare_yyparse],
360 [b4_push_if([_b4_declare_yyparse_push],
361             [_b4_declare_yyparse])[]dnl
362 ])
363 
364 
365 # b4_declare_yyerror_and_yylex
366 # ----------------------------
367 # Comply with POSIX Yacc.
368 # <https://austingroupbugs.net/view.php?id=1388#c5220>
369 m4_define([b4_declare_yyerror_and_yylex],
370 [b4_posix_if([[#if !defined ]b4_prefix[error && !defined ]b4_api_PREFIX[ERROR_IS_DECLARED
371 ]b4_function_declare([b4_prefix[error]], void, b4_yyerror_formals)[
372 #endif
373 #if !defined ]b4_prefix[lex && !defined ]b4_api_PREFIX[LEX_IS_DECLARED
374 ]b4_function_declare([b4_prefix[lex]], int, b4_yylex_formals)[
375 #endif
376 ]])dnl
377 ])
378 
379 
380 # b4_shared_declarations
381 # ----------------------
382 # Declarations that might either go into the header (if --header)
383 # or into the implementation file.
384 m4_define([b4_shared_declarations],
385 [b4_cpp_guard_open([b4_spec_mapped_header_file])[
386 ]b4_declare_yydebug[
387 ]b4_percent_code_get([[requires]])[
388 ]b4_token_enums_defines[
389 ]b4_declare_yylstype[
390 ]b4_declare_yyerror_and_yylex[
391 ]b4_declare_yyparse[
392 ]b4_percent_code_get([[provides]])[
393 ]b4_cpp_guard_close([b4_spec_mapped_header_file])[]dnl
394 ])
395 
396 
397 # b4_header_include_if(IF-TRUE, IF-FALSE)
398 # ---------------------------------------
399 # Run IF-TRUE if we generate an output file and api.header.include
400 # is defined.
401 m4_define([b4_header_include_if],
402 [m4_ifval(m4_quote(b4_spec_header_file),
403           [b4_percent_define_ifdef([[api.header.include]],
404                                    [$1],
405                                    [$2])],
406           [$2])])
407 
408 m4_if(b4_spec_header_file, [y.tab.h], [],
409       [b4_percent_define_default([[api.header.include]],
410                                  [["@basename(]b4_spec_header_file[@)"]])])
411 
412 
413 
414 
415 ## -------------- ##
416 ## Output files.  ##
417 ## -------------- ##
418 
419 
420 b4_header_if([[
421 ]b4_output_begin([b4_spec_header_file])[
422 ]b4_copyright([Bison interface for Yacc-like parsers in C])[
423 ]b4_disclaimer[
424 ]b4_shared_declarations[
425 ]b4_output_end[
426 ]])# b4_header_if
427 
428 b4_output_begin([b4_parser_file_name])[
429 ]b4_copyright([Bison implementation for Yacc-like parsers in C])[
430 /* C LALR(1) parser skeleton written by Richard Stallman, by
431    simplifying the original so-called "semantic" parser.  */
432 
433 ]b4_disclaimer[
434 /* All symbols defined below should begin with yy or YY, to avoid
435    infringing on user name space.  This should be done even for local
436    variables, as they might otherwise be expanded by user macros.
437    There are some unavoidable exceptions within include files to
438    define necessary library symbols; they are noted "INFRINGES ON
439    USER NAME SPACE" below.  */
440 
441 ]b4_identification[
442 ]b4_percent_code_get([[top]])[]dnl
443 m4_if(b4_api_prefix, [yy], [],
444 [[/* Substitute the type names.  */
445 #define YYSTYPE         ]b4_api_PREFIX[STYPE]b4_locations_if([[
446 #define YYLTYPE         ]b4_api_PREFIX[LTYPE]])])[
447 ]m4_if(b4_prefix, [yy], [],
448 [[/* Substitute the variable and function names.  */]b4_pull_if([[
449 #define yyparse         ]b4_prefix[parse]])b4_push_if([[
450 #define yypush_parse    ]b4_prefix[push_parse]b4_pull_if([[
451 #define yypull_parse    ]b4_prefix[pull_parse]])[
452 #define yypstate_new    ]b4_prefix[pstate_new
453 #define yypstate_clear  ]b4_prefix[pstate_clear
454 #define yypstate_delete ]b4_prefix[pstate_delete
455 #define yypstate        ]b4_prefix[pstate]])[
456 #define yylex           ]b4_prefix[lex
457 #define yyerror         ]b4_prefix[error
458 #define yydebug         ]b4_prefix[debug
459 #define yynerrs         ]b4_prefix[nerrs]]b4_pure_if([], [[
460 #define yylval          ]b4_prefix[lval
461 #define yychar          ]b4_prefix[char]b4_locations_if([[
462 #define yylloc          ]b4_prefix[lloc]])]))[
463 
464 ]b4_user_pre_prologue[
465 ]b4_cast_define[
466 ]b4_null_define[
467 
468 ]b4_header_include_if([[#include ]b4_percent_define_get([[api.header.include]])],
469                       [m4_ifval(m4_quote(b4_spec_header_file),
470                                 [/* Use api.header.include to #include this header
471    instead of duplicating it here.  */
472 ])b4_shared_declarations])[
473 ]b4_declare_symbol_enum[
474 
475 ]b4_user_post_prologue[
476 ]b4_percent_code_get[
477 ]b4_c99_int_type_define[
478 
479 ]b4_sizes_types_define[
480 
481 /* Stored state numbers (used for stacks). */
482 typedef ]b4_int_type(0, m4_eval(b4_states_number - 1))[ yy_state_t;
483 
484 /* State numbers in computations.  */
485 typedef int yy_state_fast_t;
486 
487 #ifndef YY_
488 # if defined YYENABLE_NLS && YYENABLE_NLS
489 #  if ENABLE_NLS
490 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
491 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
492 #  endif
493 # endif
494 # ifndef YY_
495 #  define YY_(Msgid) Msgid
496 # endif
497 #endif
498 ]b4_has_translations_if([
499 #ifndef N_
500 # define N_(Msgid) Msgid
501 #endif
502 ])[
503 
504 ]b4_attribute_define[
505 
506 ]b4_parse_assert_if([[#ifdef NDEBUG
507 # define YY_ASSERT(E) ((void) (0 && (E)))
508 #else
509 # include <assert.h> /* INFRINGES ON USER NAME SPACE */
510 # define YY_ASSERT(E) assert (E)
511 #endif
512 ]],
513 [[#define YY_ASSERT(E) ((void) (0 && (E)))]])[
514 
515 #if ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[
516 
517 /* The parser invokes alloca or malloc; define the necessary symbols.  */]dnl
518 b4_push_if([], [b4_lac_if([], [[
519 
520 # ifdef YYSTACK_USE_ALLOCA
521 #  if YYSTACK_USE_ALLOCA
522 #   ifdef __GNUC__
523 #    define YYSTACK_ALLOC __builtin_alloca
524 #   elif defined __BUILTIN_VA_ARG_INCR
525 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
526 #   elif defined _AIX
527 #    define YYSTACK_ALLOC __alloca
528 #   elif defined _MSC_VER
529 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
530 #    define alloca _alloca
531 #   else
532 #    define YYSTACK_ALLOC alloca
533 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
534 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
535       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
536 #     ifndef EXIT_SUCCESS
537 #      define EXIT_SUCCESS 0
538 #     endif
539 #    endif
540 #   endif
541 #  endif
542 # endif]])])[
543 
544 # ifdef YYSTACK_ALLOC
545    /* Pacify GCC's 'empty if-body' warning.  */
546 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
547 #  ifndef YYSTACK_ALLOC_MAXIMUM
548     /* The OS might guarantee only one guard page at the bottom of the stack,
549        and a page size can be as small as 4096 bytes.  So we cannot safely
550        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
551        to allow for a few compiler-allocated temporary stack slots.  */
552 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
553 #  endif
554 # else
555 #  define YYSTACK_ALLOC YYMALLOC
556 #  define YYSTACK_FREE YYFREE
557 #  ifndef YYSTACK_ALLOC_MAXIMUM
558 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
559 #  endif
560 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
561        && ! ((defined YYMALLOC || defined malloc) \
562              && (defined YYFREE || defined free)))
563 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
564 #   ifndef EXIT_SUCCESS
565 #    define EXIT_SUCCESS 0
566 #   endif
567 #  endif
568 #  ifndef YYMALLOC
569 #   define YYMALLOC malloc
570 #   if ! defined malloc && ! defined EXIT_SUCCESS
571 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
572 #   endif
573 #  endif
574 #  ifndef YYFREE
575 #   define YYFREE free
576 #   if ! defined free && ! defined EXIT_SUCCESS
577 void free (void *); /* INFRINGES ON USER NAME SPACE */
578 #   endif
579 #  endif
580 # endif]b4_lac_if([[
581 # define YYCOPY_NEEDED 1]])[
582 #endif /* ]b4_lac_if([[1]], [b4_parse_error_case([simple], [[!defined yyoverflow]], [[1]])])[ */
583 
584 #if (! defined yyoverflow \
585      && (! defined __cplusplus \
586          || (]b4_locations_if([[defined ]b4_api_PREFIX[LTYPE_IS_TRIVIAL && ]b4_api_PREFIX[LTYPE_IS_TRIVIAL \
587              && ]])[defined ]b4_api_PREFIX[STYPE_IS_TRIVIAL && ]b4_api_PREFIX[STYPE_IS_TRIVIAL)))
588 
589 /* A type that is properly aligned for any stack member.  */
590 union yyalloc
591 {
592   yy_state_t yyss_alloc;
593   YYSTYPE yyvs_alloc;]b4_locations_if([
594   YYLTYPE yyls_alloc;])[
595 };
596 
597 /* The size of the maximum gap between one aligned stack and the next.  */
598 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
599 
600 /* The size of an array large to enough to hold all stacks, each with
601    N elements.  */
602 ]b4_locations_if(
603 [# define YYSTACK_BYTES(N) \
604      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
605              + YYSIZEOF (YYLTYPE)) \
606       + 2 * YYSTACK_GAP_MAXIMUM)],
607 [# define YYSTACK_BYTES(N) \
608      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
609       + YYSTACK_GAP_MAXIMUM)])[
610 
611 # define YYCOPY_NEEDED 1
612 
613 /* Relocate STACK from its old location to the new one.  The
614    local variables YYSIZE and YYSTACKSIZE give the old and new number of
615    elements in the stack, and YYPTR gives the new location of the
616    stack.  Advance YYPTR to a properly aligned location for the next
617    stack.  */
618 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
619     do                                                                  \
620       {                                                                 \
621         YYPTRDIFF_T yynewbytes;                                         \
622         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
623         Stack = &yyptr->Stack_alloc;                                    \
624         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
625         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
626       }                                                                 \
627     while (0)
628 
629 #endif
630 
631 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
632 /* Copy COUNT objects from SRC to DST.  The source and destination do
633    not overlap.  */
634 # ifndef YYCOPY
635 #  if defined __GNUC__ && 1 < __GNUC__
636 #   define YYCOPY(Dst, Src, Count) \
637       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
638 #  else
639 #   define YYCOPY(Dst, Src, Count)              \
640       do                                        \
641         {                                       \
642           YYPTRDIFF_T yyi;                      \
643           for (yyi = 0; yyi < (Count); yyi++)   \
644             (Dst)[yyi] = (Src)[yyi];            \
645         }                                       \
646       while (0)
647 #  endif
648 # endif
649 #endif /* !YYCOPY_NEEDED */
650 
651 /* YYFINAL -- State number of the termination state.  */
652 #define YYFINAL  ]b4_final_state_number[
653 /* YYLAST -- Last index in YYTABLE.  */
654 #define YYLAST   ]b4_last[
655 
656 /* YYNTOKENS -- Number of terminals.  */
657 #define YYNTOKENS  ]b4_tokens_number[
658 /* YYNNTS -- Number of nonterminals.  */
659 #define YYNNTS  ]b4_nterms_number[
660 /* YYNRULES -- Number of rules.  */
661 #define YYNRULES  ]b4_rules_number[
662 /* YYNSTATES -- Number of states.  */
663 #define YYNSTATES  ]b4_states_number[
664 
665 /* YYMAXUTOK -- Last valid token kind.  */
666 #define YYMAXUTOK   ]b4_code_max[
667 
668 
669 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
670    as returned by yylex, with out-of-bounds checking.  */
671 ]b4_api_token_raw_if(dnl
672 [[#define YYTRANSLATE(YYX) YY_CAST (yysymbol_kind_t, YYX)]],
673 [[#define YYTRANSLATE(YYX)                                \
674   (0 <= (YYX) && (YYX) <= YYMAXUTOK                     \
675    ? YY_CAST (yysymbol_kind_t, yytranslate[YYX])        \
676    : ]b4_symbol_prefix[YYUNDEF)
677 
678 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
679    as returned by yylex.  */
680 static const ]b4_int_type_for([b4_translate])[ yytranslate[] =
681 {
682   ]b4_translate[
683 };]])[
684 
685 #if ]b4_api_PREFIX[DEBUG
686 ]b4_integral_parser_table_define([rline], [b4_rline],
687      [[YYRLINE[YYN] -- Source line where rule number YYN was defined.]])[
688 #endif
689 
690 /** Accessing symbol of state STATE.  */
691 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
692 
693 #if ]b4_parse_error_case([simple], [b4_api_PREFIX[DEBUG || ]b4_token_table_flag], [[1]])[
694 /* The user-facing name of the symbol whose (internal) number is
695    YYSYMBOL.  No bounds checking.  */
696 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
697 
698 ]b4_parse_error_bmatch([simple\|verbose],
699 [[/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
700    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
701 static const char *const yytname[] =
702 {
703   ]b4_tname[
704 };
705 
706 static const char *
707 yysymbol_name (yysymbol_kind_t yysymbol)
708 {
709   return yytname[yysymbol];
710 }]],
711 [[static const char *
712 yysymbol_name (yysymbol_kind_t yysymbol)
713 {
714   static const char *const yy_sname[] =
715   {
716   ]b4_symbol_names[
717   };]b4_has_translations_if([[
718   /* YYTRANSLATABLE[SYMBOL-NUM] -- Whether YY_SNAME[SYMBOL-NUM] is
719      internationalizable.  */
720   static ]b4_int_type_for([b4_translatable])[ yytranslatable[] =
721   {
722   ]b4_translatable[
723   };
724   return (yysymbol < YYNTOKENS && yytranslatable[yysymbol]
725           ? _(yy_sname[yysymbol])
726           : yy_sname[yysymbol]);]], [[
727   return yy_sname[yysymbol];]])[
728 }]])[
729 #endif
730 
731 #define YYPACT_NINF (]b4_pact_ninf[)
732 
733 #define yypact_value_is_default(Yyn) \
734   ]b4_table_value_equals([[pact]], [[Yyn]], [b4_pact_ninf], [YYPACT_NINF])[
735 
736 #define YYTABLE_NINF (]b4_table_ninf[)
737 
738 #define yytable_value_is_error(Yyn) \
739   ]b4_table_value_equals([[table]], [[Yyn]], [b4_table_ninf], [YYTABLE_NINF])[
740 
741 ]b4_parser_tables_define[
742 
743 enum { YYENOMEM = -2 };
744 
745 #define yyerrok         (yyerrstatus = 0)
746 #define yyclearin       (yychar = ]b4_symbol(empty, id)[)
747 
748 #define YYACCEPT        goto yyacceptlab
749 #define YYABORT         goto yyabortlab
750 #define YYERROR         goto yyerrorlab
751 #define YYNOMEM         goto yyexhaustedlab
752 
753 
754 #define YYRECOVERING()  (!!yyerrstatus)
755 
756 #define YYBACKUP(Token, Value)                                    \
757   do                                                              \
758     if (yychar == ]b4_symbol(empty, id)[)                                        \
759       {                                                           \
760         yychar = (Token);                                         \
761         yylval = (Value);                                         \
762         YYPOPSTACK (yylen);                                       \
763         yystate = *yyssp;                                         \]b4_lac_if([[
764         YY_LAC_DISCARD ("YYBACKUP");                              \]])[
765         goto yybackup;                                            \
766       }                                                           \
767     else                                                          \
768       {                                                           \
769         yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
770         YYERROR;                                                  \
771       }                                                           \
772   while (0)
773 
774 /* Backward compatibility with an undocumented macro.
775    Use ]b4_symbol(error, id)[ or ]b4_symbol(undef, id)[. */
776 #define YYERRCODE ]b4_symbol(undef, id)[
777 ]b4_locations_if([[
778 ]b4_yylloc_default_define[
779 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
780 ]])[
781 
782 /* Enable debugging if requested.  */
783 #if ]b4_api_PREFIX[DEBUG
784 
785 # ifndef YYFPRINTF
786 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
787 #  define YYFPRINTF fprintf
788 # endif
789 
790 # define YYDPRINTF(Args)                        \
791 do {                                            \
792   if (yydebug)                                  \
793     YYFPRINTF Args;                             \
794 } while (0)
795 
796 ]b4_yylocation_print_define[
797 
798 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)                    \
799 do {                                                                      \
800   if (yydebug)                                                            \
801     {                                                                     \
802       YYFPRINTF (stderr, "%s ", Title);                                   \
803       yy_symbol_print (stderr,                                            \
804                   Kind, Value]b4_locations_if([, Location])[]b4_user_args[); \
805       YYFPRINTF (stderr, "\n");                                           \
806     }                                                                     \
807 } while (0)
808 
809 ]b4_yy_symbol_print_define[
810 
811 /*------------------------------------------------------------------.
812 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
813 | TOP (included).                                                   |
814 `------------------------------------------------------------------*/
815 
816 static void
817 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
818 {
819   YYFPRINTF (stderr, "Stack now");
820   for (; yybottom <= yytop; yybottom++)
821     {
822       int yybot = *yybottom;
823       YYFPRINTF (stderr, " %d", yybot);
824     }
825   YYFPRINTF (stderr, "\n");
826 }
827 
828 # define YY_STACK_PRINT(Bottom, Top)                            \
829 do {                                                            \
830   if (yydebug)                                                  \
831     yy_stack_print ((Bottom), (Top));                           \
832 } while (0)
833 
834 
835 /*------------------------------------------------.
836 | Report that the YYRULE is going to be reduced.  |
837 `------------------------------------------------*/
838 
839 static void
840 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,]b4_locations_if([[ YYLTYPE *yylsp,]])[
841                  int yyrule]b4_user_formals[)
842 {
843   int yylno = yyrline[yyrule];
844   int yynrhs = yyr2[yyrule];
845   int yyi;
846   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
847              yyrule - 1, yylno);
848   /* The symbols being reduced.  */
849   for (yyi = 0; yyi < yynrhs; yyi++)
850     {
851       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
852       yy_symbol_print (stderr,
853                        YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
854                        &]b4_rhs_value(yynrhs, yyi + 1)[]b4_locations_if([,
855                        &]b4_rhs_location(yynrhs, yyi + 1))[]b4_user_args[);
856       YYFPRINTF (stderr, "\n");
857     }
858 }
859 
860 # define YY_REDUCE_PRINT(Rule)          \
861 do {                                    \
862   if (yydebug)                          \
863     yy_reduce_print (yyssp, yyvsp, ]b4_locations_if([yylsp, ])[Rule]b4_user_args[); \
864 } while (0)
865 
866 /* Nonzero means print parse trace.  It is left uninitialized so that
867    multiple parsers can coexist.  */
868 int yydebug;
869 #else /* !]b4_api_PREFIX[DEBUG */
870 # define YYDPRINTF(Args) ((void) 0)
871 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
872 # define YY_STACK_PRINT(Bottom, Top)
873 # define YY_REDUCE_PRINT(Rule)
874 #endif /* !]b4_api_PREFIX[DEBUG */
875 
876 
877 /* YYINITDEPTH -- initial size of the parser's stacks.  */
878 #ifndef YYINITDEPTH
879 # define YYINITDEPTH ]b4_stack_depth_init[
880 #endif
881 
882 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
883    if the built-in stack extension method is used).
884 
885    Do not make this value too large; the results are undefined if
886    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
887    evaluated with infinite-precision integer arithmetic.  */
888 
889 #ifndef YYMAXDEPTH
890 # define YYMAXDEPTH ]b4_stack_depth_max[
891 #endif]b4_push_if([[
892 /* Parser data structure.  */
893 struct yypstate
894   {]b4_declare_parser_state_variables[
895     /* Whether this instance has not started parsing yet.
896      * If 2, it corresponds to a finished parsing.  */
897     int yynew;
898   };]b4_pure_if([], [[
899 
900 /* Whether the only allowed instance of yypstate is allocated.  */
901 static char yypstate_allocated = 0;]])])[
902 ]b4_lac_if([[
903 
904 /* Given a state stack such that *YYBOTTOM is its bottom, such that
905    *YYTOP is either its top or is YYTOP_EMPTY to indicate an empty
906    stack, and such that *YYCAPACITY is the maximum number of elements it
907    can hold without a reallocation, make sure there is enough room to
908    store YYADD more elements.  If not, allocate a new stack using
909    YYSTACK_ALLOC, copy the existing elements, and adjust *YYBOTTOM,
910    *YYTOP, and *YYCAPACITY to reflect the new capacity and memory
911    location.  If *YYBOTTOM != YYBOTTOM_NO_FREE, then free the old stack
912    using YYSTACK_FREE.  Return 0 if successful or if no reallocation is
913    required.  Return YYENOMEM if memory is exhausted.  */
914 static int
915 yy_lac_stack_realloc (YYPTRDIFF_T *yycapacity, YYPTRDIFF_T yyadd,
916 #if ]b4_api_PREFIX[DEBUG
917                       char const *yydebug_prefix,
918                       char const *yydebug_suffix,
919 #endif
920                       yy_state_t **yybottom,
921                       yy_state_t *yybottom_no_free,
922                       yy_state_t **yytop, yy_state_t *yytop_empty)
923 {
924   YYPTRDIFF_T yysize_old =
925     *yytop == yytop_empty ? 0 : *yytop - *yybottom + 1;
926   YYPTRDIFF_T yysize_new = yysize_old + yyadd;
927   if (*yycapacity < yysize_new)
928     {
929       YYPTRDIFF_T yyalloc = 2 * yysize_new;
930       yy_state_t *yybottom_new;
931       /* Use YYMAXDEPTH for maximum stack size given that the stack
932          should never need to grow larger than the main state stack
933          needs to grow without LAC.  */
934       if (YYMAXDEPTH < yysize_new)
935         {
936           YYDPRINTF ((stderr, "%smax size exceeded%s", yydebug_prefix,
937                       yydebug_suffix));
938           return YYENOMEM;
939         }
940       if (YYMAXDEPTH < yyalloc)
941         yyalloc = YYMAXDEPTH;
942       yybottom_new =
943         YY_CAST (yy_state_t *,
944                  YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
945                                          yyalloc * YYSIZEOF (*yybottom_new))));
946       if (!yybottom_new)
947         {
948           YYDPRINTF ((stderr, "%srealloc failed%s", yydebug_prefix,
949                       yydebug_suffix));
950           return YYENOMEM;
951         }
952       if (*yytop != yytop_empty)
953         {
954           YYCOPY (yybottom_new, *yybottom, yysize_old);
955           *yytop = yybottom_new + (yysize_old - 1);
956         }
957       if (*yybottom != yybottom_no_free)
958         YYSTACK_FREE (*yybottom);
959       *yybottom = yybottom_new;
960       *yycapacity = yyalloc;]m4_if(b4_percent_define_get([[parse.lac.memory-trace]]),
961                                    [full], [[
962       YY_IGNORE_USELESS_CAST_BEGIN
963       YYDPRINTF ((stderr, "%srealloc to %ld%s", yydebug_prefix,
964                   YY_CAST (long, yyalloc), yydebug_suffix));
965       YY_IGNORE_USELESS_CAST_END]])[
966     }
967   return 0;
968 }
969 
970 /* Establish the initial context for the current lookahead if no initial
971    context is currently established.
972 
973    We define a context as a snapshot of the parser stacks.  We define
974    the initial context for a lookahead as the context in which the
975    parser initially examines that lookahead in order to select a
976    syntactic action.  Thus, if the lookahead eventually proves
977    syntactically unacceptable (possibly in a later context reached via a
978    series of reductions), the initial context can be used to determine
979    the exact set of tokens that would be syntactically acceptable in the
980    lookahead's place.  Moreover, it is the context after which any
981    further semantic actions would be erroneous because they would be
982    determined by a syntactically unacceptable token.
983 
984    YY_LAC_ESTABLISH should be invoked when a reduction is about to be
985    performed in an inconsistent state (which, for the purposes of LAC,
986    includes consistent states that don't know they're consistent because
987    their default reductions have been disabled).  Iff there is a
988    lookahead token, it should also be invoked before reporting a syntax
989    error.  This latter case is for the sake of the debugging output.
990 
991    For parse.lac=full, the implementation of YY_LAC_ESTABLISH is as
992    follows.  If no initial context is currently established for the
993    current lookahead, then check if that lookahead can eventually be
994    shifted if syntactic actions continue from the current context.
995    Report a syntax error if it cannot.  */
996 #define YY_LAC_ESTABLISH                                                \
997 do {                                                                    \
998   if (!yy_lac_established)                                              \
999     {                                                                   \
1000       YYDPRINTF ((stderr,                                               \
1001                   "LAC: initial context established for %s\n",          \
1002                   yysymbol_name (yytoken)));                            \
1003       yy_lac_established = 1;                                           \
1004       switch (yy_lac (yyesa, &yyes, &yyes_capacity, yyssp, yytoken))    \
1005         {                                                               \
1006         case YYENOMEM:                                                  \
1007           YYNOMEM;                                                      \
1008         case 1:                                                         \
1009           goto yyerrlab;                                                \
1010         }                                                               \
1011     }                                                                   \
1012 } while (0)
1013 
1014 /* Discard any previous initial lookahead context because of Event,
1015    which may be a lookahead change or an invalidation of the currently
1016    established initial context for the current lookahead.
1017 
1018    The most common example of a lookahead change is a shift.  An example
1019    of both cases is syntax error recovery.  That is, a syntax error
1020    occurs when the lookahead is syntactically erroneous for the
1021    currently established initial context, so error recovery manipulates
1022    the parser stacks to try to find a new initial context in which the
1023    current lookahead is syntactically acceptable.  If it fails to find
1024    such a context, it discards the lookahead.  */
1025 #if ]b4_api_PREFIX[DEBUG
1026 # define YY_LAC_DISCARD(Event)                                           \
1027 do {                                                                     \
1028   if (yy_lac_established)                                                \
1029     {                                                                    \
1030       YYDPRINTF ((stderr, "LAC: initial context discarded due to "       \
1031                   Event "\n"));                                          \
1032       yy_lac_established = 0;                                            \
1033     }                                                                    \
1034 } while (0)
1035 #else
1036 # define YY_LAC_DISCARD(Event) yy_lac_established = 0
1037 #endif
1038 
1039 /* Given the stack whose top is *YYSSP, return 0 iff YYTOKEN can
1040    eventually (after perhaps some reductions) be shifted, return 1 if
1041    not, or return YYENOMEM if memory is exhausted.  As preconditions and
1042    postconditions: *YYES_CAPACITY is the allocated size of the array to
1043    which *YYES points, and either *YYES = YYESA or *YYES points to an
1044    array allocated with YYSTACK_ALLOC.  yy_lac may overwrite the
1045    contents of either array, alter *YYES and *YYES_CAPACITY, and free
1046    any old *YYES other than YYESA.  */
1047 static int
1048 yy_lac (yy_state_t *yyesa, yy_state_t **yyes,
1049         YYPTRDIFF_T *yyes_capacity, yy_state_t *yyssp, yysymbol_kind_t yytoken)
1050 {
1051   yy_state_t *yyes_prev = yyssp;
1052   yy_state_t *yyesp = yyes_prev;
1053   /* Reduce until we encounter a shift and thereby accept the token.  */
1054   YYDPRINTF ((stderr, "LAC: checking lookahead %s:", yysymbol_name (yytoken)));
1055   if (yytoken == ]b4_symbol_prefix[YYUNDEF)
1056     {
1057       YYDPRINTF ((stderr, " Always Err\n"));
1058       return 1;
1059     }
1060   while (1)
1061     {
1062       int yyrule = yypact[+*yyesp];
1063       if (yypact_value_is_default (yyrule)
1064           || (yyrule += yytoken) < 0 || YYLAST < yyrule
1065           || yycheck[yyrule] != yytoken)
1066         {
1067           /* Use the default action.  */
1068           yyrule = yydefact[+*yyesp];
1069           if (yyrule == 0)
1070             {
1071               YYDPRINTF ((stderr, " Err\n"));
1072               return 1;
1073             }
1074         }
1075       else
1076         {
1077           /* Use the action from yytable.  */
1078           yyrule = yytable[yyrule];
1079           if (yytable_value_is_error (yyrule))
1080             {
1081               YYDPRINTF ((stderr, " Err\n"));
1082               return 1;
1083             }
1084           if (0 < yyrule)
1085             {
1086               YYDPRINTF ((stderr, " S%d\n", yyrule));
1087               return 0;
1088             }
1089           yyrule = -yyrule;
1090         }
1091       /* By now we know we have to simulate a reduce.  */
1092       YYDPRINTF ((stderr, " R%d", yyrule - 1));
1093       {
1094         /* Pop the corresponding number of values from the stack.  */
1095         YYPTRDIFF_T yylen = yyr2[yyrule];
1096         /* First pop from the LAC stack as many tokens as possible.  */
1097         if (yyesp != yyes_prev)
1098           {
1099             YYPTRDIFF_T yysize = yyesp - *yyes + 1;
1100             if (yylen < yysize)
1101               {
1102                 yyesp -= yylen;
1103                 yylen = 0;
1104               }
1105             else
1106               {
1107                 yyesp = yyes_prev;
1108                 yylen -= yysize;
1109               }
1110           }
1111         /* Only afterwards look at the main stack.  */
1112         if (yylen)
1113           yyesp = yyes_prev -= yylen;
1114       }
1115       /* Push the resulting state of the reduction.  */
1116       {
1117         yy_state_fast_t yystate;
1118         {
1119           const int yylhs = yyr1[yyrule] - YYNTOKENS;
1120           const int yyi = yypgoto[yylhs] + *yyesp;
1121           yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyesp
1122                      ? yytable[yyi]
1123                      : yydefgoto[yylhs]);
1124         }
1125         if (yyesp == yyes_prev)
1126           {
1127             yyesp = *yyes;
1128             YY_IGNORE_USELESS_CAST_BEGIN
1129             *yyesp = YY_CAST (yy_state_t, yystate);
1130             YY_IGNORE_USELESS_CAST_END
1131           }
1132         else
1133           {
1134             if (yy_lac_stack_realloc (yyes_capacity, 1,
1135 #if ]b4_api_PREFIX[DEBUG
1136                                       " (", ")",
1137 #endif
1138                                       yyes, yyesa, &yyesp, yyes_prev))
1139               {
1140                 YYDPRINTF ((stderr, "\n"));
1141                 return YYENOMEM;
1142               }
1143             YY_IGNORE_USELESS_CAST_BEGIN
1144             *++yyesp = YY_CAST (yy_state_t, yystate);
1145             YY_IGNORE_USELESS_CAST_END
1146           }
1147         YYDPRINTF ((stderr, " G%d", yystate));
1148       }
1149     }
1150 }]])[
1151 
1152 ]b4_parse_error_case([simple], [],
1153 [[/* Context of a parse error.  */
1154 typedef struct
1155 {]b4_push_if([[
1156   yypstate* yyps;]], [[
1157   yy_state_t *yyssp;]b4_lac_if([[
1158   yy_state_t *yyesa;
1159   yy_state_t **yyes;
1160   YYPTRDIFF_T *yyes_capacity;]])])[
1161   yysymbol_kind_t yytoken;]b4_locations_if([[
1162   YYLTYPE *yylloc;]])[
1163 } yypcontext_t;
1164 
1165 /* Put in YYARG at most YYARGN of the expected tokens given the
1166    current YYCTX, and return the number of tokens stored in YYARG.  If
1167    YYARG is null, return the number of expected tokens (guaranteed to
1168    be less than YYNTOKENS).  Return YYENOMEM on memory exhaustion.
1169    Return 0 if there are more than YYARGN expected tokens, yet fill
1170    YYARG up to YYARGN. */]b4_push_if([[
1171 static int
1172 yypstate_expected_tokens (yypstate *yyps,
1173                           yysymbol_kind_t yyarg[], int yyargn)]], [[
1174 static int
1175 yypcontext_expected_tokens (const yypcontext_t *yyctx,
1176                             yysymbol_kind_t yyarg[], int yyargn)]])[
1177 {
1178   /* Actual size of YYARG. */
1179   int yycount = 0;
1180 ]b4_lac_if([[
1181   int yyx;
1182   for (yyx = 0; yyx < YYNTOKENS; ++yyx)
1183     {
1184       yysymbol_kind_t yysym = YY_CAST (yysymbol_kind_t, yyx);
1185       if (yysym != ]b4_symbol(error, kind)[ && yysym != ]b4_symbol_prefix[YYUNDEF)
1186         switch (yy_lac (]b4_push_if([[yyps->yyesa, &yyps->yyes, &yyps->yyes_capacity, yyps->yyssp, yysym]],
1187                                     [[yyctx->yyesa, yyctx->yyes, yyctx->yyes_capacity, yyctx->yyssp, yysym]])[))
1188           {
1189           case YYENOMEM:
1190             return YYENOMEM;
1191           case 1:
1192             continue;
1193           default:
1194             if (!yyarg)
1195               ++yycount;
1196             else if (yycount == yyargn)
1197               return 0;
1198             else
1199               yyarg[yycount++] = yysym;
1200           }
1201     }]],
1202 [[  int yyn = yypact@{+*]b4_push_if([yyps], [yyctx])[->yyssp@};
1203   if (!yypact_value_is_default (yyn))
1204     {
1205       /* Start YYX at -YYN if negative to avoid negative indexes in
1206          YYCHECK.  In other words, skip the first -YYN actions for
1207          this state because they are default actions.  */
1208       int yyxbegin = yyn < 0 ? -yyn : 0;
1209       /* Stay within bounds of both yycheck and yytname.  */
1210       int yychecklim = YYLAST - yyn + 1;
1211       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1212       int yyx;
1213       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1214         if (yycheck[yyx + yyn] == yyx && yyx != ]b4_symbol(error, kind)[
1215             && !yytable_value_is_error (yytable[yyx + yyn]))
1216           {
1217             if (!yyarg)
1218               ++yycount;
1219             else if (yycount == yyargn)
1220               return 0;
1221             else
1222               yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1223           }
1224     }]])[
1225   if (yyarg && yycount == 0 && 0 < yyargn)
1226     yyarg[0] = ]b4_symbol(empty, kind)[;
1227   return yycount;
1228 }
1229 
1230 ]b4_push_if([[
1231 /* Similar to the previous function.  */
1232 static int
1233 yypcontext_expected_tokens (const yypcontext_t *yyctx,
1234                             yysymbol_kind_t yyarg[], int yyargn)
1235 {
1236   return yypstate_expected_tokens (yyctx->yyps, yyarg, yyargn);
1237 }]])[
1238 ]])[
1239 
1240 ]b4_parse_error_bmatch(
1241          [custom],
1242 [[/* The kind of the lookahead of this context.  */
1243 static yysymbol_kind_t
1244 yypcontext_token (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
1245 
1246 static yysymbol_kind_t
1247 yypcontext_token (const yypcontext_t *yyctx)
1248 {
1249   return yyctx->yytoken;
1250 }
1251 
1252 ]b4_locations_if([[/* The location of the lookahead of this context.  */
1253 static YYLTYPE *
1254 yypcontext_location (const yypcontext_t *yyctx) YY_ATTRIBUTE_UNUSED;
1255 
1256 static YYLTYPE *
1257 yypcontext_location (const yypcontext_t *yyctx)
1258 {
1259   return yyctx->yylloc;
1260 }]])[
1261 
1262 /* User defined function to report a syntax error.  */
1263 static int
1264 yyreport_syntax_error (const yypcontext_t *yyctx]b4_user_formals[);]],
1265          [detailed\|verbose],
1266 [[#ifndef yystrlen
1267 # if defined __GLIBC__ && defined _STRING_H
1268 #  define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1269 # else
1270 /* Return the length of YYSTR.  */
1271 static YYPTRDIFF_T
1272 yystrlen (const char *yystr)
1273 {
1274   YYPTRDIFF_T yylen;
1275   for (yylen = 0; yystr[yylen]; yylen++)
1276     continue;
1277   return yylen;
1278 }
1279 # endif
1280 #endif
1281 
1282 #ifndef yystpcpy
1283 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1284 #  define yystpcpy stpcpy
1285 # else
1286 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1287    YYDEST.  */
1288 static char *
1289 yystpcpy (char *yydest, const char *yysrc)
1290 {
1291   char *yyd = yydest;
1292   const char *yys = yysrc;
1293 
1294   while ((*yyd++ = *yys++) != '\0')
1295     continue;
1296 
1297   return yyd - 1;
1298 }
1299 # endif
1300 #endif
1301 
1302 ]b4_parse_error_case(
1303          [verbose],
1304 [[#ifndef yytnamerr
1305 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1306    quotes and backslashes, so that it's suitable for yyerror.  The
1307    heuristic is that double-quoting is unnecessary unless the string
1308    contains an apostrophe, a comma, or backslash (other than
1309    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
1310    null, do not copy; instead, return the length of what the result
1311    would have been.  */
1312 static YYPTRDIFF_T
1313 yytnamerr (char *yyres, const char *yystr)
1314 {
1315   if (*yystr == '"')
1316     {
1317       YYPTRDIFF_T yyn = 0;
1318       char const *yyp = yystr;
1319       for (;;)
1320         switch (*++yyp)
1321           {
1322           case '\'':
1323           case ',':
1324             goto do_not_strip_quotes;
1325 
1326           case '\\':
1327             if (*++yyp != '\\')
1328               goto do_not_strip_quotes;
1329             else
1330               goto append;
1331 
1332           append:
1333           default:
1334             if (yyres)
1335               yyres[yyn] = *yyp;
1336             yyn++;
1337             break;
1338 
1339           case '"':
1340             if (yyres)
1341               yyres[yyn] = '\0';
1342             return yyn;
1343           }
1344     do_not_strip_quotes: ;
1345     }
1346 
1347   if (yyres)
1348     return yystpcpy (yyres, yystr) - yyres;
1349   else
1350     return yystrlen (yystr);
1351 }
1352 #endif
1353 ]])[
1354 
1355 static int
1356 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1357                            yysymbol_kind_t yyarg[], int yyargn)
1358 {
1359   /* Actual size of YYARG. */
1360   int yycount = 0;
1361   /* There are many possibilities here to consider:
1362      - If this state is a consistent state with a default action, then
1363        the only way this function was invoked is if the default action
1364        is an error action.  In that case, don't check for expected
1365        tokens because there are none.
1366      - The only way there can be no lookahead present (in yychar) is if
1367        this state is a consistent state with a default action.  Thus,
1368        detecting the absence of a lookahead is sufficient to determine
1369        that there is no unexpected or expected token to report.  In that
1370        case, just report a simple "syntax error".
1371      - Don't assume there isn't a lookahead just because this state is a
1372        consistent state with a default action.  There might have been a
1373        previous inconsistent state, consistent state with a non-default
1374        action, or user semantic action that manipulated yychar.]b4_lac_if([[
1375        In the first two cases, it might appear that the current syntax
1376        error should have been detected in the previous state when yy_lac
1377        was invoked.  However, at that time, there might have been a
1378        different syntax error that discarded a different initial context
1379        during error recovery, leaving behind the current lookahead.]], [[
1380      - Of course, the expected token list depends on states to have
1381        correct lookahead information, and it depends on the parser not
1382        to perform extra reductions after fetching a lookahead from the
1383        scanner and before detecting a syntax error.  Thus, state merging
1384        (from LALR or IELR) and default reductions corrupt the expected
1385        token list.  However, the list is correct for canonical LR with
1386        one exception: it will still contain any token that will not be
1387        accepted due to an error action in a later state.]])[
1388   */
1389   if (yyctx->yytoken != ]b4_symbol(empty, kind)[)
1390     {
1391       int yyn;]b4_lac_if([[
1392       YYDPRINTF ((stderr, "Constructing syntax error message\n"));]])[
1393       if (yyarg)
1394         yyarg[yycount] = yyctx->yytoken;
1395       ++yycount;
1396       yyn = yypcontext_expected_tokens (yyctx,
1397                                         yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1398       if (yyn == YYENOMEM)
1399         return YYENOMEM;]b4_lac_if([[
1400       else if (yyn == 0)
1401         YYDPRINTF ((stderr, "No expected tokens.\n"));]])[
1402       else
1403         yycount += yyn;
1404     }
1405   return yycount;
1406 }
1407 
1408 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1409    about the unexpected token YYTOKEN for the state stack whose top is
1410    YYSSP.]b4_lac_if([[  In order to see if a particular token T is a
1411    valid looakhead, invoke yy_lac (YYESA, YYES, YYES_CAPACITY, YYSSP, T).]])[
1412 
1413    Return 0 if *YYMSG was successfully written.  Return -1 if *YYMSG is
1414    not large enough to hold the message.  In that case, also set
1415    *YYMSG_ALLOC to the required number of bytes.  Return YYENOMEM if the
1416    required number of bytes is too large to store]b4_lac_if([[ or if
1417    yy_lac returned YYENOMEM]])[.  */
1418 static int
1419 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1420                 const yypcontext_t *yyctx)
1421 {
1422   enum { YYARGS_MAX = 5 };
1423   /* Internationalized format string. */
1424   const char *yyformat = YY_NULLPTR;
1425   /* Arguments of yyformat: reported tokens (one for the "unexpected",
1426      one per "expected"). */
1427   yysymbol_kind_t yyarg[YYARGS_MAX];
1428   /* Cumulated lengths of YYARG.  */
1429   YYPTRDIFF_T yysize = 0;
1430 
1431   /* Actual size of YYARG. */
1432   int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1433   if (yycount == YYENOMEM)
1434     return YYENOMEM;
1435 
1436   switch (yycount)
1437     {
1438 #define YYCASE_(N, S)                       \
1439       case N:                               \
1440         yyformat = S;                       \
1441         break
1442     default: /* Avoid compiler warnings. */
1443       YYCASE_(0, YY_("syntax error"));
1444       YYCASE_(1, YY_("syntax error, unexpected %s"));
1445       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1446       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1447       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1448       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1449 #undef YYCASE_
1450     }
1451 
1452   /* Compute error message size.  Don't count the "%s"s, but reserve
1453      room for the terminator.  */
1454   yysize = yystrlen (yyformat) - 2 * yycount + 1;
1455   {
1456     int yyi;
1457     for (yyi = 0; yyi < yycount; ++yyi)
1458       {
1459         YYPTRDIFF_T yysize1
1460           = yysize + ]b4_parse_error_case(
1461                               [verbose], [[yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]])]],
1462                               [[yystrlen (yysymbol_name (yyarg[yyi]))]]);[
1463         if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1464           yysize = yysize1;
1465         else
1466           return YYENOMEM;
1467       }
1468   }
1469 
1470   if (*yymsg_alloc < yysize)
1471     {
1472       *yymsg_alloc = 2 * yysize;
1473       if (! (yysize <= *yymsg_alloc
1474              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1475         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1476       return -1;
1477     }
1478 
1479   /* Avoid sprintf, as that infringes on the user's name space.
1480      Don't have undefined behavior even if the translation
1481      produced a string with the wrong number of "%s"s.  */
1482   {
1483     char *yyp = *yymsg;
1484     int yyi = 0;
1485     while ((*yyp = *yyformat) != '\0')
1486       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1487         {]b4_parse_error_case([verbose], [[
1488           yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);]], [[
1489           yyp = yystpcpy (yyp, yysymbol_name (yyarg[yyi++]));]])[
1490           yyformat += 2;
1491         }
1492       else
1493         {
1494           ++yyp;
1495           ++yyformat;
1496         }
1497   }
1498   return 0;
1499 }
1500 ]])[
1501 
1502 ]b4_yydestruct_define[
1503 
1504 ]b4_pure_if([], [b4_declare_scanner_communication_variables])[
1505 
1506 ]b4_push_if([b4_pull_if([[
1507 
1508 int
1509 yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
1510 {
1511   yypstate *yyps = yypstate_new ();
1512   if (!yyps)
1513     {]b4_pure_if([b4_locations_if([[
1514       static YYLTYPE yyloc_default][]b4_yyloc_default[;
1515       YYLTYPE yylloc = yyloc_default;]])[
1516       yyerror (]b4_yyerror_args[YY_("memory exhausted"));]], [[
1517       if (!yypstate_allocated)
1518         yyerror (]b4_yyerror_args[YY_("memory exhausted"));]])[
1519       return 2;
1520     }
1521   int yystatus = yypull_parse (yyps]b4_user_args[);
1522   yypstate_delete (yyps);
1523   return yystatus;
1524 }
1525 
1526 int
1527 yypull_parse (yypstate *yyps]b4_user_formals[)
1528 {
1529   YY_ASSERT (yyps);]b4_pure_if([b4_locations_if([[
1530   static YYLTYPE yyloc_default][]b4_yyloc_default[;
1531   YYLTYPE yylloc = yyloc_default;]])])[
1532   int yystatus;
1533   do {
1534 ]b4_pure_if([[    YYSTYPE yylval;
1535     int ]])[yychar = ]b4_yylex[;
1536     yystatus = yypush_parse (yyps]b4_pure_if([[, yychar, &yylval]b4_locations_if([[, &yylloc]])])m4_ifset([b4_parse_param], [, b4_args(b4_parse_param)])[);
1537   } while (yystatus == YYPUSH_MORE);
1538   return yystatus;
1539 }]])[
1540 
1541 ]b4_parse_state_variable_macros([b4_pstate_macro_define])[
1542 
1543 /* Initialize the parser data structure.  */
1544 static void
1545 yypstate_clear (yypstate *yyps)
1546 {
1547   yynerrs = 0;
1548   yystate = 0;
1549   yyerrstatus = 0;
1550 
1551   yyssp = yyss;
1552   yyvsp = yyvs;]b4_locations_if([[
1553   yylsp = yyls;]])[
1554 
1555   /* Initialize the state stack, in case yypcontext_expected_tokens is
1556      called before the first call to yyparse. */
1557   *yyssp = 0;
1558   yyps->yynew = 1;
1559 }
1560 
1561 /* Initialize the parser data structure.  */
1562 yypstate *
1563 yypstate_new (void)
1564 {
1565   yypstate *yyps;]b4_pure_if([], [[
1566   if (yypstate_allocated)
1567     return YY_NULLPTR;]])[
1568   yyps = YY_CAST (yypstate *, YYMALLOC (sizeof *yyps));
1569   if (!yyps)
1570     return YY_NULLPTR;]b4_pure_if([], [[
1571   yypstate_allocated = 1;]])[
1572   yystacksize = YYINITDEPTH;
1573   yyss = yyssa;
1574   yyvs = yyvsa;]b4_locations_if([[
1575   yyls = yylsa;]])[]b4_lac_if([[
1576   yyes = yyesa;
1577   yyes_capacity = ]b4_percent_define_get([[parse.lac.es-capacity-initial]])[;
1578   if (YYMAXDEPTH < yyes_capacity)
1579     yyes_capacity = YYMAXDEPTH;]])[
1580   yypstate_clear (yyps);
1581   return yyps;
1582 }
1583 
1584 void
1585 yypstate_delete (yypstate *yyps)
1586 {
1587   if (yyps)
1588     {
1589 #ifndef yyoverflow
1590       /* If the stack was reallocated but the parse did not complete, then the
1591          stack still needs to be freed.  */
1592       if (yyss != yyssa)
1593         YYSTACK_FREE (yyss);
1594 #endif]b4_lac_if([[
1595       if (yyes != yyesa)
1596         YYSTACK_FREE (yyes);]])[
1597       YYFREE (yyps);]b4_pure_if([], [[
1598       yypstate_allocated = 0;]])[
1599     }
1600 }
1601 ]])[
1602 
1603 ]b4_push_if([[
1604 /*---------------.
1605 | yypush_parse.  |
1606 `---------------*/
1607 
1608 int
1609 yypush_parse (yypstate *yyps]b4_pure_if([[,
1610               int yypushed_char, YYSTYPE const *yypushed_val]b4_locations_if([[, YYLTYPE *yypushed_loc]])])b4_user_formals[)]],
1611 [[
1612 /*----------.
1613 | yyparse.  |
1614 `----------*/
1615 
1616 ]m4_ifdef([b4_start_symbols],
1617 [[// Extract data from the parser.
1618 typedef struct
1619 {
1620   YYSTYPE yyvalue;
1621   int yynerrs;
1622 } yy_parse_impl_t;
1623 
1624 // Run a full parse, using YYCHAR as switching token.
1625 static int
1626 yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[);
1627 
1628 ]m4_map([_b4_define_sub_yyparse], m4_defn([b4_start_symbols]))[
1629 
1630 int
1631 yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)
1632 {
1633   return yy_parse_impl (]b4_symbol(_b4_first_switching_token, id)[, YY_NULLPTR]m4_ifset([b4_parse_param],
1634                                                     [[, ]b4_args(b4_parse_param)])[);
1635 }
1636 
1637 static int
1638 yy_parse_impl (int yychar, yy_parse_impl_t *yyimpl]m4_ifset([b4_parse_param], [, b4_formals(b4_parse_param)])[)]],
1639 [[int
1640 yyparse (]m4_ifset([b4_parse_param], [b4_formals(b4_parse_param)], [void])[)]])])[
1641 {]b4_pure_if([b4_declare_scanner_communication_variables
1642 ])b4_push_if([b4_pure_if([], [[
1643   int yypushed_char = yychar;
1644   YYSTYPE yypushed_val = yylval;]b4_locations_if([[
1645   YYLTYPE yypushed_loc = yylloc;]])
1646 ])],
1647   [b4_declare_parser_state_variables([init])
1648 ])b4_lac_if([[
1649   /* Whether LAC context is established.  A Boolean.  */
1650   int yy_lac_established = 0;]])[
1651   int yyn;
1652   /* The return value of yyparse.  */
1653   int yyresult;
1654   /* Lookahead symbol kind.  */
1655   yysymbol_kind_t yytoken = ]b4_symbol(empty, kind)[;
1656   /* The variables used to return semantic value and location from the
1657      action routines.  */
1658   YYSTYPE yyval;]b4_locations_if([[
1659   YYLTYPE yyloc;
1660 
1661   /* The locations where the error started and ended.  */
1662   YYLTYPE yyerror_range[3];]])[
1663 
1664 ]b4_parse_error_bmatch([detailed\|verbose],
1665 [[  /* Buffer for error messages, and its allocated size.  */
1666   char yymsgbuf[128];
1667   char *yymsg = yymsgbuf;
1668   YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;]])[
1669 
1670 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N)]b4_locations_if([, yylsp -= (N)])[)
1671 
1672   /* The number of symbols on the RHS of the reduced rule.
1673      Keep to zero when no symbol should be popped.  */
1674   int yylen = 0;]b4_push_if([[
1675 
1676   switch (yyps->yynew)
1677     {
1678     case 0:
1679       yyn = yypact[yystate];
1680       goto yyread_pushed_token;
1681 
1682     case 2:
1683       yypstate_clear (yyps);
1684       break;
1685 
1686     default:
1687       break;
1688     }]])[
1689 
1690   YYDPRINTF ((stderr, "Starting parse\n"));
1691 
1692 ]m4_ifdef([b4_start_symbols], [],
1693 [[  yychar = ]b4_symbol(empty, id)[; /* Cause a token to be read.  */
1694 ]])[
1695 ]m4_ifdef([b4_initial_action], [
1696 b4_dollar_pushdef([m4_define([b4_dollar_dollar_used])yylval], [], [],
1697                   [b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])])dnl
1698 b4_user_initial_action
1699 b4_dollar_popdef[]dnl
1700 m4_ifdef([b4_dollar_dollar_used],[[  yyvsp[0] = yylval;
1701 ]])])dnl
1702 b4_locations_if([[  yylsp[0] = ]b4_push_if([b4_pure_if([*])yypushed_loc], [yylloc])[;
1703 ]])dnl
1704 [  goto yysetstate;
1705 
1706 
1707 /*------------------------------------------------------------.
1708 | yynewstate -- push a new state, which is found in yystate.  |
1709 `------------------------------------------------------------*/
1710 yynewstate:
1711   /* In all cases, when you get here, the value and location stacks
1712      have just been pushed.  So pushing a state here evens the stacks.  */
1713   yyssp++;
1714 
1715 
1716 /*--------------------------------------------------------------------.
1717 | yysetstate -- set current state (the top of the stack) to yystate.  |
1718 `--------------------------------------------------------------------*/
1719 yysetstate:
1720   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1721   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1722   YY_IGNORE_USELESS_CAST_BEGIN
1723   *yyssp = YY_CAST (yy_state_t, yystate);
1724   YY_IGNORE_USELESS_CAST_END
1725   YY_STACK_PRINT (yyss, yyssp);
1726 
1727   if (yyss + yystacksize - 1 <= yyssp)
1728 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1729     YYNOMEM;
1730 #else
1731     {
1732       /* Get the current used size of the three stacks, in elements.  */
1733       YYPTRDIFF_T yysize = yyssp - yyss + 1;
1734 
1735 # if defined yyoverflow
1736       {
1737         /* Give user a chance to reallocate the stack.  Use copies of
1738            these so that the &'s don't force the real ones into
1739            memory.  */
1740         yy_state_t *yyss1 = yyss;
1741         YYSTYPE *yyvs1 = yyvs;]b4_locations_if([
1742         YYLTYPE *yyls1 = yyls;])[
1743 
1744         /* Each stack pointer address is followed by the size of the
1745            data in use in that stack, in bytes.  This used to be a
1746            conditional around just the two extra args, but that might
1747            be undefined if yyoverflow is a macro.  */
1748         yyoverflow (YY_("memory exhausted"),
1749                     &yyss1, yysize * YYSIZEOF (*yyssp),
1750                     &yyvs1, yysize * YYSIZEOF (*yyvsp),]b4_locations_if([
1751                     &yyls1, yysize * YYSIZEOF (*yylsp),])[
1752                     &yystacksize);
1753         yyss = yyss1;
1754         yyvs = yyvs1;]b4_locations_if([
1755         yyls = yyls1;])[
1756       }
1757 # else /* defined YYSTACK_RELOCATE */
1758       /* Extend the stack our own way.  */
1759       if (YYMAXDEPTH <= yystacksize)
1760         YYNOMEM;
1761       yystacksize *= 2;
1762       if (YYMAXDEPTH < yystacksize)
1763         yystacksize = YYMAXDEPTH;
1764 
1765       {
1766         yy_state_t *yyss1 = yyss;
1767         union yyalloc *yyptr =
1768           YY_CAST (union yyalloc *,
1769                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1770         if (! yyptr)
1771           YYNOMEM;
1772         YYSTACK_RELOCATE (yyss_alloc, yyss);
1773         YYSTACK_RELOCATE (yyvs_alloc, yyvs);]b4_locations_if([
1774         YYSTACK_RELOCATE (yyls_alloc, yyls);])[
1775 #  undef YYSTACK_RELOCATE
1776         if (yyss1 != yyssa)
1777           YYSTACK_FREE (yyss1);
1778       }
1779 # endif
1780 
1781       yyssp = yyss + yysize - 1;
1782       yyvsp = yyvs + yysize - 1;]b4_locations_if([
1783       yylsp = yyls + yysize - 1;])[
1784 
1785       YY_IGNORE_USELESS_CAST_BEGIN
1786       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1787                   YY_CAST (long, yystacksize)));
1788       YY_IGNORE_USELESS_CAST_END
1789 
1790       if (yyss + yystacksize - 1 <= yyssp)
1791         YYABORT;
1792     }
1793 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1794 
1795 ]m4_ifdef([b4_start_symbols], [], [[
1796   if (yystate == YYFINAL)
1797     YYACCEPT;]])[
1798 
1799   goto yybackup;
1800 
1801 
1802 /*-----------.
1803 | yybackup.  |
1804 `-----------*/
1805 yybackup:
1806   /* Do appropriate processing given the current state.  Read a
1807      lookahead token if we need one and don't already have one.  */
1808 
1809   /* First try to decide what to do without reference to lookahead token.  */
1810   yyn = yypact[yystate];
1811   if (yypact_value_is_default (yyn))
1812     goto yydefault;
1813 
1814   /* Not known => get a lookahead token if don't already have one.  */
1815 
1816   /* YYCHAR is either empty, or end-of-input, or a valid lookahead.  */
1817   if (yychar == ]b4_symbol(empty, id)[)
1818     {]b4_push_if([[
1819       if (!yyps->yynew)
1820         {]b4_use_push_for_pull_if([], [[
1821           YYDPRINTF ((stderr, "Return for a new token:\n"));]])[
1822           yyresult = YYPUSH_MORE;
1823           goto yypushreturn;
1824         }
1825       yyps->yynew = 0;]b4_pure_if([], [[
1826       /* Restoring the pushed token is only necessary for the first
1827          yypush_parse invocation since subsequent invocations don't overwrite
1828          it before jumping to yyread_pushed_token.  */
1829       yychar = yypushed_char;
1830       yylval = yypushed_val;]b4_locations_if([[
1831       yylloc = yypushed_loc;]])])[
1832 yyread_pushed_token:]])[
1833       YYDPRINTF ((stderr, "Reading a token\n"));]b4_push_if([b4_pure_if([[
1834       yychar = yypushed_char;
1835       if (yypushed_val)
1836         yylval = *yypushed_val;]b4_locations_if([[
1837       if (yypushed_loc)
1838         yylloc = *yypushed_loc;]])])], [[
1839       yychar = ]b4_yylex[;]])[
1840     }
1841 
1842   if (yychar <= ]b4_symbol(eof, [id])[)
1843     {
1844       yychar = ]b4_symbol(eof, [id])[;
1845       yytoken = ]b4_symbol(eof, [kind])[;
1846       YYDPRINTF ((stderr, "Now at end of input.\n"));
1847     }
1848   else if (yychar == ]b4_symbol(error, [id])[)
1849     {
1850       /* The scanner already issued an error message, process directly
1851          to error recovery.  But do not keep the error token as
1852          lookahead, it is too special and may lead us to an endless
1853          loop in error recovery. */
1854       yychar = ]b4_symbol(undef, [id])[;
1855       yytoken = ]b4_symbol(error, [kind])[;]b4_locations_if([[
1856       yyerror_range[1] = yylloc;]])[
1857       goto yyerrlab1;
1858     }
1859   else
1860     {
1861       yytoken = YYTRANSLATE (yychar);
1862       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1863     }
1864 
1865   /* If the proper action on seeing token YYTOKEN is to reduce or to
1866      detect an error, take that action.  */
1867   yyn += yytoken;
1868   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)]b4_lac_if([[
1869     {
1870       YY_LAC_ESTABLISH;
1871       goto yydefault;
1872     }]], [[
1873     goto yydefault;]])[
1874   yyn = yytable[yyn];
1875   if (yyn <= 0)
1876     {
1877       if (yytable_value_is_error (yyn))
1878         goto yyerrlab;
1879       yyn = -yyn;]b4_lac_if([[
1880       YY_LAC_ESTABLISH;]])[
1881       goto yyreduce;
1882     }
1883 
1884   /* Count tokens shifted since error; after three, turn off error
1885      status.  */
1886   if (yyerrstatus)
1887     yyerrstatus--;
1888 
1889   /* Shift the lookahead token.  */
1890   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1891   yystate = yyn;
1892   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1893   *++yyvsp = yylval;
1894   YY_IGNORE_MAYBE_UNINITIALIZED_END]b4_locations_if([
1895   *++yylsp = yylloc;])[
1896 
1897   /* Discard the shifted token.  */
1898   yychar = ]b4_symbol(empty, id)[;]b4_lac_if([[
1899   YY_LAC_DISCARD ("shift");]])[
1900   goto yynewstate;
1901 
1902 
1903 /*-----------------------------------------------------------.
1904 | yydefault -- do the default action for the current state.  |
1905 `-----------------------------------------------------------*/
1906 yydefault:
1907   yyn = yydefact[yystate];
1908   if (yyn == 0)
1909     goto yyerrlab;
1910   goto yyreduce;
1911 
1912 
1913 /*-----------------------------.
1914 | yyreduce -- do a reduction.  |
1915 `-----------------------------*/
1916 yyreduce:
1917   /* yyn is the number of a rule to reduce with.  */
1918   yylen = yyr2[yyn];
1919 
1920   /* If YYLEN is nonzero, implement the default value of the action:
1921      '$$ = $1'.
1922 
1923      Otherwise, the following line sets YYVAL to garbage.
1924      This behavior is undocumented and Bison
1925      users should not rely upon it.  Assigning to YYVAL
1926      unconditionally makes the parser a bit smaller, and it avoids a
1927      GCC warning that YYVAL may be used uninitialized.  */
1928   yyval = yyvsp[1-yylen];
1929 
1930 ]b4_locations_if(
1931 [[  /* Default location. */
1932   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1933   yyerror_range[1] = yyloc;]])[
1934   YY_REDUCE_PRINT (yyn);]b4_lac_if([[
1935   {
1936     int yychar_backup = yychar;
1937     switch (yyn)
1938       {
1939 ]b4_user_actions[
1940         default: break;
1941       }
1942     if (yychar_backup != yychar)
1943       YY_LAC_DISCARD ("yychar change");
1944   }]], [[
1945   switch (yyn)
1946     {
1947 ]b4_user_actions[
1948       default: break;
1949     }]])[
1950   /* User semantic actions sometimes alter yychar, and that requires
1951      that yytoken be updated with the new translation.  We take the
1952      approach of translating immediately before every use of yytoken.
1953      One alternative is translating here after every semantic action,
1954      but that translation would be missed if the semantic action invokes
1955      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1956      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1957      incorrect destructor might then be invoked immediately.  In the
1958      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1959      to an incorrect destructor call or verbose syntax error message
1960      before the lookahead is translated.  */
1961   YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1962 
1963   YYPOPSTACK (yylen);
1964   yylen = 0;
1965 
1966   *++yyvsp = yyval;]b4_locations_if([
1967   *++yylsp = yyloc;])[
1968 
1969   /* Now 'shift' the result of the reduction.  Determine what state
1970      that goes to, based on the state we popped back to and the rule
1971      number reduced by.  */
1972   {
1973     const int yylhs = yyr1[yyn] - YYNTOKENS;
1974     const int yyi = yypgoto[yylhs] + *yyssp;
1975     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1976                ? yytable[yyi]
1977                : yydefgoto[yylhs]);
1978   }
1979 
1980   goto yynewstate;
1981 
1982 
1983 /*--------------------------------------.
1984 | yyerrlab -- here on detecting error.  |
1985 `--------------------------------------*/
1986 yyerrlab:
1987   /* Make sure we have latest lookahead translation.  See comments at
1988      user semantic actions for why this is necessary.  */
1989   yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
1990   /* If not already recovering from an error, report this error.  */
1991   if (!yyerrstatus)
1992     {
1993       ++yynerrs;
1994 ]b4_parse_error_case(
1995          [custom],
1996 [[      {
1997         yypcontext_t yyctx
1998           = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};]b4_lac_if([[
1999         if (yychar != ]b4_symbol(empty, id)[)
2000           YY_LAC_ESTABLISH;]])[
2001         if (yyreport_syntax_error (&yyctx]m4_ifset([b4_parse_param],
2002                                    [[, ]b4_args(b4_parse_param)])[) == 2)
2003           YYNOMEM;
2004       }]],
2005          [simple],
2006 [[      yyerror (]b4_yyerror_args[YY_("syntax error"));]],
2007 [[      {
2008         yypcontext_t yyctx
2009           = {]b4_push_if([[yyps]], [[yyssp]b4_lac_if([[, yyesa, &yyes, &yyes_capacity]])])[, yytoken]b4_locations_if([[, &yylloc]])[};
2010         char const *yymsgp = YY_("syntax error");
2011         int yysyntax_error_status;]b4_lac_if([[
2012         if (yychar != ]b4_symbol(empty, id)[)
2013           YY_LAC_ESTABLISH;]])[
2014         yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2015         if (yysyntax_error_status == 0)
2016           yymsgp = yymsg;
2017         else if (yysyntax_error_status == -1)
2018           {
2019             if (yymsg != yymsgbuf)
2020               YYSTACK_FREE (yymsg);
2021             yymsg = YY_CAST (char *,
2022                              YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2023             if (yymsg)
2024               {
2025                 yysyntax_error_status
2026                   = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
2027                 yymsgp = yymsg;
2028               }
2029             else
2030               {
2031                 yymsg = yymsgbuf;
2032                 yymsg_alloc = sizeof yymsgbuf;
2033                 yysyntax_error_status = YYENOMEM;
2034               }
2035           }
2036         yyerror (]b4_yyerror_args[yymsgp);
2037         if (yysyntax_error_status == YYENOMEM)
2038           YYNOMEM;
2039       }]])[
2040     }
2041 ]b4_locations_if([[
2042   yyerror_range[1] = yylloc;]])[
2043   if (yyerrstatus == 3)
2044     {
2045       /* If just tried and failed to reuse lookahead token after an
2046          error, discard it.  */
2047 
2048       if (yychar <= ]b4_symbol(eof, [id])[)
2049         {
2050           /* Return failure if at end of input.  */
2051           if (yychar == ]b4_symbol(eof, [id])[)
2052             YYABORT;
2053         }
2054       else
2055         {
2056           yydestruct ("Error: discarding",
2057                       yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
2058           yychar = ]b4_symbol(empty, id)[;
2059         }
2060     }
2061 
2062   /* Else will try to reuse lookahead token after shifting the error
2063      token.  */
2064   goto yyerrlab1;
2065 
2066 
2067 /*---------------------------------------------------.
2068 | yyerrorlab -- error raised explicitly by YYERROR.  |
2069 `---------------------------------------------------*/
2070 yyerrorlab:
2071   /* Pacify compilers when the user code never invokes YYERROR and the
2072      label yyerrorlab therefore never appears in user code.  */
2073   if (0)
2074     YYERROR;
2075   ++yynerrs;
2076 
2077   /* Do not reclaim the symbols of the rule whose action triggered
2078      this YYERROR.  */
2079   YYPOPSTACK (yylen);
2080   yylen = 0;
2081   YY_STACK_PRINT (yyss, yyssp);
2082   yystate = *yyssp;
2083   goto yyerrlab1;
2084 
2085 
2086 /*-------------------------------------------------------------.
2087 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
2088 `-------------------------------------------------------------*/
2089 yyerrlab1:
2090   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
2091 
2092   /* Pop stack until we find a state that shifts the error token.  */
2093   for (;;)
2094     {
2095       yyn = yypact[yystate];
2096       if (!yypact_value_is_default (yyn))
2097         {
2098           yyn += ]b4_symbol(error, kind)[;
2099           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == ]b4_symbol(error, kind)[)
2100             {
2101               yyn = yytable[yyn];
2102               if (0 < yyn)
2103                 break;
2104             }
2105         }
2106 
2107       /* Pop the current state because it cannot handle the error token.  */
2108       if (yyssp == yyss)
2109         YYABORT;
2110 
2111 ]b4_locations_if([[      yyerror_range[1] = *yylsp;]])[
2112       yydestruct ("Error: popping",
2113                   YY_ACCESSING_SYMBOL (yystate), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
2114       YYPOPSTACK (1);
2115       yystate = *yyssp;
2116       YY_STACK_PRINT (yyss, yyssp);
2117     }]b4_lac_if([[
2118 
2119   /* If the stack popping above didn't lose the initial context for the
2120      current lookahead token, the shift below will for sure.  */
2121   YY_LAC_DISCARD ("error recovery");]])[
2122 
2123   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2124   *++yyvsp = yylval;
2125   YY_IGNORE_MAYBE_UNINITIALIZED_END
2126 ]b4_locations_if([[
2127   yyerror_range[2] = yylloc;
2128   ++yylsp;
2129   YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);]])[
2130 
2131   /* Shift the error token.  */
2132   YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2133 
2134   yystate = yyn;
2135   goto yynewstate;
2136 
2137 
2138 /*-------------------------------------.
2139 | yyacceptlab -- YYACCEPT comes here.  |
2140 `-------------------------------------*/
2141 yyacceptlab:
2142   yyresult = 0;
2143   goto yyreturnlab;
2144 
2145 
2146 /*-----------------------------------.
2147 | yyabortlab -- YYABORT comes here.  |
2148 `-----------------------------------*/
2149 yyabortlab:
2150   yyresult = 1;
2151   goto yyreturnlab;
2152 
2153 
2154 /*-----------------------------------------------------------.
2155 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here.  |
2156 `-----------------------------------------------------------*/
2157 yyexhaustedlab:
2158   yyerror (]b4_yyerror_args[YY_("memory exhausted"));
2159   yyresult = 2;
2160   goto yyreturnlab;
2161 
2162 
2163 /*----------------------------------------------------------.
2164 | yyreturnlab -- parsing is finished, clean up and return.  |
2165 `----------------------------------------------------------*/
2166 yyreturnlab:
2167   if (yychar != ]b4_symbol(empty, id)[)
2168     {
2169       /* Make sure we have latest lookahead translation.  See comments at
2170          user semantic actions for why this is necessary.  */
2171       yytoken = YYTRANSLATE (yychar);
2172       yydestruct ("Cleanup: discarding lookahead",
2173                   yytoken, &yylval]b4_locations_if([, &yylloc])[]b4_user_args[);
2174     }
2175   /* Do not reclaim the symbols of the rule whose action triggered
2176      this YYABORT or YYACCEPT.  */
2177   YYPOPSTACK (yylen);
2178   YY_STACK_PRINT (yyss, yyssp);
2179   while (yyssp != yyss)
2180     {
2181       yydestruct ("Cleanup: popping",
2182                   YY_ACCESSING_SYMBOL (+*yyssp), yyvsp]b4_locations_if([, yylsp])[]b4_user_args[);
2183       YYPOPSTACK (1);
2184     }]b4_push_if([[
2185   yyps->yynew = 2;
2186   goto yypushreturn;
2187 
2188 
2189 /*-------------------------.
2190 | yypushreturn -- return.  |
2191 `-------------------------*/
2192 yypushreturn:]], [[
2193 #ifndef yyoverflow
2194   if (yyss != yyssa)
2195     YYSTACK_FREE (yyss);
2196 #endif]b4_lac_if([[
2197   if (yyes != yyesa)
2198     YYSTACK_FREE (yyes);]])])[
2199 ]b4_parse_error_bmatch([detailed\|verbose],
2200 [[  if (yymsg != yymsgbuf)
2201     YYSTACK_FREE (yymsg);]])[]m4_ifdef([b4_start_symbols], [[
2202   if (yyimpl)
2203     yyimpl->yynerrs = yynerrs;]])[
2204   return yyresult;
2205 }
2206 ]b4_push_if([b4_parse_state_variable_macros([b4_macro_undef])])[
2207 ]b4_percent_code_get([[epilogue]])[]dnl
2208 b4_epilogue[]dnl
2209 b4_output_end
2210