Ruby 3.3.7p123 (2025-01-15 revision be31f993d7fa0219d85f7b3c694d454da4ecc10b)
yacc.c
1<%# b4_generated_by -%>
2/* A Bison parser, made by Lrama <%= Lrama::VERSION %>. */
3
4<%# b4_copyright -%>
5/* Bison implementation for Yacc-like parsers in C
6
7 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
8 Inc.
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/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39<%# b4_disclaimer -%>
40/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
41 especially those whose name start with YY_ or yy_. They are
42 private implementation details that can be changed or removed. */
43
44/* All symbols defined below should begin with yy or YY, to avoid
45 infringing on user name space. This should be done even for local
46 variables, as they might otherwise be expanded by user macros.
47 There are some unavoidable exceptions within include files to
48 define necessary library symbols; they are noted "INFRINGES ON
49 USER NAME SPACE" below. */
50
51<%# b4_identification -%>
52/* Identify Bison output, and Bison version. */
53#define YYBISON 30802
54
55/* Bison version string. */
56#define YYBISON_VERSION "3.8.2"
57
58/* Skeleton name. */
59#define YYSKELETON_NAME "<%= output.template_basename %>"
60
61/* Pure parsers. */
62#define YYPURE 1
63
64/* Push parsers. */
65#define YYPUSH 0
66
67/* Pull parsers. */
68#define YYPULL 1
69
70
71<%# b4_user_pre_prologue -%>
72<%- if output.aux.prologue -%>
73/* First part of user prologue. */
74#line <%= output.aux.prologue_first_lineno %> "<%= output.grammar_file_path %>"
75<%= output.aux.prologue %>
76#line [@oline@] [@ofile@]
77<%- end -%>
78
79<%# b4_cast_define -%>
80# ifndef YY_CAST
81# ifdef __cplusplus
82# define YY_CAST(Type, Val) static_cast<Type> (Val)
83# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
84# else
85# define YY_CAST(Type, Val) ((Type) (Val))
86# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
87# endif
88# endif
89<%# b4_null_define -%>
90# ifndef YY_NULLPTR
91# if defined __cplusplus
92# if 201103L <= __cplusplus
93# define YY_NULLPTR nullptr
94# else
95# define YY_NULLPTR 0
96# endif
97# else
98# define YY_NULLPTR ((void*)0)
99# endif
100# endif
101
102<%# b4_header_include_if -%>
103<%- if output.include_header -%>
104#include "<%= output.include_header %>"
105<%- else -%>
106/* Use api.header.include to #include this header
107 instead of duplicating it here. */
108<%= output.render_partial("bison/_yacc.h") %>
109<%- end -%>
110<%# b4_declare_symbol_enum -%>
111/* Symbol kind. */
112enum yysymbol_kind_t
113{
114<%= output.symbol_enum -%>
115};
116typedef enum yysymbol_kind_t yysymbol_kind_t;
117
118
119
120
121<%# b4_user_post_prologue -%>
122<%# b4_c99_int_type_define -%>
123#ifdef short
124# undef short
125#endif
126
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. */
130
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 */
135# define YY_STDINT_H
136# endif
137#endif
138
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. */
143
144#ifdef __INT_LEAST8_MAX__
145typedef __INT_LEAST8_TYPE__ yytype_int8;
146#elif defined YY_STDINT_H
147typedef int_least8_t yytype_int8;
148#else
149typedef signed char yytype_int8;
150#endif
151
152#ifdef __INT_LEAST16_MAX__
153typedef __INT_LEAST16_TYPE__ yytype_int16;
154#elif defined YY_STDINT_H
155typedef int_least16_t yytype_int16;
156#else
157typedef short yytype_int16;
158#endif
159
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>. */
165#ifdef __hpux
166# undef UINT_LEAST8_MAX
167# undef UINT_LEAST16_MAX
168# define UINT_LEAST8_MAX 255
169# define UINT_LEAST16_MAX 65535
170#endif
171
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;
179#else
180typedef short yytype_uint8;
181#endif
182
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;
190#else
191typedef int yytype_uint16;
192#endif
193
194<%# b4_sizes_types_define -%>
195#ifndef YYPTRDIFF_T
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
200# ifndef ptrdiff_t
201# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
202# endif
203# define YYPTRDIFF_T ptrdiff_t
204# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
205# else
206# define YYPTRDIFF_T long
207# define YYPTRDIFF_MAXIMUM LONG_MAX
208# endif
209#endif
210
211#ifndef YYSIZE_T
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
219# else
220# define YYSIZE_T unsigned
221# endif
222#endif
223
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)))
229
230#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
231
232
233/* Stored state numbers (used for stacks). */
234typedef <%= output.int_type_for([output.yynstates - 1]) %> yy_state_t;
235
236/* State numbers in computations. */
237typedef int yy_state_fast_t;
238
239#ifndef YY_
240# if defined YYENABLE_NLS && YYENABLE_NLS
241# if ENABLE_NLS
242# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
243# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
244# endif
245# endif
246# ifndef YY_
247# define YY_(Msgid) Msgid
248# endif
249#endif
250
251
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__))
256# else
257# define YY_ATTRIBUTE_PURE
258# endif
259#endif
260
261#ifndef YY_ATTRIBUTE_UNUSED
262# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
263# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
264# else
265# define YY_ATTRIBUTE_UNUSED
266# endif
267#endif
268
269/* Suppress unused-variable warnings by "using" E. */
270#if ! defined lint || defined __GNUC__
271# define YY_USE(E) ((void) (E))
272#else
273# define YY_USE(E) /* empty */
274#endif
275
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\"")
282# else
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\"")
287# endif
288# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
289 _Pragma ("GCC diagnostic pop")
290#else
291# define YY_INITIAL_VALUE(Value) Value
292#endif
293#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
294# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
295# define YY_IGNORE_MAYBE_UNINITIALIZED_END
296#endif
297#ifndef YY_INITIAL_VALUE
298# define YY_INITIAL_VALUE(Value) /* Nothing. */
299#endif
300
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")
307#endif
308#ifndef YY_IGNORE_USELESS_CAST_BEGIN
309# define YY_IGNORE_USELESS_CAST_BEGIN
310# define YY_IGNORE_USELESS_CAST_END
311#endif
312
313
314#define YY_ASSERT(E) ((void) (0 && (E)))
315
316#if 1
317
318/* The parser invokes alloca or malloc; define the necessary symbols. */
319
320# ifdef YYSTACK_USE_ALLOCA
321# if YYSTACK_USE_ALLOCA
322# ifdef __GNUC__
323# define YYSTACK_ALLOC __builtin_alloca
324# elif defined __BUILTIN_VA_ARG_INCR
325# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
326# elif defined _AIX
327# define YYSTACK_ALLOC __alloca
328# elif defined _MSC_VER
329# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
330# define alloca _alloca
331# else
332# define YYSTACK_ALLOC alloca
333# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
334# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
335 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
336# ifndef EXIT_SUCCESS
337# define EXIT_SUCCESS 0
338# endif
339# endif
340# endif
341# endif
342# endif
343
344# ifdef YYSTACK_ALLOC
345 /* Pacify GCC's 'empty if-body' warning. */
346# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
347# ifndef YYSTACK_ALLOC_MAXIMUM
348 /* The OS might guarantee only one guard page at the bottom of the stack,
349 and a page size can be as small as 4096 bytes. So we cannot safely
350 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
351 to allow for a few compiler-allocated temporary stack slots. */
352# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
353# endif
354# else
355# define YYSTACK_ALLOC YYMALLOC
356# define YYSTACK_FREE YYFREE
357# ifndef YYSTACK_ALLOC_MAXIMUM
358# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
359# endif
360# if (defined __cplusplus && ! defined EXIT_SUCCESS \
361 && ! ((defined YYMALLOC || defined malloc) \
362 && (defined YYFREE || defined free)))
363# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
364# ifndef EXIT_SUCCESS
365# define EXIT_SUCCESS 0
366# endif
367# endif
368# ifndef YYMALLOC
369# define YYMALLOC malloc
370# if ! defined malloc && ! defined EXIT_SUCCESS
371void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
372# endif
373# endif
374# ifndef YYFREE
375# define YYFREE free
376# if ! defined free && ! defined EXIT_SUCCESS
377void free (void *); /* INFRINGES ON USER NAME SPACE */
378# endif
379# endif
380# endif
381#endif /* 1 */
382
383#if (! defined yyoverflow \
384 && (! defined __cplusplus \
385 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
386 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
387
388/* A type that is properly aligned for any stack member. */
389union yyalloc
390{
391 yy_state_t yyss_alloc;
392 YYSTYPE yyvs_alloc;
393 YYLTYPE yyls_alloc;
394};
395
396/* The size of the maximum gap between one aligned stack and the next. */
397# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
398
399/* The size of an array large to enough to hold all stacks, each with
400 N elements. */
401# define YYSTACK_BYTES(N) \
402 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
403 + YYSIZEOF (YYLTYPE)) \
404 + 2 * YYSTACK_GAP_MAXIMUM)
405
406# define YYCOPY_NEEDED 1
407
408/* Relocate STACK from its old location to the new one. The
409 local variables YYSIZE and YYSTACKSIZE give the old and new number of
410 elements in the stack, and YYPTR gives the new location of the
411 stack. Advance YYPTR to a properly aligned location for the next
412 stack. */
413# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
414 do \
415 { \
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); \
421 } \
422 while (0)
423
424#endif
425
426#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
427/* Copy COUNT objects from SRC to DST. The source and destination do
428 not overlap. */
429# ifndef YYCOPY
430# if defined __GNUC__ && 1 < __GNUC__
431# define YYCOPY(Dst, Src, Count) \
432 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
433# else
434# define YYCOPY(Dst, Src, Count) \
435 do \
436 { \
437 YYPTRDIFF_T yyi; \
438 for (yyi = 0; yyi < (Count); yyi++) \
439 (Dst)[yyi] = (Src)[yyi]; \
440 } \
441 while (0)
442# endif
443# endif
444#endif /* !YYCOPY_NEEDED */
445
446/* YYFINAL -- State number of the termination state. */
447#define YYFINAL <%= output.yyfinal %>
448/* YYLAST -- Last index in YYTABLE. */
449#define YYLAST <%= output.yylast %>
450
451/* YYNTOKENS -- Number of terminals. */
452#define YYNTOKENS <%= output.yyntokens %>
453/* YYNNTS -- Number of nonterminals. */
454#define YYNNTS <%= output.yynnts %>
455/* YYNRULES -- Number of rules. */
456#define YYNRULES <%= output.yynrules %>
457/* YYNSTATES -- Number of states. */
458#define YYNSTATES <%= output.yynstates %>
459
460/* YYMAXUTOK -- Last valid token kind. */
461#define YYMAXUTOK <%= output.yymaxutok %>
462
463
464/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
465 as returned by yylex, with out-of-bounds checking. */
466#define YYTRANSLATE(YYX) \
467 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
468 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
469 : YYSYMBOL_YYUNDEF)
470
471/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
472 as returned by yylex. */
473static const <%= output.int_type_for(output.context.yytranslate) %> yytranslate[] =
474{
475<%= output.yytranslate %>
476};
477
478<%- if output.error_recovery -%>
479/* YYTRANSLATE_INVERTED[SYMBOL-NUM] -- Token number corresponding to SYMBOL-NUM */
480static const <%= output.int_type_for(output.context.yytranslate_inverted) %> yytranslate_inverted[] =
481{
482<%= output.yytranslate_inverted %>
483};
484<%- end -%>
485#if YYDEBUG
486/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
487static const <%= output.int_type_for(output.context.yyrline) %> yyrline[] =
488{
489<%= output.yyrline %>
490};
491#endif
492
494#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
495
496#if 1
497/* The user-facing name of the symbol whose (internal) number is
498 YYSYMBOL. No bounds checking. */
499static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
500
501/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
502 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
503static const char *const yytname[] =
504{
505<%= output.yytname %>
506};
507
508static const char *
509yysymbol_name (yysymbol_kind_t yysymbol)
510{
511 return yytname[yysymbol];
512}
513#endif
514
515#define YYPACT_NINF (<%= output.yypact_ninf %>)
516
517#define yypact_value_is_default(Yyn) \
518 <%= output.table_value_equals(output.context.yypact, "Yyn", output.yypact_ninf, "YYPACT_NINF") %>
519
520#define YYTABLE_NINF (<%= output.yytable_ninf %>)
521
522#define yytable_value_is_error(Yyn) \
523 <%= output.table_value_equals(output.context.yytable, "Yyn", output.yytable_ninf, "YYTABLE_NINF") %>
524
525<%# b4_parser_tables_define -%>
526/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
527 STATE-NUM. */
528static const <%= output.int_type_for(output.context.yypact) %> yypact[] =
529{
530<%= output.int_array_to_string(output.context.yypact) %>
531};
532
533/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
534 Performed when YYTABLE does not specify something else to do. Zero
535 means the default is an error. */
536static const <%= output.int_type_for(output.context.yydefact) %> yydefact[] =
537{
538<%= output.int_array_to_string(output.context.yydefact) %>
539};
540
541/* YYPGOTO[NTERM-NUM]. */
542static const <%= output.int_type_for(output.context.yypgoto) %> yypgoto[] =
543{
544<%= output.int_array_to_string(output.context.yypgoto) %>
545};
546
547/* YYDEFGOTO[NTERM-NUM]. */
548static const <%= output.int_type_for(output.context.yydefgoto) %> yydefgoto[] =
549{
550<%= output.int_array_to_string(output.context.yydefgoto) %>
551};
552
553/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
554 positive, shift that token. If negative, reduce the rule whose
555 number is the opposite. If YYTABLE_NINF, syntax error. */
556static const <%= output.int_type_for(output.context.yytable) %> yytable[] =
557{
558<%= output.int_array_to_string(output.context.yytable) %>
559};
560
561static const <%= output.int_type_for(output.context.yycheck) %> yycheck[] =
562{
563<%= output.int_array_to_string(output.context.yycheck) %>
564};
565
566/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
567 state STATE-NUM. */
568static const <%= output.int_type_for(output.context.yystos) %> yystos[] =
569{
570<%= output.int_array_to_string(output.context.yystos) %>
571};
572
573/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
574static const <%= output.int_type_for(output.context.yyr1) %> yyr1[] =
575{
576<%= output.int_array_to_string(output.context.yyr1) %>
577};
578
579/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
580static const <%= output.int_type_for(output.context.yyr2) %> yyr2[] =
581{
582<%= output.int_array_to_string(output.context.yyr2) %>
583};
584
585
586enum { YYENOMEM = -2 };
587
588#define yyerrok (yyerrstatus = 0)
589#define yyclearin (yychar = YYEMPTY)
590
591#define YYACCEPT goto yyacceptlab
592#define YYABORT goto yyabortlab
593#define YYERROR goto yyerrorlab
594#define YYNOMEM goto yyexhaustedlab
595
596
597#define YYRECOVERING() (!!yyerrstatus)
598
599#define YYBACKUP(Token, Value) \
600 do \
601 if (yychar == YYEMPTY) \
602 { \
603 yychar = (Token); \
604 yylval = (Value); \
605 YYPOPSTACK (yylen); \
606 yystate = *yyssp; \
607 goto yybackup; \
608 } \
609 else \
610 { \
611 yyerror (<%= output.yyerror_args %>, YY_("syntax error: cannot back up")); \
612 YYERROR; \
613 } \
614 while (0)
615
616/* Backward compatibility with an undocumented macro.
617 Use YYerror or YYUNDEF. */
618#define YYERRCODE YYUNDEF
619
620<%# b4_yylloc_default_define -%>
621/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
622 If N is 0, then set CURRENT to the empty location which ends
623 the previous symbol: RHS[0] (always defined). */
624
625#ifndef YYLLOC_DEFAULT
626# define YYLLOC_DEFAULT(Current, Rhs, N) \
627 do \
628 if (N) \
629 { \
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; \
634 } \
635 else \
636 { \
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; \
641 } \
642 while (0)
643#endif
644
645#define YYRHSLOC(Rhs, K) ((Rhs)[K])
646
647
648/* Enable debugging if requested. */
649#if YYDEBUG
650
651# ifndef YYFPRINTF
652# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
653# define YYFPRINTF fprintf
654# endif
655
656# define YYDPRINTF(Args) \
657do { \
658 if (yydebug) \
659 YYFPRINTF Args; \
660} while (0)
661
662
663<%# b4_yylocation_print_define -%>
664/* YYLOCATION_PRINT -- Print the location on the stream.
665 This macro was not mandated originally: define only if we know
666 we won't break user code: when these are the locations we know. */
667
668# ifndef YYLOCATION_PRINT
669
670# if defined YY_LOCATION_PRINT
671
672 /* Temporary convenience wrapper in case some people defined the
673 undocumented and private YY_LOCATION_PRINT macros. */
674# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) YY_LOCATION_PRINT(File, *(Loc)<%= output.user_args %>)
675
676# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
677
678/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
679
680YY_ATTRIBUTE_UNUSED
681static int
682yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
683{
684 int res = 0;
685 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
686 if (0 <= yylocp->first_line)
687 {
688 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
689 if (0 <= yylocp->first_column)
690 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
691 }
692 if (0 <= yylocp->last_line)
693 {
694 if (yylocp->first_line < yylocp->last_line)
695 {
696 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
697 if (0 <= end_col)
698 res += YYFPRINTF (yyo, ".%d", end_col);
699 }
700 else if (0 <= end_col && yylocp->first_column < end_col)
701 res += YYFPRINTF (yyo, "-%d", end_col);
702 }
703 return res;
704}
705
706# define YYLOCATION_PRINT yy_location_print_
707
708 /* Temporary convenience wrapper in case some people defined the
709 undocumented and private YY_LOCATION_PRINT macros. */
710# define YY_LOCATION_PRINT(File, Loc<%= output.user_args %>) YYLOCATION_PRINT(File, &(Loc)<%= output.user_args %>)
711
712# else
713
714# define YYLOCATION_PRINT(File, Loc<%= output.user_args %>) ((void) 0)
715 /* Temporary convenience wrapper in case some people defined the
716 undocumented and private YY_LOCATION_PRINT macros. */
717# define YY_LOCATION_PRINT YYLOCATION_PRINT
718
719# endif
720# endif /* !defined YYLOCATION_PRINT */
721
722
723# define YY_SYMBOL_PRINT(Title, Kind, Value, Location<%= output.user_args %>) \
724do { \
725 if (yydebug) \
726 { \
727 YYFPRINTF (stderr, "%s ", Title); \
728 yy_symbol_print (stderr, \
729 Kind, Value, Location<%= output.user_args %>); \
730 YYFPRINTF (stderr, "\n"); \
731 } \
732} while (0)
733
734
735<%# b4_yy_symbol_print_define -%>
736/*-----------------------------------.
737| Print this symbol's value on YYO. |
738`-----------------------------------*/
739
740static void
741yy_symbol_value_print (FILE *yyo,
742 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp<%= output.user_formals %>)
743{
744 FILE *yyoutput = yyo;
745<%= output.parse_param_use("yyoutput", "yylocationp") %>
746 if (!yyvaluep)
747 return;
748 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
749<%# b4_symbol_actions(printer) -%>
750switch (yykind)
751 {
752<%= output.symbol_actions_for_printer -%>
753 default:
754 break;
755 }
756 YY_IGNORE_MAYBE_UNINITIALIZED_END
757}
758
759
760/*---------------------------.
761| Print this symbol on YYO. |
762`---------------------------*/
763
764static void
765yy_symbol_print (FILE *yyo,
766 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp<%= output.user_formals %>)
767{
768 YYFPRINTF (yyo, "%s %s (",
769 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
770
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, ")");
775}
776
777/*------------------------------------------------------------------.
778| yy_stack_print -- Print the state stack from its BOTTOM up to its |
779| TOP (included). |
780`------------------------------------------------------------------*/
781
782static void
783yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop<%= output.user_formals %>)
784{
785 YYFPRINTF (stderr, "Stack now");
786 for (; yybottom <= yytop; yybottom++)
787 {
788 int yybot = *yybottom;
789 YYFPRINTF (stderr, " %d", yybot);
790 }
791 YYFPRINTF (stderr, "\n");
792}
793
794# define YY_STACK_PRINT(Bottom, Top<%= output.user_args %>) \
795do { \
796 if (yydebug) \
797 yy_stack_print ((Bottom), (Top)<%= output.user_args %>); \
798} while (0)
799
800
801/*------------------------------------------------.
802| Report that the YYRULE is going to be reduced. |
803`------------------------------------------------*/
804
805static void
806yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
807 int yyrule<%= output.user_formals %>)
808{
809 int yylno = yyrline[yyrule];
810 int yynrhs = yyr2[yyrule];
811 int yyi;
812 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
813 yyrule - 1, yylno);
814 /* The symbols being reduced. */
815 for (yyi = 0; yyi < yynrhs; yyi++)
816 {
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");
823 }
824}
825
826# define YY_REDUCE_PRINT(Rule<%= output.user_args %>) \
827do { \
828 if (yydebug) \
829 yy_reduce_print (yyssp, yyvsp, yylsp, Rule<%= output.user_args %>); \
830} while (0)
831
832/* Nonzero means print parse trace. It is left uninitialized so that
833 multiple parsers can coexist. */
834#ifndef yydebug
835int yydebug;
836#endif
837#else /* !YYDEBUG */
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 %>)
842#endif /* !YYDEBUG */
843
844
845/* YYINITDEPTH -- initial size of the parser's stacks. */
846#ifndef YYINITDEPTH
847# define YYINITDEPTH 200
848#endif
849
850/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
851 if the built-in stack extension method is used).
852
853 Do not make this value too large; the results are undefined if
854 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
855 evaluated with infinite-precision integer arithmetic. */
856
857#ifndef YYMAXDEPTH
858# define YYMAXDEPTH 10000
859#endif
860
861
862/* Context of a parse error. */
863typedef struct
864{
865 yy_state_t *yyssp;
866 yysymbol_kind_t yytoken;
867 YYLTYPE *yylloc;
869
870/* Put in YYARG at most YYARGN of the expected tokens given the
871 current YYCTX, and return the number of tokens stored in YYARG. If
872 YYARG is null, return the number of expected tokens (guaranteed to
873 be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
874 Return 0 if there are more than YYARGN expected tokens, yet fill
875 YYARG up to YYARGN. */
876static int
877yypcontext_expected_tokens (const yypcontext_t *yyctx,
878 yysymbol_kind_t yyarg[], int yyargn)
879{
880 /* Actual size of YYARG. */
881 int yycount = 0;
882 int yyn = yypact[+*yyctx->yyssp];
883 if (!yypact_value_is_default (yyn))
884 {
885 /* Start YYX at -YYN if negative to avoid negative indexes in
886 YYCHECK. In other words, skip the first -YYN actions for
887 this state because they are default actions. */
888 int yyxbegin = yyn < 0 ? -yyn : 0;
889 /* Stay within bounds of both yycheck and yytname. */
890 int yychecklim = YYLAST - yyn + 1;
891 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
892 int yyx;
893 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
894 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
895 && !yytable_value_is_error (yytable[yyx + yyn]))
896 {
897 if (!yyarg)
898 ++yycount;
899 else if (yycount == yyargn)
900 return 0;
901 else
902 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
903 }
904 }
905 if (yyarg && yycount == 0 && 0 < yyargn)
906 yyarg[0] = YYSYMBOL_YYEMPTY;
907 return yycount;
908}
909
910
911
912
913#ifndef yystrlen
914# if defined __GLIBC__ && defined _STRING_H
915# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
916# else
917/* Return the length of YYSTR. */
918static YYPTRDIFF_T
919yystrlen (const char *yystr)
920{
921 YYPTRDIFF_T yylen;
922 for (yylen = 0; yystr[yylen]; yylen++)
923 continue;
924 return yylen;
925}
926# endif
927#endif
928
929#ifndef yystpcpy
930# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
931# define yystpcpy stpcpy
932# else
933/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
934 YYDEST. */
935static char *
936yystpcpy (char *yydest, const char *yysrc)
937{
938 char *yyd = yydest;
939 const char *yys = yysrc;
940
941 while ((*yyd++ = *yys++) != '\0')
942 continue;
943
944 return yyd - 1;
945}
946# endif
947#endif
948
949#ifndef yytnamerr
950/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
951 quotes and backslashes, so that it's suitable for yyerror. The
952 heuristic is that double-quoting is unnecessary unless the string
953 contains an apostrophe, a comma, or backslash (other than
954 backslash-backslash). YYSTR is taken from yytname. If YYRES is
955 null, do not copy; instead, return the length of what the result
956 would have been. */
957static YYPTRDIFF_T
958yytnamerr (char *yyres, const char *yystr)
959{
960 if (*yystr == '"')
961 {
962 YYPTRDIFF_T yyn = 0;
963 char const *yyp = yystr;
964 for (;;)
965 switch (*++yyp)
966 {
967 case '\'':
968 case ',':
969 goto do_not_strip_quotes;
970
971 case '\\':
972 if (*++yyp != '\\')
973 goto do_not_strip_quotes;
974 else
975 goto append;
976
977 append:
978 default:
979 if (yyres)
980 yyres[yyn] = *yyp;
981 yyn++;
982 break;
983
984 case '"':
985 if (yyres)
986 yyres[yyn] = '\0';
987 return yyn;
988 }
989 do_not_strip_quotes: ;
990 }
991
992 if (yyres)
993 return yystpcpy (yyres, yystr) - yyres;
994 else
995 return yystrlen (yystr);
996}
997#endif
998
999
1000static int
1001yy_syntax_error_arguments (const yypcontext_t *yyctx,
1002 yysymbol_kind_t yyarg[], int yyargn)
1003{
1004 /* Actual size of YYARG. */
1005 int yycount = 0;
1006 /* There are many possibilities here to consider:
1007 - If this state is a consistent state with a default action, then
1008 the only way this function was invoked is if the default action
1009 is an error action. In that case, don't check for expected
1010 tokens because there are none.
1011 - The only way there can be no lookahead present (in yychar) is if
1012 this state is a consistent state with a default action. Thus,
1013 detecting the absence of a lookahead is sufficient to determine
1014 that there is no unexpected or expected token to report. In that
1015 case, just report a simple "syntax error".
1016 - Don't assume there isn't a lookahead just because this state is a
1017 consistent state with a default action. There might have been a
1018 previous inconsistent state, consistent state with a non-default
1019 action, or user semantic action that manipulated yychar.
1020 - Of course, the expected token list depends on states to have
1021 correct lookahead information, and it depends on the parser not
1022 to perform extra reductions after fetching a lookahead from the
1023 scanner and before detecting a syntax error. Thus, state merging
1024 (from LALR or IELR) and default reductions corrupt the expected
1025 token list. However, the list is correct for canonical LR with
1026 one exception: it will still contain any token that will not be
1027 accepted due to an error action in a later state.
1028 */
1029 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1030 {
1031 int yyn;
1032 if (yyarg)
1033 yyarg[yycount] = yyctx->yytoken;
1034 ++yycount;
1035 yyn = yypcontext_expected_tokens (yyctx,
1036 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1037 if (yyn == YYENOMEM)
1038 return YYENOMEM;
1039 else
1040 yycount += yyn;
1041 }
1042 return yycount;
1043}
1044
1045/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1046 about the unexpected token YYTOKEN for the state stack whose top is
1047 YYSSP.
1048
1049 Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1050 not large enough to hold the message. In that case, also set
1051 *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1052 required number of bytes is too large to store. */
1053static int
1054yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1055 const yypcontext_t *yyctx<%= output.user_formals %>)
1056{
1057 enum { YYARGS_MAX = 5 };
1058 /* Internationalized format string. */
1059 const char *yyformat = YY_NULLPTR;
1060 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1061 one per "expected"). */
1062 yysymbol_kind_t yyarg[YYARGS_MAX];
1063 /* Cumulated lengths of YYARG. */
1064 YYPTRDIFF_T yysize = 0;
1065
1066 /* Actual size of YYARG. */
1067 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1068 if (yycount == YYENOMEM)
1069 return YYENOMEM;
1070
1071 switch (yycount)
1072 {
1073#define YYCASE_(N, S) \
1074 case N: \
1075 yyformat = S; \
1076 break
1077 default: /* Avoid compiler warnings. */
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"));
1084#undef YYCASE_
1085 }
1086
1087 /* Compute error message size. Don't count the "%s"s, but reserve
1088 room for the terminator. */
1089 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1090 {
1091 int yyi;
1092 for (yyi = 0; yyi < yycount; ++yyi)
1093 {
1094 YYPTRDIFF_T yysize1
1095 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1096 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1097 yysize = yysize1;
1098 else
1099 return YYENOMEM;
1100 }
1101 }
1102
1103 if (*yymsg_alloc < yysize)
1104 {
1105 *yymsg_alloc = 2 * yysize;
1106 if (! (yysize <= *yymsg_alloc
1107 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1108 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1109 return -1;
1110 }
1111
1112 /* Avoid sprintf, as that infringes on the user's name space.
1113 Don't have undefined behavior even if the translation
1114 produced a string with the wrong number of "%s"s. */
1115 {
1116 char *yyp = *yymsg;
1117 int yyi = 0;
1118 while ((*yyp = *yyformat) != '\0')
1119 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1120 {
1121 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1122 yyformat += 2;
1123 }
1124 else
1125 {
1126 ++yyp;
1127 ++yyformat;
1128 }
1129 }
1130 return 0;
1131}
1132
1133<%# b4_yydestruct_define %>
1134/*-----------------------------------------------.
1135| Release the memory associated to this symbol. |
1136`-----------------------------------------------*/
1137
1138static void
1139yydestruct (const char *yymsg,
1140 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp<%= output.user_formals %>)
1141{
1142<%= output.parse_param_use("yyvaluep", "yylocationp") %>
1143 if (!yymsg)
1144 yymsg = "Deleting";
1145 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp<%= output.user_args %>);
1146
1147 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1148 YY_USE (yykind);
1149 YY_IGNORE_MAYBE_UNINITIALIZED_END
1150}
1151
1152
1153
1154<%- if output.error_recovery -%>
1155#ifndef YYMAXREPAIR
1156# define YYMAXREPAIR(<%= output.parse_param_name %>) (3)
1157#endif
1158
1159#ifndef YYERROR_RECOVERY_ENABLED
1160# define YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>) (1)
1161#endif
1162
1163enum yy_repair_type {
1164 insert,
1165 delete,
1166 shift,
1167};
1168
1170 enum yy_repair_type type;
1171 yysymbol_kind_t term;
1172};
1173typedef struct yy_repair yy_repair;
1174
1176 /* For debug */
1177 int id;
1178 /* For breadth-first traversing */
1179 struct yy_repairs *next;
1180 YYPTRDIFF_T stack_length;
1181 /* Bottom of states */
1182 yy_state_t *states;
1183 /* Top of states */
1184 yy_state_t *state;
1185 /* repair length */
1186 int repair_length;
1187 /* */
1188 struct yy_repairs *prev_repair;
1189 struct yy_repair repair;
1190};
1191typedef struct yy_repairs yy_repairs;
1192
1193struct yy_term {
1194 yysymbol_kind_t kind;
1195 YYSTYPE value;
1196 YYLTYPE location;
1197};
1198typedef struct yy_term yy_term;
1199
1201 int id;
1202 int length;
1203 yy_term terms[];
1204};
1205typedef struct yy_repair_terms yy_repair_terms;
1206
1207static void
1208yy_error_token_initialize (yysymbol_kind_t yykind, YYSTYPE * const yyvaluep, YYLTYPE * const yylocationp<%= output.user_formals %>)
1209{
1210 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1211switch (yykind)
1212 {
1213<%= output.symbol_actions_for_error_token -%>
1214 default:
1215 break;
1216 }
1217 YY_IGNORE_MAYBE_UNINITIALIZED_END
1218}
1219
1220static yy_repair_terms *
1221yy_create_repair_terms(yy_repairs *reps<%= output.user_formals %>)
1222{
1223 yy_repairs *r = reps;
1224 yy_repair_terms *rep_terms;
1225 int count = 0;
1226
1227 while (r->prev_repair)
1228 {
1229 count++;
1230 r = r->prev_repair;
1231 }
1232
1233 rep_terms = (yy_repair_terms *) YYMALLOC (sizeof (yy_repair_terms) + sizeof (yy_term) * count);
1234 rep_terms->id = reps->id;
1235 rep_terms->length = count;
1236
1237 r = reps;
1238 while (r->prev_repair)
1239 {
1240 rep_terms->terms[count-1].kind = r->repair.term;
1241 count--;
1242 r = r->prev_repair;
1243 }
1244
1245 return rep_terms;
1246}
1247
1248static void
1249yy_print_repairs(yy_repairs *reps<%= output.user_formals %>)
1250{
1251 yy_repairs *r = reps;
1252
1253 YYDPRINTF ((stderr,
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));
1256
1257 while (r->prev_repair)
1258 {
1259 YYDPRINTF ((stderr, "%s ", yysymbol_name (r->repair.term)));
1260 r = r->prev_repair;
1261 }
1262
1263 YYDPRINTF ((stderr, "\n"));
1264}
1265
1266static void
1267yy_print_repair_terms(yy_repair_terms *rep_terms<%= output.user_formals %>)
1268{
1269 for (int i = 0; i < rep_terms->length; i++)
1270 YYDPRINTF ((stderr, "%s ", yysymbol_name (rep_terms->terms[i].kind)));
1271
1272 YYDPRINTF ((stderr, "\n"));
1273}
1274
1275static void
1276yy_free_repairs(yy_repairs *reps<%= output.user_formals %>)
1277{
1278 while (reps)
1279 {
1280 yy_repairs *r = reps;
1281 reps = reps->next;
1282 YYFREE (r->states);
1283 YYFREE (r);
1284 }
1285}
1286
1287static int
1288yy_process_repairs(yy_repairs *reps, yysymbol_kind_t token)
1289{
1290 int yyn;
1291 int yystate = *reps->state;
1292 int yylen = 0;
1293 yysymbol_kind_t yytoken = token;
1294
1295 goto yyrecover_backup;
1296
1297yyrecover_newstate:
1298 // TODO: check reps->stack_length
1299 reps->state += 1;
1300 *reps->state = (yy_state_t) yystate;
1301
1302
1303yyrecover_backup:
1304 yyn = yypact[yystate];
1305 if (yypact_value_is_default (yyn))
1306 goto yyrecover_default;
1307
1308 /* "Reading a token" */
1309 if (yytoken == YYSYMBOL_YYEMPTY)
1310 return 1;
1311
1312 yyn += yytoken;
1313 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1314 goto yyrecover_default;
1315 yyn = yytable[yyn];
1316 if (yyn <= 0)
1317 {
1318 if (yytable_value_is_error (yyn))
1319 goto yyrecover_errlab;
1320 yyn = -yyn;
1321 goto yyrecover_reduce;
1322 }
1323
1324 /* shift */
1325 yystate = yyn;
1326 yytoken = YYSYMBOL_YYEMPTY;
1327 goto yyrecover_newstate;
1328
1329
1330yyrecover_default:
1331 yyn = yydefact[yystate];
1332 if (yyn == 0)
1333 goto yyrecover_errlab;
1334 goto yyrecover_reduce;
1335
1336
1337yyrecover_reduce:
1338 yylen = yyr2[yyn];
1339 /* YYPOPSTACK */
1340 reps->state -= yylen;
1341 yylen = 0;
1342
1343 {
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
1347 ? yytable[yyi]
1348 : yydefgoto[yylhs]);
1349 }
1350
1351 goto yyrecover_newstate;
1352
1353yyrecover_errlab:
1354 return 0;
1355}
1356
1357static yy_repair_terms *
1358yyrecover(yy_state_t *yyss, yy_state_t *yyssp, int yychar<%= output.user_formals %>)
1359{
1360 yysymbol_kind_t yytoken = YYTRANSLATE (yychar);
1361 yy_repair_terms *rep_terms = YY_NULLPTR;
1362 int count = 0;
1363
1364 yy_repairs *head = (yy_repairs *) YYMALLOC (sizeof (yy_repairs));
1365 yy_repairs *current = head;
1366 yy_repairs *tail = head;
1367 YYPTRDIFF_T stack_length = yyssp - yyss + 1;
1368
1369 head->id = count;
1370 head->next = 0;
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;
1377
1378 stack_length = (stack_length * 2 > 100) ? (stack_length * 2) : 100;
1379 count++;
1380
1381 while (current)
1382 {
1383 int yystate = *current->state;
1384 int yyn = yypact[yystate];
1385 /* See also: yypcontext_expected_tokens */
1386 if (!yypact_value_is_default (yyn))
1387 {
1388 int yyxbegin = yyn < 0 ? -yyn : 0;
1389 int yychecklim = YYLAST - yyn + 1;
1390 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1391 int yyx;
1392 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1393 {
1394 if (yyx != YYSYMBOL_YYerror)
1395 {
1396 if (current->repair_length + 1 > YYMAXREPAIR(<%= output.parse_param_name %>))
1397 continue;
1398
1399 yy_repairs *new = (yy_repairs *) YYMALLOC (sizeof (yy_repairs));
1400 new->id = count;
1401 new->next = 0;
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;
1410
1411 /* Process PDA assuming next token is yyx */
1412 if (! yy_process_repairs (new, yyx))
1413 {
1414 YYFREE (new);
1415 continue;
1416 }
1417
1418 tail->next = new;
1419 tail = new;
1420 count++;
1421
1422 if (yyx == yytoken)
1423 {
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 %>);
1428
1429 goto done;
1430 }
1431
1432 YYDPRINTF ((stderr,
1433 "New repairs is enqueued. count: %d, yystate: %d, yyx: %d\n",
1434 count, yystate, yyx));
1435 yy_print_repairs (new<%= output.user_args %>);
1436 }
1437 }
1438 }
1439
1440 current = current->next;
1441 }
1442
1443done:
1444
1445 yy_free_repairs(head<%= output.user_args %>);
1446
1447 if (!rep_terms)
1448 {
1449 YYDPRINTF ((stderr, "repair_terms not found\n"));
1450 }
1451
1452 return rep_terms;
1453}
1454<%- end -%>
1455
1456
1457
1458/*----------.
1459| yyparse. |
1460`----------*/
1461
1462int
1463yyparse (<%= output.parse_param %>)
1464{
1465<%# b4_declare_scanner_communication_variables -%>
1466/* Lookahead token kind. */
1467int yychar;
1468
1469
1470/* The semantic value of the lookahead symbol. */
1471/* Default value used for initialization, for pacifying older GCCs
1472 or non-GCC compilers. */
1473YY_INITIAL_VALUE (static const YYSTYPE yyval_default;)
1474YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1475
1476/* Location data for the lookahead symbol. */
1477static const YYLTYPE yyloc_default
1478# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1479 = { 1, 1, 1, 1 }
1480# endif
1481;
1482YYLTYPE yylloc = yyloc_default;
1483
1484<%# b4_declare_parser_state_variables -%>
1485 /* Number of syntax errors so far. */
1486 int yynerrs = 0;
1487 YY_USE (yynerrs); /* Silence compiler warning. */
1488
1489 yy_state_fast_t yystate = 0;
1490 /* Number of tokens to shift before error messages enabled. */
1491 int yyerrstatus = 0;
1492
1493 /* Refer to the stacks through separate pointers, to allow yyoverflow
1494 to reallocate them elsewhere. */
1495
1496 /* Their size. */
1497 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1498
1499 /* The state stack: array, bottom, top. */
1500 yy_state_t yyssa[YYINITDEPTH];
1501 yy_state_t *yyss = yyssa;
1502 yy_state_t *yyssp = yyss;
1503
1504 /* The semantic value stack: array, bottom, top. */
1505 YYSTYPE yyvsa[YYINITDEPTH];
1506 YYSTYPE *yyvs = yyvsa;
1507 YYSTYPE *yyvsp = yyvs;
1508
1509 /* The location stack: array, bottom, top. */
1510 YYLTYPE yylsa[YYINITDEPTH];
1511 YYLTYPE *yyls = yylsa;
1512 YYLTYPE *yylsp = yyls;
1513
1514 int yyn;
1515 /* The return value of yyparse. */
1516 int yyresult;
1517 /* Lookahead symbol kind. */
1518 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1519 /* The variables used to return semantic value and location from the
1520 action routines. */
1521 YYSTYPE yyval;
1522 YYLTYPE yyloc;
1523
1524 /* The locations where the error started and ended. */
1525 YYLTYPE yyerror_range[3];
1526<%- if output.error_recovery -%>
1527 yy_repair_terms *rep_terms = 0;
1528 yy_term term_backup;
1529 int rep_terms_index;
1530 int yychar_backup;
1531<%- end -%>
1532
1533 /* Buffer for error messages, and its allocated size. */
1534 char yymsgbuf[128];
1535 char *yymsg = yymsgbuf;
1536 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1537
1538#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1539
1540 /* The number of symbols on the RHS of the reduced rule.
1541 Keep to zero when no symbol should be popped. */
1542 int yylen = 0;
1543
1544 YYDPRINTF ((stderr, "Starting parse\n"));
1545
1546 yychar = YYEMPTY; /* Cause a token to be read. */
1547
1548
1549<%# b4_user_initial_action -%>
1550<%= output.user_initial_action("/* User initialization code. */") %>
1551#line [@oline@] [@ofile@]
1552
1553 yylsp[0] = yylloc;
1554 goto yysetstate;
1555
1556
1557/*------------------------------------------------------------.
1558| yynewstate -- push a new state, which is found in yystate. |
1559`------------------------------------------------------------*/
1560yynewstate:
1561 /* In all cases, when you get here, the value and location stacks
1562 have just been pushed. So pushing a state here evens the stacks. */
1563 yyssp++;
1564
1565
1566/*--------------------------------------------------------------------.
1567| yysetstate -- set current state (the top of the stack) to yystate. |
1568`--------------------------------------------------------------------*/
1569yysetstate:
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 %>);
1576
1577 if (yyss + yystacksize - 1 <= yyssp)
1578#if !defined yyoverflow && !defined YYSTACK_RELOCATE
1579 YYNOMEM;
1580#else
1581 {
1582 /* Get the current used size of the three stacks, in elements. */
1583 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1584
1585# if defined yyoverflow
1586 {
1587 /* Give user a chance to reallocate the stack. Use copies of
1588 these so that the &'s don't force the real ones into
1589 memory. */
1590 yy_state_t *yyss1 = yyss;
1591 YYSTYPE *yyvs1 = yyvs;
1592 YYLTYPE *yyls1 = yyls;
1593
1594 /* Each stack pointer address is followed by the size of the
1595 data in use in that stack, in bytes. This used to be a
1596 conditional around just the two extra args, but that might
1597 be undefined if yyoverflow is a macro. */
1598 yyoverflow (YY_("memory exhausted"),
1599 &yyss1, yysize * YYSIZEOF (*yyssp),
1600 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1601 &yyls1, yysize * YYSIZEOF (*yylsp),
1602 &yystacksize);
1603 yyss = yyss1;
1604 yyvs = yyvs1;
1605 yyls = yyls1;
1606 }
1607# else /* defined YYSTACK_RELOCATE */
1608 /* Extend the stack our own way. */
1609 if (YYMAXDEPTH <= yystacksize)
1610 YYNOMEM;
1611 yystacksize *= 2;
1612 if (YYMAXDEPTH < yystacksize)
1613 yystacksize = YYMAXDEPTH;
1614
1615 {
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))));
1620 if (! yyptr)
1621 YYNOMEM;
1622 YYSTACK_RELOCATE (yyss_alloc, yyss);
1623 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1624 YYSTACK_RELOCATE (yyls_alloc, yyls);
1625# undef YYSTACK_RELOCATE
1626 if (yyss1 != yyssa)
1627 YYSTACK_FREE (yyss1);
1628 }
1629# endif
1630
1631 yyssp = yyss + yysize - 1;
1632 yyvsp = yyvs + yysize - 1;
1633 yylsp = yyls + yysize - 1;
1634
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
1639
1640 if (yyss + yystacksize - 1 <= yyssp)
1641 YYABORT;
1642 }
1643#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1644
1645
1646 if (yystate == YYFINAL)
1647 YYACCEPT;
1648
1649 goto yybackup;
1650
1651
1652/*-----------.
1653| yybackup. |
1654`-----------*/
1655yybackup:
1656 /* Do appropriate processing given the current state. Read a
1657 lookahead token if we need one and don't already have one. */
1658
1659 /* First try to decide what to do without reference to lookahead token. */
1660 yyn = yypact[yystate];
1661 if (yypact_value_is_default (yyn))
1662 goto yydefault;
1663
1664 /* Not known => get a lookahead token if don't already have one. */
1665
1666<%- if output.error_recovery -%>
1667 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1668 {
1669 if (yychar == YYEMPTY && rep_terms)
1670 {
1671
1672 if (rep_terms_index < rep_terms->length)
1673 {
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 %>);
1681 rep_terms_index++;
1682 }
1683 else
1684 {
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 %>);
1691
1692 YYFREE (rep_terms);
1693 rep_terms = 0;
1694 yychar_backup = 0;
1695 }
1696 }
1697 }
1698<%- end -%>
1699 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1700 if (yychar == YYEMPTY)
1701 {
1702 YYDPRINTF ((stderr, "Reading a token\n"));
1703 yychar = yylex <%= output.yylex_formals %>;
1704 }
1705
1706 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1707 {
1708 yychar = <%= output.eof_symbol.id.s_value %>;
1709 yytoken = <%= output.eof_symbol.enum_name %>;
1710 YYDPRINTF ((stderr, "Now at end of input.\n"));
1711 }
1712 else if (yychar == <%= output.error_symbol.id.s_value %>)
1713 {
1714 /* The scanner already issued an error message, process directly
1715 to error recovery. But do not keep the error token as
1716 lookahead, it is too special and may lead us to an endless
1717 loop in error recovery. */
1718 yychar = <%= output.undef_symbol.id.s_value %>;
1719 yytoken = <%= output.error_symbol.enum_name %>;
1720 yyerror_range[1] = yylloc;
1721 goto yyerrlab1;
1722 }
1723 else
1724 {
1725 yytoken = YYTRANSLATE (yychar);
1726 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc<%= output.user_args %>);
1727 }
1728
1729 /* If the proper action on seeing token YYTOKEN is to reduce or to
1730 detect an error, take that action. */
1731 yyn += yytoken;
1732 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1733 goto yydefault;
1734 yyn = yytable[yyn];
1735 if (yyn <= 0)
1736 {
1737 if (yytable_value_is_error (yyn))
1738 goto yyerrlab;
1739 yyn = -yyn;
1740 goto yyreduce;
1741 }
1742
1743 /* Count tokens shifted since error; after three, turn off error
1744 status. */
1745 if (yyerrstatus)
1746 yyerrstatus--;
1747
1748 /* Shift the lookahead token. */
1749 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc<%= output.user_args %>);
1750 yystate = yyn;
1751 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1752 *++yyvsp = yylval;
1753 YY_IGNORE_MAYBE_UNINITIALIZED_END
1754 *++yylsp = yylloc;
1755
1756 /* Discard the shifted token. */
1757 yychar = YYEMPTY;
1758 goto yynewstate;
1759
1760
1761/*-----------------------------------------------------------.
1762| yydefault -- do the default action for the current state. |
1763`-----------------------------------------------------------*/
1764yydefault:
1765 yyn = yydefact[yystate];
1766 if (yyn == 0)
1767 goto yyerrlab;
1768 goto yyreduce;
1769
1770
1771/*-----------------------------.
1772| yyreduce -- do a reduction. |
1773`-----------------------------*/
1774yyreduce:
1775 /* yyn is the number of a rule to reduce with. */
1776 yylen = yyr2[yyn];
1777
1778 /* If YYLEN is nonzero, implement the default value of the action:
1779 '$$ = $1'.
1780
1781 Otherwise, the following line sets YYVAL to garbage.
1782 This behavior is undocumented and Bison
1783 users should not rely upon it. Assigning to YYVAL
1784 unconditionally makes the parser a bit smaller, and it avoids a
1785 GCC warning that YYVAL may be used uninitialized. */
1786 yyval = yyvsp[1-yylen];
1787
1788 /* Default location. */
1789 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1790 yyerror_range[1] = yyloc;
1791 YY_REDUCE_PRINT (yyn<%= output.user_args %>);
1792 switch (yyn)
1793 {
1794<%= output.user_actions -%>
1795
1796 default: break;
1797 }
1798 /* User semantic actions sometimes alter yychar, and that requires
1799 that yytoken be updated with the new translation. We take the
1800 approach of translating immediately before every use of yytoken.
1801 One alternative is translating here after every semantic action,
1802 but that translation would be missed if the semantic action invokes
1803 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1804 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1805 incorrect destructor might then be invoked immediately. In the
1806 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1807 to an incorrect destructor call or verbose syntax error message
1808 before the lookahead is translated. */
1809 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc<%= output.user_args %>);
1810
1811 YYPOPSTACK (yylen);
1812 yylen = 0;
1813
1814 *++yyvsp = yyval;
1815 *++yylsp = yyloc;
1816
1817 /* Now 'shift' the result of the reduction. Determine what state
1818 that goes to, based on the state we popped back to and the rule
1819 number reduced by. */
1820 {
1821 const int yylhs = yyr1[yyn] - YYNTOKENS;
1822 const int yyi = yypgoto[yylhs] + *yyssp;
1823 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1824 ? yytable[yyi]
1825 : yydefgoto[yylhs]);
1826 }
1827
1828 goto yynewstate;
1829
1830
1831/*--------------------------------------.
1832| yyerrlab -- here on detecting error. |
1833`--------------------------------------*/
1834yyerrlab:
1835 /* Make sure we have latest lookahead translation. See comments at
1836 user semantic actions for why this is necessary. */
1837 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1838 /* If not already recovering from an error, report this error. */
1839 if (!yyerrstatus)
1840 {
1841 ++yynerrs;
1842 {
1843 yypcontext_t yyctx
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)
1849 yymsgp = yymsg;
1850 else if (yysyntax_error_status == -1)
1851 {
1852 if (yymsg != yymsgbuf)
1853 YYSTACK_FREE (yymsg);
1854 yymsg = YY_CAST (char *,
1855 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1856 if (yymsg)
1857 {
1858 yysyntax_error_status
1859 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx<%= output.user_args %>);
1860 yymsgp = yymsg;
1861 }
1862 else
1863 {
1864 yymsg = yymsgbuf;
1865 yymsg_alloc = sizeof yymsgbuf;
1866 yysyntax_error_status = YYENOMEM;
1867 }
1868 }
1869 yyerror (<%= output.yyerror_args %>, yymsgp);
1870 if (yysyntax_error_status == YYENOMEM)
1871 YYNOMEM;
1872 }
1873 }
1874
1875 yyerror_range[1] = yylloc;
1876 if (yyerrstatus == 3)
1877 {
1878 /* If just tried and failed to reuse lookahead token after an
1879 error, discard it. */
1880
1881 if (yychar <= <%= output.eof_symbol.id.s_value %>)
1882 {
1883 /* Return failure if at end of input. */
1884 if (yychar == <%= output.eof_symbol.id.s_value %>)
1885 YYABORT;
1886 }
1887 else
1888 {
1889 yydestruct ("Error: discarding",
1890 yytoken, &yylval, &yylloc<%= output.user_args %>);
1891 yychar = YYEMPTY;
1892 }
1893 }
1894
1895 /* Else will try to reuse lookahead token after shifting the error
1896 token. */
1897 goto yyerrlab1;
1898
1899
1900/*---------------------------------------------------.
1901| yyerrorlab -- error raised explicitly by YYERROR. |
1902`---------------------------------------------------*/
1903yyerrorlab:
1904 /* Pacify compilers when the user code never invokes YYERROR and the
1905 label yyerrorlab therefore never appears in user code. */
1906 if (0)
1907 YYERROR;
1908 ++yynerrs;
1909
1910 /* Do not reclaim the symbols of the rule whose action triggered
1911 this YYERROR. */
1912 YYPOPSTACK (yylen);
1913 yylen = 0;
1914 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1915 yystate = *yyssp;
1916 goto yyerrlab1;
1917
1918
1919/*-------------------------------------------------------------.
1920| yyerrlab1 -- common code for both syntax error and YYERROR. |
1921`-------------------------------------------------------------*/
1922yyerrlab1:
1923<%- if output.error_recovery -%>
1924 if (YYERROR_RECOVERY_ENABLED(<%= output.parse_param_name %>))
1925 {
1926 rep_terms = yyrecover (yyss, yyssp, yychar<%= output.user_args %>);
1927 if (rep_terms)
1928 {
1929 for (int i = 0; i < rep_terms->length; i++)
1930 {
1931 yy_term *term = &rep_terms->terms[i];
1932 yy_error_token_initialize (term->kind, &term->value, &term->location<%= output.user_args %>);
1933 }
1934
1935 yychar_backup = yychar;
1936 /* Can be packed into (the tail of) rep_terms? */
1937 term_backup.kind = yytoken;
1938 term_backup.value = yylval;
1939 term_backup.location = yylloc;
1940 rep_terms_index = 0;
1941 yychar = YYEMPTY;
1942
1943 goto yybackup;
1944 }
1945 }
1946<%- end -%>
1947 yyerrstatus = 3; /* Each real token shifted decrements this. */
1948
1949 /* Pop stack until we find a state that shifts the error token. */
1950 for (;;)
1951 {
1952 yyn = yypact[yystate];
1953 if (!yypact_value_is_default (yyn))
1954 {
1955 yyn += YYSYMBOL_YYerror;
1956 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1957 {
1958 yyn = yytable[yyn];
1959 if (0 < yyn)
1960 break;
1961 }
1962 }
1963
1964 /* Pop the current state because it cannot handle the error token. */
1965 if (yyssp == yyss)
1966 YYABORT;
1967
1968 yyerror_range[1] = *yylsp;
1969 yydestruct ("Error: popping",
1970 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp<%= output.user_args %>);
1971 YYPOPSTACK (1);
1972 yystate = *yyssp;
1973 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
1974 }
1975
1976 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1977 *++yyvsp = yylval;
1978 YY_IGNORE_MAYBE_UNINITIALIZED_END
1979
1980 yyerror_range[2] = yylloc;
1981 ++yylsp;
1982 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
1983
1984 /* Shift the error token. */
1985 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp<%= output.user_args %>);
1986
1987 yystate = yyn;
1988 goto yynewstate;
1989
1990
1991/*-------------------------------------.
1992| yyacceptlab -- YYACCEPT comes here. |
1993`-------------------------------------*/
1994yyacceptlab:
1995 yyresult = 0;
1996 goto yyreturnlab;
1997
1998
1999/*-----------------------------------.
2000| yyabortlab -- YYABORT comes here. |
2001`-----------------------------------*/
2002yyabortlab:
2003 yyresult = 1;
2004 goto yyreturnlab;
2005
2006
2007/*-----------------------------------------------------------.
2008| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2009`-----------------------------------------------------------*/
2010yyexhaustedlab:
2011 yyerror (<%= output.yyerror_args %>, YY_("memory exhausted"));
2012 yyresult = 2;
2013 goto yyreturnlab;
2014
2015
2016/*----------------------------------------------------------.
2017| yyreturnlab -- parsing is finished, clean up and return. |
2018`----------------------------------------------------------*/
2019yyreturnlab:
2020 if (yychar != YYEMPTY)
2021 {
2022 /* Make sure we have latest lookahead translation. See comments at
2023 user semantic actions for why this is necessary. */
2024 yytoken = YYTRANSLATE (yychar);
2025 yydestruct ("Cleanup: discarding lookahead",
2026 yytoken, &yylval, &yylloc<%= output.user_args %>);
2027 }
2028 /* Do not reclaim the symbols of the rule whose action triggered
2029 this YYABORT or YYACCEPT. */
2030 YYPOPSTACK (yylen);
2031 YY_STACK_PRINT (yyss, yyssp<%= output.user_args %>);
2032 while (yyssp != yyss)
2033 {
2034 yydestruct ("Cleanup: popping",
2035 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp<%= output.user_args %>);
2036 YYPOPSTACK (1);
2037 }
2038#ifndef yyoverflow
2039 if (yyss != yyssa)
2040 YYSTACK_FREE (yyss);
2041#endif
2042 if (yymsg != yymsgbuf)
2043 YYSTACK_FREE (yymsg);
2044 return yyresult;
2045}
2046
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 -%>
2051<%- end -%>
2052