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@]
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))
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 -%>
116typedef 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__
145typedef __INT_LEAST8_TYPE__ yytype_int8;
146#elif defined YY_STDINT_H
147typedef int_least8_t yytype_int8;
149typedef signed char yytype_int8;
152#ifdef __INT_LEAST16_MAX__
153typedef __INT_LEAST16_TYPE__ yytype_int16;
154#elif defined YY_STDINT_H
155typedef int_least16_t yytype_int16;
157typedef 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__
173typedef __UINT_LEAST8_TYPE__ yytype_uint8;
174#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
175 && UINT_LEAST8_MAX <= INT_MAX)
176typedef uint_least8_t yytype_uint8;
177#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
178typedef unsigned char yytype_uint8;
180typedef short yytype_uint8;
183#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
184typedef __UINT_LEAST16_TYPE__ yytype_uint16;
185#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
186 && UINT_LEAST16_MAX <= INT_MAX)
187typedef uint_least16_t yytype_uint16;
188#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
189typedef unsigned short yytype_uint16;
191typedef 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
213# define YYSIZE_T __SIZE_TYPE__
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). */
234typedef <%= output.int_type_for([output.yynstates - 1]) %> yy_state_t;
236/* State numbers in computations. */
237typedef 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
337# define EXIT_SUCCESS 0
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)))
365# define EXIT_SUCCESS 0
369# define YYMALLOC malloc
370# if ! defined malloc && ! defined EXIT_SUCCESS
371void *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]) \
473static const <%= output.int_type_for(output.context.yytranslate) %> yytranslate[] =
475<%= output.yytranslate %>
478<%-
if output.error_recovery -%>
480static const <%= output.int_type_for(output.context.yytranslate_inverted) %> yytranslate_inverted[] =
482<%= output.yytranslate_inverted %>
487static const <%= output.int_type_for(output.context.yyrline) %> yyrline[] =
494#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
499static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
503static const char *
const yytname[] =
509yysymbol_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 -%>
528static const <%= output.int_type_for(output.context.yypact) %> yypact[] =
530<%= output.int_array_to_string(output.context.yypact) %>
536static const <%= output.int_type_for(output.context.yydefact) %> yydefact[] =
538<%= output.int_array_to_string(output.context.yydefact) %>
542static const <%= output.int_type_for(output.context.yypgoto) %> yypgoto[] =
544<%= output.int_array_to_string(output.context.yypgoto) %>
548static const <%= output.int_type_for(output.context.yydefgoto) %> yydefgoto[] =
550<%= output.int_array_to_string(output.context.yydefgoto) %>
556static const <%= output.int_type_for(output.context.yytable) %> yytable[] =
558<%= output.int_array_to_string(output.context.yytable) %>
561static const <%= output.int_type_for(output.context.yycheck) %> yycheck[] =
563<%= output.int_array_to_string(output.context.yycheck) %>
568static const <%= output.int_type_for(output.context.yystos) %> yystos[] =
570<%= output.int_array_to_string(output.context.yystos) %>
574static const <%= output.int_type_for(output.context.yyr1) %> yyr1[] =
576<%= output.int_array_to_string(output.context.yyr1) %>
580static const <%= output.int_type_for(output.context.yyr2) %> yyr2[] =
582<%= output.int_array_to_string(output.context.yyr2) %>
586enum { 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
682yy_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 -%>
741yy_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
765yy_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,
")");
783yy_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 %>); \
806yy_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)))
919yystrlen (
const char *yystr)
922 for (yylen = 0; yystr[yylen]; yylen++)
930# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
931# define yystpcpy stpcpy
936yystpcpy (
char *yydest,
const char *yysrc)
939 const char *yys = yysrc;
941 while ((*yyd++ = *yys++) !=
'\0')
958yytnamerr (
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)
1054yysyntax_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 %>
1139yydestruct (
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
1149 YY_IGNORE_MAYBE_UNINITIALIZED_END
1154<%-
if output.error_recovery -%>
1156# define YYMAXREPAIR(<%= output.parse_param_name %>) (3)
1159#ifndef YYERROR_RECOVERY_ENABLED
1160# define YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>) (1)
1163enum yy_repair_type {
1170 enum yy_repair_type type;
1171 yysymbol_kind_t term;
1180 YYPTRDIFF_T stack_length;
1194 yysymbol_kind_t kind;
1208yy_error_token_initialize (yysymbol_kind_t yykind,
YYSTYPE *
const yyvaluep, YYLTYPE *
const yylocationp<%= output.user_formals %>)
1210 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1213<%= output.symbol_actions_for_error_token -%>
1217 YY_IGNORE_MAYBE_UNINITIALIZED_END
1221yy_create_repair_terms(
yy_repairs *reps<%= output.user_formals %>)
1227 while (r->prev_repair)
1234 rep_terms->id = reps->id;
1235 rep_terms->length = count;
1238 while (r->prev_repair)
1240 rep_terms->terms[count-1].kind = r->repair.term;
1249yy_print_repairs(
yy_repairs *reps<%= output.user_formals %>)
1254 "id: %d, repair_length: %d, repair_state: %d, prev_repair_id: %d\n",
1255 reps->id, reps->repair_length, *reps->state, reps->prev_repair->id));
1257 while (r->prev_repair)
1259 YYDPRINTF ((stderr,
"%s ", yysymbol_name (r->repair.term)));
1263 YYDPRINTF ((stderr,
"\n"));
1267yy_print_repair_terms(
yy_repair_terms *rep_terms<%= output.user_formals %>)
1269 for (
int i = 0; i < rep_terms->length; i++)
1270 YYDPRINTF ((stderr,
"%s ", yysymbol_name (rep_terms->terms[i].kind)));
1272 YYDPRINTF ((stderr,
"\n"));
1276yy_free_repairs(
yy_repairs *reps<%= output.user_formals %>)
1288yy_process_repairs(
yy_repairs *reps, yysymbol_kind_t token)
1291 int yystate = *reps->state;
1293 yysymbol_kind_t yytoken = token;
1295 goto yyrecover_backup;
1300 *reps->state = (yy_state_t) yystate;
1304 yyn = yypact[yystate];
1305 if (yypact_value_is_default (yyn))
1306 goto yyrecover_default;
1309 if (yytoken == YYSYMBOL_YYEMPTY)
1313 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1314 goto yyrecover_default;
1318 if (yytable_value_is_error (yyn))
1319 goto yyrecover_errlab;
1321 goto yyrecover_reduce;
1326 yytoken = YYSYMBOL_YYEMPTY;
1327 goto yyrecover_newstate;
1331 yyn = yydefact[yystate];
1333 goto yyrecover_errlab;
1334 goto yyrecover_reduce;
1340 reps->state -= yylen;
1344 const int yylhs = yyr1[yyn] - YYNTOKENS;
1345 const int yyi = yypgoto[yylhs] + *reps->state;
1346 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *reps->state
1348 : yydefgoto[yylhs]);
1351 goto yyrecover_newstate;
1358yyrecover(yy_state_t *yyss, yy_state_t *yyssp,
int yychar<%= output.user_formals %>)
1360 yysymbol_kind_t yytoken = YYTRANSLATE (yychar);
1367 YYPTRDIFF_T stack_length = yyssp - yyss + 1;
1371 head->stack_length = stack_length;
1372 head->states = (yy_state_t *) YYMALLOC (
sizeof (yy_state_t) * (stack_length));
1373 head->state = head->states + (yyssp - yyss);
1374 YYCOPY (head->states, yyss, stack_length);
1375 head->repair_length = 0;
1376 head->prev_repair = 0;
1378 stack_length = (stack_length * 2 > 100) ? (stack_length * 2) : 100;
1383 int yystate = *current->state;
1384 int yyn = yypact[yystate];
1386 if (!yypact_value_is_default (yyn))
1388 int yyxbegin = yyn < 0 ? -yyn : 0;
1389 int yychecklim = YYLAST - yyn + 1;
1390 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1392 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1394 if (yyx != YYSYMBOL_YYerror)
1396 if (current->repair_length + 1 > YYMAXREPAIR(<%= output.parse_param_name %>))
1402 new->stack_length = stack_length;
1403 new->states = (yy_state_t *) YYMALLOC (
sizeof (yy_state_t) * (stack_length));
1404 new->state =
new->states + (current->state - current->states);
1405 YYCOPY (new->states, current->states, current->state - current->states + 1);
1406 new->repair_length = current->repair_length + 1;
1407 new->prev_repair = current;
1408 new->repair.type = insert;
1409 new->repair.term = (yysymbol_kind_t) yyx;
1412 if (! yy_process_repairs (
new, yyx))
1424 rep_terms = yy_create_repair_terms (current<%= output.user_args %>);
1425 YYDPRINTF ((stderr,
"repair_terms found. id: %d, length: %d\n", rep_terms->id, rep_terms->length));
1426 yy_print_repairs (current<%= output.user_args %>);
1427 yy_print_repair_terms (rep_terms<%= output.user_args %>);
1433 "New repairs is enqueued. count: %d, yystate: %d, yyx: %d\n",
1434 count, yystate, yyx));
1435 yy_print_repairs (new<%= output.user_args %>);
1440 current = current->next;
1445 yy_free_repairs(head<%= output.user_args %>);
1449 YYDPRINTF ((stderr,
"repair_terms not found\n"));
1463yyparse (<%= output.parse_param %>)
1465<%# b4_declare_scanner_communication_variables -%>
1473YY_INITIAL_VALUE (
static const YYSTYPE yyval_default;)
1474YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1477static const YYLTYPE yyloc_default
1478# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1482YYLTYPE yylloc = yyloc_default;
1484<%# b4_declare_parser_state_variables -%>
1489 yy_state_fast_t yystate = 0;
1491 int yyerrstatus = 0;
1497 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1500 yy_state_t yyssa[YYINITDEPTH];
1501 yy_state_t *yyss = yyssa;
1502 yy_state_t *yyssp = yyss;
1510 YYLTYPE yylsa[YYINITDEPTH];
1511 YYLTYPE *yyls = yylsa;
1512 YYLTYPE *yylsp = yyls;
1518 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1525 YYLTYPE yyerror_range[3];
1526<%-
if output.error_recovery -%>
1529 int rep_terms_index;
1535 char *yymsg = yymsgbuf;
1536 YYPTRDIFF_T yymsg_alloc =
sizeof yymsgbuf;
1538#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1544 YYDPRINTF ((stderr,
"Starting parse\n"));
1549<%# b4_user_initial_action -%>
1550<%= output.user_initial_action(
"/* User initialization code. */") %>
1551#line [@oline@] [@ofile@]
1570 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1571 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1572 YY_IGNORE_USELESS_CAST_BEGIN
1573 *yyssp = YY_CAST (yy_state_t, yystate);
1574 YY_IGNORE_USELESS_CAST_END
1575 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1577 if (yyss + yystacksize - 1 <= yyssp)
1578#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1583 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1585# if defined yyoverflow
1590 yy_state_t *yyss1 = yyss;
1592 YYLTYPE *yyls1 = yyls;
1598 yyoverflow (YY_(
"memory exhausted"),
1599 &yyss1, yysize * YYSIZEOF (*yyssp),
1600 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1601 &yyls1, yysize * YYSIZEOF (*yylsp),
1609 if (YYMAXDEPTH <= yystacksize)
1612 if (YYMAXDEPTH < yystacksize)
1613 yystacksize = YYMAXDEPTH;
1616 yy_state_t *yyss1 = yyss;
1617 union yyalloc *yyptr =
1618 YY_CAST (
union yyalloc *,
1619 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1622 YYSTACK_RELOCATE (yyss_alloc, yyss);
1623 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1624 YYSTACK_RELOCATE (yyls_alloc, yyls);
1625# undef YYSTACK_RELOCATE
1627 YYSTACK_FREE (yyss1);
1631 yyssp = yyss + yysize - 1;
1632 yyvsp = yyvs + yysize - 1;
1633 yylsp = yyls + yysize - 1;
1635 YY_IGNORE_USELESS_CAST_BEGIN
1636 YYDPRINTF ((stderr,
"Stack size increased to %ld\n",
1637 YY_CAST (
long, yystacksize)));
1638 YY_IGNORE_USELESS_CAST_END
1640 if (yyss + yystacksize - 1 <= yyssp)
1646 if (yystate == YYFINAL)
1660 yyn = yypact[yystate];
1661 if (yypact_value_is_default (yyn))
1666<%-
if output.error_recovery -%>
1667 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1669 if (yychar == YYEMPTY && rep_terms)
1672 if (rep_terms_index < rep_terms->length)
1674 YYDPRINTF ((stderr,
"An error recovery token is used\n"));
1675 yy_term term = rep_terms->terms[rep_terms_index];
1676 yytoken = term.kind;
1677 yylval = term.value;
1678 yylloc = term.location;
1679 yychar = yytranslate_inverted[yytoken];
1680 YY_SYMBOL_PRINT (
"Next error recovery token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1685 YYDPRINTF ((stderr,
"Error recovery is completed\n"));
1686 yytoken = term_backup.kind;
1687 yylval = term_backup.value;
1688 yylloc = term_backup.location;
1689 yychar = yychar_backup;
1690 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1700 if (yychar == YYEMPTY)
1702 YYDPRINTF ((stderr,
"Reading a token\n"));
1703 yychar = yylex <%= output.yylex_formals %>;
1706 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1708 yychar = <%= output.eof_symbol.id.s_value %>;
1709 yytoken = <%= output.eof_symbol.enum_name %>;
1710 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1712 else if (yychar == <%= output.error_symbol.id.s_value %>)
1718 yychar = <%= output.undef_symbol.id.s_value %>;
1719 yytoken = <%= output.error_symbol.enum_name %>;
1720 yyerror_range[1] = yylloc;
1725 yytoken = YYTRANSLATE (yychar);
1726 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1732 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1737 if (yytable_value_is_error (yyn))
1749 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc<%= output.user_args %>);
1751 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1753 YY_IGNORE_MAYBE_UNINITIALIZED_END
1765 yyn = yydefact[yystate];
1786 yyval = yyvsp[1-yylen];
1789 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1790 yyerror_range[1] = yyloc;
1791 YY_REDUCE_PRINT (yyn<%= output.user_args %>);
1794<%= output.user_actions -%>
1809 YY_SYMBOL_PRINT (
"-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc<%= output.user_args %>);
1821 const int yylhs = yyr1[yyn] - YYNTOKENS;
1822 const int yyi = yypgoto[yylhs] + *yyssp;
1823 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1825 : yydefgoto[yylhs]);
1837 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1844 = {yyssp, yytoken, &yylloc};
1845 char const *yymsgp = YY_(
"syntax error");
1846 int yysyntax_error_status;
1847 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
1848 if (yysyntax_error_status == 0)
1850 else if (yysyntax_error_status == -1)
1852 if (yymsg != yymsgbuf)
1853 YYSTACK_FREE (yymsg);
1854 yymsg = YY_CAST (
char *,
1855 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1858 yysyntax_error_status
1859 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
1865 yymsg_alloc =
sizeof yymsgbuf;
1866 yysyntax_error_status = YYENOMEM;
1869 yyerror (<%= output.yyerror_args %>, yymsgp);
1870 if (yysyntax_error_status == YYENOMEM)
1875 yyerror_range[1] = yylloc;
1876 if (yyerrstatus == 3)
1881 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1884 if (yychar == <%= output.eof_symbol.id.s_value %>)
1889 yydestruct (
"Error: discarding",
1890 yytoken, &yylval, &yylloc<%= output.user_args %>);
1914 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1923<%-
if output.error_recovery -%>
1924 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1926 rep_terms = yyrecover (yyss, yyssp, yychar<%= output.user_args %>);
1929 for (
int i = 0; i < rep_terms->length; i++)
1931 yy_term *term = &rep_terms->terms[i];
1932 yy_error_token_initialize (term->kind, &term->value, &term->location<%= output.user_args %>);
1935 yychar_backup = yychar;
1937 term_backup.kind = yytoken;
1938 term_backup.value = yylval;
1939 term_backup.location = yylloc;
1940 rep_terms_index = 0;
1952 yyn = yypact[yystate];
1953 if (!yypact_value_is_default (yyn))
1955 yyn += YYSYMBOL_YYerror;
1956 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1968 yyerror_range[1] = *yylsp;
1969 yydestruct (
"Error: popping",
1970 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp<%= output.user_args %>);
1973 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1976 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1978 YY_IGNORE_MAYBE_UNINITIALIZED_END
1980 yyerror_range[2] = yylloc;
1982 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
1985 YY_SYMBOL_PRINT (
"Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp<%= output.user_args %>);
2011 yyerror (<%= output.yyerror_args %>, YY_(
"memory exhausted"));
2020 if (yychar != YYEMPTY)
2024 yytoken = YYTRANSLATE (yychar);
2025 yydestruct (
"Cleanup: discarding lookahead",
2026 yytoken, &yylval, &yylloc<%= output.user_args %>);
2031 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
2032 while (yyssp != yyss)
2034 yydestruct (
"Cleanup: popping",
2035 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp<%= output.user_args %>);
2040 YYSTACK_FREE (yyss);
2042 if (yymsg != yymsgbuf)
2043 YYSTACK_FREE (yymsg);
2047<%# b4_percent_code_get([[epilogue]]) -%>
2048<%-
if output.aux.epilogue -%>
2049#line <%= output.aux.epilogue_first_lineno - 1 %> "<%= output.grammar_file_path %>"
2050<%= output.aux.epilogue -%>