1 <%# b4_generated_by -%>
51 <%# b4_identification -%>
56 #define YYBISON_VERSION "3.8.2"
59 #define YYSKELETON_NAME "<%= output.template_basename %>"
71 <%# b4_user_pre_prologue -%>
72 <%-
if output.aux.prologue -%>
74 #line <%= output.aux.prologue_first_lineno %> "<%= output.grammar_file_path %>"
75 <%= output.aux.prologue %>
76 #line [@oline@] [@ofile@]
79 <%# b4_cast_define -%>
82 # define YY_CAST(Type, Val) static_cast<Type> (Val)
83 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
85 # define YY_CAST(Type, Val) ((Type) (Val))
86 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
89 <%# b4_null_define -%>
91 # if defined __cplusplus
92 # if 201103L <= __cplusplus
93 # define YY_NULLPTR nullptr
98 # define YY_NULLPTR ((void*)0)
102 <%# b4_header_include_if -%>
103 <%-
if output.include_header -%>
104 #include "<%= output.include_header %>"
106 /* Use api.header.include to #include this header
107 instead of duplicating it here. */
108 <%= output.render_partial("bison/_yacc.h
") %>
110 <%# b4_declare_symbol_enum -%>
114 <%= output.symbol_enum -%>
116 typedef enum yysymbol_kind_t yysymbol_kind_t;
121 <%# b4_user_post_prologue -%>
122 <%# b4_c99_int_type_define -%>
127 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
128 <limits.h> and (if available) <stdint.h> are included
129 so that the code can choose integer types of a good width. */
131 #ifndef __PTRDIFF_MAX__
132 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
133 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
134 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
139 /* Narrow types that promote to a signed type and that can represent a
140 signed or unsigned integer of at least N bits. In tables they can
141 save space and decrease cache pressure. Promoting to a signed type
142 helps avoid bugs in integer arithmetic. */
144 #ifdef __INT_LEAST8_MAX__
145 typedef __INT_LEAST8_TYPE__ yytype_int8;
146 #elif defined YY_STDINT_H
147 typedef int_least8_t yytype_int8;
149 typedef signed char yytype_int8;
152 #ifdef __INT_LEAST16_MAX__
153 typedef __INT_LEAST16_TYPE__ yytype_int16;
154 #elif defined YY_STDINT_H
155 typedef int_least16_t yytype_int16;
157 typedef short yytype_int16;
160 /* Work around bug in HP-UX 11.23, which defines these macros
161 incorrectly for preprocessor constants. This workaround can likely
162 be removed in 2023, as HPE has promised support for HP-UX 11.23
163 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
164 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
166 # undef UINT_LEAST8_MAX
167 # undef UINT_LEAST16_MAX
168 # define UINT_LEAST8_MAX 255
169 # define UINT_LEAST16_MAX 65535
172 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
173 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
174 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
175 && UINT_LEAST8_MAX <= INT_MAX)
176 typedef uint_least8_t yytype_uint8;
177 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
178 typedef unsigned char yytype_uint8;
180 typedef short yytype_uint8;
183 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
184 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
185 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
186 && UINT_LEAST16_MAX <= INT_MAX)
187 typedef uint_least16_t yytype_uint16;
188 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
189 typedef unsigned short yytype_uint16;
191 typedef int yytype_uint16;
194 <%# b4_sizes_types_define -%>
196 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
197 # define YYPTRDIFF_T __PTRDIFF_TYPE__
198 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
199 # elif defined PTRDIFF_MAX
201 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
203 # define YYPTRDIFF_T ptrdiff_t
204 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
206 # define YYPTRDIFF_T long
207 # define YYPTRDIFF_MAXIMUM LONG_MAX
212 # ifdef __SIZE_TYPE__
213 # define YYSIZE_T __SIZE_TYPE__
214 # elif defined size_t
215 # define YYSIZE_T size_t
216 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
217 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
218 # define YYSIZE_T size_t
220 # define YYSIZE_T unsigned
224 #define YYSIZE_MAXIMUM \
225 YY_CAST (YYPTRDIFF_T, \
226 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
227 ? YYPTRDIFF_MAXIMUM \
228 : YY_CAST (YYSIZE_T, -1)))
230 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
233 /* Stored state numbers (used for stacks). */
234 typedef <%= output.int_type_for([output.yynstates - 1]) %> yy_state_t;
236 /* State numbers in computations. */
237 typedef int yy_state_fast_t;
240 # if defined YYENABLE_NLS && YYENABLE_NLS
242 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
243 # define YY_(Msgid) dgettext ("bison-runtime
", Msgid)
247 # define YY_(Msgid) Msgid
252 <%# b4_attribute_define -%>
253 #ifndef YY_ATTRIBUTE_PURE
254 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
255 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
257 # define YY_ATTRIBUTE_PURE
261 #ifndef YY_ATTRIBUTE_UNUSED
262 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
263 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
265 # define YY_ATTRIBUTE_UNUSED
269 /* Suppress unused-variable warnings by "using" E. */
270 #if ! defined lint || defined __GNUC__
271 # define YY_USE(E) ((void) (E))
273 # define YY_USE(E) /* empty */
276 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
277 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
278 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
279 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
280 _Pragma ("GCC diagnostic push
") \
281 _Pragma ("GCC diagnostic ignored \
"-Wuninitialized\"")
283 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
284 _Pragma (
"GCC diagnostic push") \
285 _Pragma (
"GCC diagnostic ignored \"-Wuninitialized\"") \
286 _Pragma (
"GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
288 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
289 _Pragma ("GCC diagnostic pop")
291 # define YY_INITIAL_VALUE(Value) Value
293 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
294 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
295 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
297 #ifndef YY_INITIAL_VALUE
298 # define YY_INITIAL_VALUE(Value)
301 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
302 # define YY_IGNORE_USELESS_CAST_BEGIN \
303 _Pragma ("GCC diagnostic push") \
304 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
305 # define YY_IGNORE_USELESS_CAST_END \
306 _Pragma ("GCC diagnostic pop")
308 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
309 # define YY_IGNORE_USELESS_CAST_BEGIN
310 # define YY_IGNORE_USELESS_CAST_END
314 #define YY_ASSERT(E) ((void) (0 && (E)))
320 # ifdef YYSTACK_USE_ALLOCA
321 # if YYSTACK_USE_ALLOCA
323 # define YYSTACK_ALLOC __builtin_alloca
324 # elif defined __BUILTIN_VA_ARG_INCR
327 # define YYSTACK_ALLOC __alloca
328 # elif defined _MSC_VER
330 # define alloca _alloca
332 # define YYSTACK_ALLOC alloca
333 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
336 # ifndef EXIT_SUCCESS
337 # define EXIT_SUCCESS 0
344 # ifdef YYSTACK_ALLOC
346 # define YYSTACK_FREE(Ptr) do { ; } while (0)
347 # ifndef YYSTACK_ALLOC_MAXIMUM
352 # define YYSTACK_ALLOC_MAXIMUM 4032
355 # define YYSTACK_ALLOC YYMALLOC
356 # define YYSTACK_FREE YYFREE
357 # ifndef YYSTACK_ALLOC_MAXIMUM
358 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
360 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
361 && ! ((defined YYMALLOC || defined malloc) \
362 && (defined YYFREE || defined free)))
364 # ifndef EXIT_SUCCESS
365 # define EXIT_SUCCESS 0
369 # define YYMALLOC malloc
370 # if ! defined malloc && ! defined EXIT_SUCCESS
371 void *malloc (YYSIZE_T);
376 # if ! defined free && ! defined EXIT_SUCCESS
383 #if (! defined yyoverflow \
384 && (! defined __cplusplus \
385 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
386 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
391 yy_state_t yyss_alloc;
397 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
401 # define YYSTACK_BYTES(N) \
402 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
403 + YYSIZEOF (YYLTYPE)) \
404 + 2 * YYSTACK_GAP_MAXIMUM)
406 # define YYCOPY_NEEDED 1
413 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
416 YYPTRDIFF_T yynewbytes; \
417 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
418 Stack = &yyptr->Stack_alloc; \
419 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
420 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
426 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
430 # if defined __GNUC__ && 1 < __GNUC__
431 # define YYCOPY(Dst, Src, Count) \
432 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
434 # define YYCOPY(Dst, Src, Count) \
438 for (yyi = 0; yyi < (Count); yyi++) \
439 (Dst)[yyi] = (Src)[yyi]; \
447 #define YYFINAL <%= output.yyfinal %>
449 #define YYLAST <%= output.yylast %>
452 #define YYNTOKENS <%= output.yyntokens %>
454 #define YYNNTS <%= output.yynnts %>
456 #define YYNRULES <%= output.yynrules %>
458 #define YYNSTATES <%= output.yynstates %>
461 #define YYMAXUTOK <%= output.yymaxutok %>
466 #define YYTRANSLATE(YYX) \
467 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
468 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
473 static const <%= output.int_type_for(output.context.yytranslate) %> yytranslate[] =
475 <%= output.yytranslate %>
478 <%-
if output.error_recovery -%>
480 static const <%= output.int_type_for(output.context.yytranslate_inverted) %> yytranslate_inverted[] =
482 <%= output.yytranslate_inverted %>
487 static const <%= output.int_type_for(output.context.yyrline) %> yyrline[] =
489 <%= output.yyrline %>
494 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
499 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
503 static const char *
const yytname[] =
505 <%= output.yytname %>
509 yysymbol_name (yysymbol_kind_t yysymbol)
511 return yytname[yysymbol];
515 #define YYPACT_NINF (<%= output.yypact_ninf %>)
517 #define yypact_value_is_default(Yyn) \
518 <%= output.table_value_equals(output.context.yypact, "Yyn", output.yypact_ninf, "YYPACT_NINF") %>
520 #define YYTABLE_NINF (<%= output.yytable_ninf %>)
522 #define yytable_value_is_error(Yyn) \
523 <%= output.table_value_equals(output.context.yytable, "Yyn", output.yytable_ninf, "YYTABLE_NINF") %>
525 <%# b4_parser_tables_define -%>
528 static const <%= output.int_type_for(output.context.yypact) %> yypact[] =
530 <%= output.int_array_to_string(output.context.yypact) %>
536 static const <%= output.int_type_for(output.context.yydefact) %> yydefact[] =
538 <%= output.int_array_to_string(output.context.yydefact) %>
542 static const <%= output.int_type_for(output.context.yypgoto) %> yypgoto[] =
544 <%= output.int_array_to_string(output.context.yypgoto) %>
548 static const <%= output.int_type_for(output.context.yydefgoto) %> yydefgoto[] =
550 <%= output.int_array_to_string(output.context.yydefgoto) %>
556 static const <%= output.int_type_for(output.context.yytable) %> yytable[] =
558 <%= output.int_array_to_string(output.context.yytable) %>
561 static const <%= output.int_type_for(output.context.yycheck) %> yycheck[] =
563 <%= output.int_array_to_string(output.context.yycheck) %>
568 static const <%= output.int_type_for(output.context.yystos) %> yystos[] =
570 <%= output.int_array_to_string(output.context.yystos) %>
574 static const <%= output.int_type_for(output.context.yyr1) %> yyr1[] =
576 <%= output.int_array_to_string(output.context.yyr1) %>
580 static const <%= output.int_type_for(output.context.yyr2) %> yyr2[] =
582 <%= output.int_array_to_string(output.context.yyr2) %>
586 enum { YYENOMEM = -2 };
588 #define yyerrok (yyerrstatus = 0)
589 #define yyclearin (yychar = YYEMPTY)
591 #define YYACCEPT goto yyacceptlab
592 #define YYABORT goto yyabortlab
593 #define YYERROR goto yyerrorlab
594 #define YYNOMEM goto yyexhaustedlab
597 #define YYRECOVERING() (!!yyerrstatus)
599 #define YYBACKUP(Token, Value) \
601 if (yychar == YYEMPTY) \
605 YYPOPSTACK (yylen); \
611 yyerror (<%= output.yyerror_args %>, YY_("syntax error: cannot back up")); \
618 #define YYERRCODE YYUNDEF
620 <%# b4_yylloc_default_define -%>
625 #ifndef YYLLOC_DEFAULT
626 # define YYLLOC_DEFAULT(Current, Rhs, N) \
630 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
631 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
632 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
633 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
637 (Current).first_line = (Current).last_line = \
638 YYRHSLOC (Rhs, 0).last_line; \
639 (Current).first_column = (Current).last_column = \
640 YYRHSLOC (Rhs, 0).last_column; \
645 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
653 # define YYFPRINTF fprintf
656 # define YYDPRINTF(Args) \
663 <%# b4_yylocation_print_define -%>
668 # ifndef YYLOCATION_PRINT
670 # if defined YY_LOCATION_PRINT
674 # define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) YY_LOCATION_PRINT(File, *(Loc)<%= output.user_args %>)
676 # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
682 yy_location_print_ (
FILE *yyo,
YYLTYPE const *
const yylocp)
685 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
686 if (0 <= yylocp->first_line)
688 res += YYFPRINTF (yyo,
"%d", yylocp->first_line);
689 if (0 <= yylocp->first_column)
690 res += YYFPRINTF (yyo,
".%d", yylocp->first_column);
692 if (0 <= yylocp->last_line)
694 if (yylocp->first_line < yylocp->last_line)
696 res += YYFPRINTF (yyo,
"-%d", yylocp->last_line);
698 res += YYFPRINTF (yyo,
".%d", end_col);
700 else if (0 <= end_col && yylocp->first_column < end_col)
701 res += YYFPRINTF (yyo,
"-%d", end_col);
706 # define YYLOCATION_PRINT yy_location_print_
710 # define YY_LOCATION_PRINT(File, Loc<%= output.user_args %>) YYLOCATION_PRINT(File, &(Loc)<%= output.user_args %>)
714 # define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) ((void) 0)
717 # define YY_LOCATION_PRINT YYLOCATION_PRINT
723 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>) \
727 YYFPRINTF (stderr, "%s ", Title); \
728 yy_symbol_print (stderr, \
729 Kind, Value, Location<%= output.user_args %>); \
730 YYFPRINTF (stderr, "\n"); \
735 <%# b4_yy_symbol_print_define -%>
741 yy_symbol_value_print (
FILE *yyo,
742 yysymbol_kind_t yykind,
YYSTYPE const *
const yyvaluep,
YYLTYPE const *
const yylocationp<%= output.user_formals %>)
744 FILE *yyoutput = yyo;
745 <%= output.parse_param_use(
"yyoutput",
"yylocationp") %>
748 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
749 <%# b4_symbol_actions(printer) -%>
752 <%= output.symbol_actions_for_printer -%>
756 YY_IGNORE_MAYBE_UNINITIALIZED_END
765 yy_symbol_print (
FILE *yyo,
766 yysymbol_kind_t yykind,
YYSTYPE const *
const yyvaluep,
YYLTYPE const *
const yylocationp<%= output.user_formals %>)
768 YYFPRINTF (yyo,
"%s %s (",
769 yykind < YYNTOKENS ?
"token" :
"nterm", yysymbol_name (yykind));
771 YYLOCATION_PRINT (yyo, yylocationp<%= output.user_args %>);
772 YYFPRINTF (yyo,
": ");
773 yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp<%= output.user_args %>);
774 YYFPRINTF (yyo,
")");
783 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop<%= output.user_formals %>)
785 YYFPRINTF (stderr,
"Stack now");
786 for (; yybottom <= yytop; yybottom++)
788 int yybot = *yybottom;
789 YYFPRINTF (stderr,
" %d", yybot);
791 YYFPRINTF (stderr,
"\n");
794 # define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>) \
797 yy_stack_print ((Bottom), (Top)<%= output.user_args %>); \
806 yy_reduce_print (yy_state_t *yyssp,
YYSTYPE *yyvsp,
YYLTYPE *yylsp,
807 int yyrule<%= output.user_formals %>)
809 int yylno = yyrline[yyrule];
810 int yynrhs = yyr2[yyrule];
812 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %d):\n",
815 for (yyi = 0; yyi < yynrhs; yyi++)
817 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
818 yy_symbol_print (stderr,
819 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
820 &yyvsp[(yyi + 1) - (yynrhs)],
821 &(yylsp[(yyi + 1) - (yynrhs)])<%= output.user_args %>);
822 YYFPRINTF (stderr,
"\n");
826 # define YY_REDUCE_PRINT(Rule<%= output.user_args %>) \
829 yy_reduce_print (yyssp, yyvsp, yylsp, Rule<%= output.user_args %>); \
838 # define YYDPRINTF(Args) ((void) 0)
839 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>)
840 # define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>)
841 # define YY_REDUCE_PRINT(Rule<%= output.user_args %>)
847 # define YYINITDEPTH 200
858 # define YYMAXDEPTH 10000
866 yysymbol_kind_t yytoken;
878 yysymbol_kind_t yyarg[],
int yyargn)
882 int yyn = yypact[+*yyctx->yyssp];
883 if (!yypact_value_is_default (yyn))
888 int yyxbegin = yyn < 0 ? -yyn : 0;
890 int yychecklim = YYLAST - yyn + 1;
891 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
893 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
894 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
895 && !yytable_value_is_error (yytable[yyx + yyn]))
899 else if (yycount == yyargn)
902 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
905 if (yyarg && yycount == 0 && 0 < yyargn)
906 yyarg[0] = YYSYMBOL_YYEMPTY;
914 # if defined __GLIBC__ && defined _STRING_H
915 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
919 yystrlen (
const char *yystr)
922 for (yylen = 0; yystr[yylen]; yylen++)
930 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
931 # define yystpcpy stpcpy
936 yystpcpy (
char *yydest,
const char *yysrc)
939 const char *yys = yysrc;
941 while ((*yyd++ = *yys++) !=
'\0')
958 yytnamerr (
char *yyres,
const char *yystr)
963 char const *yyp = yystr;
969 goto do_not_strip_quotes;
973 goto do_not_strip_quotes;
989 do_not_strip_quotes: ;
993 return yystpcpy (yyres, yystr) - yyres;
995 return yystrlen (yystr);
1002 yysymbol_kind_t yyarg[],
int yyargn)
1029 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1033 yyarg[yycount] = yyctx->yytoken;
1035 yyn = yypcontext_expected_tokens (yyctx,
1036 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1037 if (yyn == YYENOMEM)
1054 yysyntax_error (YYPTRDIFF_T *yymsg_alloc,
char **yymsg,
1057 enum { YYARGS_MAX = 5 };
1059 const char *yyformat = YY_NULLPTR;
1062 yysymbol_kind_t yyarg[YYARGS_MAX];
1064 YYPTRDIFF_T yysize = 0;
1067 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1068 if (yycount == YYENOMEM)
1073 #define YYCASE_(N, S) \
1078 YYCASE_(0, YY_(
"syntax error"));
1079 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
1080 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
1081 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1082 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1083 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1089 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1092 for (yyi = 0; yyi < yycount; ++yyi)
1095 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1096 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1103 if (*yymsg_alloc < yysize)
1105 *yymsg_alloc = 2 * yysize;
1106 if (! (yysize <= *yymsg_alloc
1107 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1108 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1118 while ((*yyp = *yyformat) !=
'\0')
1119 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1121 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1133 <%# b4_yydestruct_define %>
1139 yydestruct (
const char *yymsg,
1140 yysymbol_kind_t yykind,
YYSTYPE *yyvaluep,
YYLTYPE *yylocationp<%= output.user_formals %>)
1142 <%= output.parse_param_use(
"yyvaluep",
"yylocationp") %>
1145 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp<%= output.user_args %>);
1147 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1150 <%= output.symbol_actions_for_destructor -%>
1154 YY_IGNORE_MAYBE_UNINITIALIZED_END
1159 <%-
if output.error_recovery -%>
1161 # define YYMAXREPAIR(<%= output.parse_param_name %>) (3)
1164 #ifndef YYERROR_RECOVERY_ENABLED
1165 # define YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>) (1)
1168 enum yy_repair_type {
1175 enum yy_repair_type type;
1176 yysymbol_kind_t term;
1185 YYPTRDIFF_T stack_length;
1199 yysymbol_kind_t kind;
1213 yy_error_token_initialize (yysymbol_kind_t yykind,
YYSTYPE *
const yyvaluep,
YYLTYPE *
const yylocationp<%= output.user_formals %>)
1215 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1218 <%= output.symbol_actions_for_error_token -%>
1222 YY_IGNORE_MAYBE_UNINITIALIZED_END
1226 yy_create_repair_terms(
yy_repairs *reps<%= output.user_formals %>)
1232 while (r->prev_repair)
1239 rep_terms->id = reps->id;
1240 rep_terms->length = count;
1243 while (r->prev_repair)
1245 rep_terms->terms[count-1].kind = r->repair.term;
1254 yy_print_repairs(
yy_repairs *reps<%= output.user_formals %>)
1259 "id: %d, repair_length: %d, repair_state: %d, prev_repair_id: %d\n",
1260 reps->id, reps->repair_length, *reps->state, reps->prev_repair->id));
1262 while (r->prev_repair)
1264 YYDPRINTF ((stderr,
"%s ", yysymbol_name (r->repair.term)));
1268 YYDPRINTF ((stderr,
"\n"));
1272 yy_print_repair_terms(
yy_repair_terms *rep_terms<%= output.user_formals %>)
1274 for (
int i = 0; i < rep_terms->length; i++)
1275 YYDPRINTF ((stderr,
"%s ", yysymbol_name (rep_terms->terms[i].kind)));
1277 YYDPRINTF ((stderr,
"\n"));
1281 yy_free_repairs(
yy_repairs *reps<%= output.user_formals %>)
1293 yy_process_repairs(
yy_repairs *reps, yysymbol_kind_t token)
1296 int yystate = *reps->state;
1298 yysymbol_kind_t yytoken = token;
1300 goto yyrecover_backup;
1305 *reps->state = (yy_state_t) yystate;
1309 yyn = yypact[yystate];
1310 if (yypact_value_is_default (yyn))
1311 goto yyrecover_default;
1314 if (yytoken == YYSYMBOL_YYEMPTY)
1318 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1319 goto yyrecover_default;
1323 if (yytable_value_is_error (yyn))
1324 goto yyrecover_errlab;
1326 goto yyrecover_reduce;
1331 yytoken = YYSYMBOL_YYEMPTY;
1332 goto yyrecover_newstate;
1336 yyn = yydefact[yystate];
1338 goto yyrecover_errlab;
1339 goto yyrecover_reduce;
1345 reps->state -= yylen;
1349 const int yylhs = yyr1[yyn] - YYNTOKENS;
1350 const int yyi = yypgoto[yylhs] + *reps->state;
1351 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *reps->state
1353 : yydefgoto[yylhs]);
1356 goto yyrecover_newstate;
1363 yyrecover(yy_state_t *yyss, yy_state_t *yyssp,
int yychar<%= output.user_formals %>)
1365 yysymbol_kind_t yytoken = YYTRANSLATE (yychar);
1372 YYPTRDIFF_T stack_length = yyssp - yyss + 1;
1376 head->stack_length = stack_length;
1377 head->states = (yy_state_t *) YYMALLOC (
sizeof (yy_state_t) * (stack_length));
1378 head->state = head->states + (yyssp - yyss);
1379 YYCOPY (head->states, yyss, stack_length);
1380 head->repair_length = 0;
1381 head->prev_repair = 0;
1383 stack_length = (stack_length * 2 > 100) ? (stack_length * 2) : 100;
1388 int yystate = *current->state;
1389 int yyn = yypact[yystate];
1391 if (!yypact_value_is_default (yyn))
1393 int yyxbegin = yyn < 0 ? -yyn : 0;
1394 int yychecklim = YYLAST - yyn + 1;
1395 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1397 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1399 if (yyx != YYSYMBOL_YYerror)
1401 if (current->repair_length + 1 > YYMAXREPAIR(<%= output.parse_param_name %>))
1407 reps->stack_length = stack_length;
1408 reps->states = (yy_state_t *) YYMALLOC (
sizeof (yy_state_t) * (stack_length));
1409 reps->state = reps->states + (current->state - current->states);
1410 YYCOPY (reps->states, current->states, current->state - current->states + 1);
1411 reps->repair_length = current->repair_length + 1;
1412 reps->prev_repair = current;
1413 reps->repair.type = inserting;
1414 reps->repair.term = (yysymbol_kind_t) yyx;
1417 if (! yy_process_repairs (reps, (yysymbol_kind_t)yyx))
1429 rep_terms = yy_create_repair_terms (current<%= output.user_args %>);
1430 YYDPRINTF ((stderr,
"repair_terms found. id: %d, length: %d\n", rep_terms->id, rep_terms->length));
1431 yy_print_repairs (current<%= output.user_args %>);
1432 yy_print_repair_terms (rep_terms<%= output.user_args %>);
1438 "New repairs is enqueued. count: %d, yystate: %d, yyx: %d\n",
1439 count, yystate, yyx));
1440 yy_print_repairs (reps<%= output.user_args %>);
1445 current = current->next;
1450 yy_free_repairs(head<%= output.user_args %>);
1454 YYDPRINTF ((stderr,
"repair_terms not found\n"));
1468 yyparse (<%= output.parse_param %>)
1470 <%# b4_declare_scanner_communication_variables -%>
1479 static const YYSTYPE yyval_default = {};
1480 (void) yyval_default;
1482 YY_INITIAL_VALUE (
static const YYSTYPE yyval_default;)
1484 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1487 static const YYLTYPE yyloc_default
1488 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1492 YYLTYPE yylloc = yyloc_default;
1494 <%# b4_declare_parser_state_variables -%>
1499 yy_state_fast_t yystate = 0;
1501 int yyerrstatus = 0;
1507 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1510 yy_state_t yyssa[YYINITDEPTH];
1511 yy_state_t *yyss = yyssa;
1512 yy_state_t *yyssp = yyss;
1528 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1536 <%-
if output.error_recovery -%>
1539 int rep_terms_index;
1545 char *yymsg = yymsgbuf;
1546 YYPTRDIFF_T yymsg_alloc =
sizeof yymsgbuf;
1548 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1554 YYDPRINTF ((stderr,
"Starting parse\n"));
1559 <%# b4_user_initial_action -%>
1560 <%= output.user_initial_action(
"/* User initialization code. */") %>
1561 #line [@oline@] [@ofile@]
1580 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1581 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1582 YY_IGNORE_USELESS_CAST_BEGIN
1583 *yyssp = YY_CAST (yy_state_t, yystate);
1584 YY_IGNORE_USELESS_CAST_END
1585 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1587 if (yyss + yystacksize - 1 <= yyssp)
1588 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1593 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1595 # if defined yyoverflow
1600 yy_state_t *yyss1 = yyss;
1608 yyoverflow (YY_(
"memory exhausted"),
1609 &yyss1, yysize * YYSIZEOF (*yyssp),
1610 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1611 &yyls1, yysize * YYSIZEOF (*yylsp),
1619 if (YYMAXDEPTH <= yystacksize)
1622 if (YYMAXDEPTH < yystacksize)
1623 yystacksize = YYMAXDEPTH;
1626 yy_state_t *yyss1 = yyss;
1627 union yyalloc *yyptr =
1628 YY_CAST (
union yyalloc *,
1629 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1632 YYSTACK_RELOCATE (yyss_alloc, yyss);
1633 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1634 YYSTACK_RELOCATE (yyls_alloc, yyls);
1635 # undef YYSTACK_RELOCATE
1637 YYSTACK_FREE (yyss1);
1641 yyssp = yyss + yysize - 1;
1642 yyvsp = yyvs + yysize - 1;
1643 yylsp = yyls + yysize - 1;
1645 YY_IGNORE_USELESS_CAST_BEGIN
1646 YYDPRINTF ((stderr,
"Stack size increased to %ld\n",
1647 YY_CAST (
long, yystacksize)));
1648 YY_IGNORE_USELESS_CAST_END
1650 if (yyss + yystacksize - 1 <= yyssp)
1656 if (yystate == YYFINAL)
1670 yyn = yypact[yystate];
1671 if (yypact_value_is_default (yyn))
1676 <%-
if output.error_recovery -%>
1677 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1679 if (yychar == YYEMPTY && rep_terms)
1682 if (rep_terms_index < rep_terms->length)
1684 YYDPRINTF ((stderr,
"An error recovery token is used\n"));
1685 yy_term term = rep_terms->terms[rep_terms_index];
1686 yytoken = term.kind;
1687 yylval = term.value;
1688 yylloc = term.location;
1689 yychar = yytranslate_inverted[yytoken];
1690 YY_SYMBOL_PRINT (
"Next error recovery token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1695 YYDPRINTF ((stderr,
"Error recovery is completed\n"));
1696 yytoken = term_backup.kind;
1697 yylval = term_backup.value;
1698 yylloc = term_backup.location;
1699 yychar = yychar_backup;
1700 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1710 if (yychar == YYEMPTY)
1712 YYDPRINTF ((stderr,
"Reading a token\n"));
1713 yychar = yylex <%= output.yylex_formals %>;
1716 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1718 yychar = <%= output.eof_symbol.id.s_value %>;
1719 yytoken = <%= output.eof_symbol.enum_name %>;
1720 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1722 else if (yychar == <%= output.error_symbol.id.s_value %>)
1728 yychar = <%= output.undef_symbol.id.s_value %>;
1729 yytoken = <%= output.error_symbol.enum_name %>;
1730 yyerror_range[1] = yylloc;
1735 yytoken = YYTRANSLATE (yychar);
1736 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1742 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1747 if (yytable_value_is_error (yyn))
1759 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc<%= output.user_args %>);
1761 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1763 YY_IGNORE_MAYBE_UNINITIALIZED_END
1765 <%= output.after_shift_function(
"/* %after-shift code. */") %>
1776 yyn = yydefact[yystate];
1797 yyval = yyvsp[1-yylen];
1798 <%= output.before_reduce_function(
"/* %before-reduce function. */") %>
1801 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1802 yyerror_range[1] = yyloc;
1803 YY_REDUCE_PRINT (yyn<%= output.user_args %>);
1806 <%= output.user_actions -%>
1821 YY_SYMBOL_PRINT (
"-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc<%= output.user_args %>);
1824 <%= output.after_reduce_function(
"/* %after-reduce function. */") %>
1834 const int yylhs = yyr1[yyn] - YYNTOKENS;
1835 const int yyi = yypgoto[yylhs] + *yyssp;
1836 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1838 : yydefgoto[yylhs]);
1850 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1857 = {yyssp, yytoken, &yylloc};
1858 char const *yymsgp = YY_(
"syntax error");
1859 int yysyntax_error_status;
1860 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
1861 if (yysyntax_error_status == 0)
1863 else if (yysyntax_error_status == -1)
1865 if (yymsg != yymsgbuf)
1866 YYSTACK_FREE (yymsg);
1867 yymsg = YY_CAST (
char *,
1868 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1871 yysyntax_error_status
1872 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
1878 yymsg_alloc =
sizeof yymsgbuf;
1879 yysyntax_error_status = YYENOMEM;
1882 yyerror (<%= output.yyerror_args %>, yymsgp);
1883 if (yysyntax_error_status == YYENOMEM)
1888 yyerror_range[1] = yylloc;
1889 if (yyerrstatus == 3)
1894 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1897 if (yychar == <%= output.eof_symbol.id.s_value %>)
1902 yydestruct (
"Error: discarding",
1903 yytoken, &yylval, &yylloc<%= output.user_args %>);
1926 <%= output.after_pop_stack_function(
"yylen",
"/* %after-pop-stack function. */") %>
1928 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1937 <%-
if output.error_recovery -%>
1938 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1940 rep_terms = yyrecover (yyss, yyssp, yychar<%= output.user_args %>);
1943 for (
int i = 0; i < rep_terms->length; i++)
1945 yy_term *term = &rep_terms->terms[i];
1946 yy_error_token_initialize (term->kind, &term->value, &term->location<%= output.user_args %>);
1949 yychar_backup = yychar;
1951 term_backup.kind = yytoken;
1952 term_backup.value = yylval;
1953 term_backup.location = yylloc;
1954 rep_terms_index = 0;
1966 yyn = yypact[yystate];
1967 if (!yypact_value_is_default (yyn))
1969 yyn += YYSYMBOL_YYerror;
1970 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1982 yyerror_range[1] = *yylsp;
1983 yydestruct (
"Error: popping",
1984 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp<%= output.user_args %>);
1986 <%= output.after_pop_stack_function(1,
"/* %after-pop-stack function. */") %>
1988 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1991 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1993 YY_IGNORE_MAYBE_UNINITIALIZED_END
1995 yyerror_range[2] = yylloc;
1997 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
2000 YY_SYMBOL_PRINT (
"Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp<%= output.user_args %>);
2001 <%= output.after_shift_error_token_function(
"/* %after-shift-error-token code. */") %>
2027 yyerror (<%= output.yyerror_args %>, YY_(
"memory exhausted"));
2036 if (yychar != YYEMPTY)
2040 yytoken = YYTRANSLATE (yychar);
2041 yydestruct (
"Cleanup: discarding lookahead",
2042 yytoken, &yylval, &yylloc<%= output.user_args %>);
2047 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
2048 while (yyssp != yyss)
2050 yydestruct (
"Cleanup: popping",
2051 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp<%= output.user_args %>);
2056 YYSTACK_FREE (yyss);
2058 if (yymsg != yymsgbuf)
2059 YYSTACK_FREE (yymsg);
2063 <%# b4_percent_code_get([[epilogue]]) -%>
2064 <%-
if output.aux.epilogue -%>
2065 #line <%= output.aux.epilogue_first_lineno - 1 %> "<%= output.grammar_file_path %>"
2066 <%= output.aux.epilogue -%>