lrama 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/test.yaml +72 -0
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/Gemfile +8 -0
- data/LEGAL.md +26 -0
- data/MIT +21 -0
- data/README.md +32 -0
- data/Rakefile +1 -0
- data/doc/TODO.md +50 -0
- data/exe/lrama +7 -0
- data/lib/lrama/command.rb +129 -0
- data/lib/lrama/context.rb +510 -0
- data/lib/lrama/grammar.rb +850 -0
- data/lib/lrama/lexer.rb +349 -0
- data/lib/lrama/output.rb +268 -0
- data/lib/lrama/parser.rb +321 -0
- data/lib/lrama/report.rb +35 -0
- data/lib/lrama/states.rb +1124 -0
- data/lib/lrama/version.rb +3 -0
- data/lib/lrama.rb +9 -0
- data/lrama.gemspec +22 -0
- data/template/bison/yacc.c +1750 -0
- data/template/bison/yacc.h +112 -0
- metadata +67 -0
@@ -0,0 +1,1750 @@
|
|
1
|
+
<%# b4_generated_by -%>
|
2
|
+
/* A Bison parser, made by GNU Bison 3.8.2. */
|
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
|
+
|
72
|
+
|
73
|
+
<%# b4_user_pre_prologue -%>
|
74
|
+
/* First part of user prologue. */
|
75
|
+
#line <%= output.aux.prologue_first_lineno %> "<%= output.grammar_file_path %>"
|
76
|
+
|
77
|
+
<%= output.aux.prologue %>
|
78
|
+
#line [@oline@] [@ofile@]
|
79
|
+
|
80
|
+
<%# b4_cast_define -%>
|
81
|
+
# ifndef YY_CAST
|
82
|
+
# ifdef __cplusplus
|
83
|
+
# define YY_CAST(Type, Val) static_cast<Type> (Val)
|
84
|
+
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
|
85
|
+
# else
|
86
|
+
# define YY_CAST(Type, Val) ((Type) (Val))
|
87
|
+
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
|
88
|
+
# endif
|
89
|
+
# endif
|
90
|
+
<%# b4_null_define -%>
|
91
|
+
# ifndef YY_NULLPTR
|
92
|
+
# if defined __cplusplus
|
93
|
+
# if 201103L <= __cplusplus
|
94
|
+
# define YY_NULLPTR nullptr
|
95
|
+
# else
|
96
|
+
# define YY_NULLPTR 0
|
97
|
+
# endif
|
98
|
+
# else
|
99
|
+
# define YY_NULLPTR ((void*)0)
|
100
|
+
# endif
|
101
|
+
# endif
|
102
|
+
|
103
|
+
<%# b4_header_include_if -%>
|
104
|
+
/* Use api.header.include to #include this header
|
105
|
+
instead of duplicating it here. */
|
106
|
+
<%# b4_shared_declarations -%>
|
107
|
+
<%-# b4_cpp_guard_open([b4_spec_mapped_header_file]) -%>
|
108
|
+
<%- if output.spec_mapped_header_file -%>
|
109
|
+
#ifndef <%= output.b4_cpp_guard__b4_spec_mapped_header_file %>
|
110
|
+
# define <%= output.b4_cpp_guard__b4_spec_mapped_header_file %>
|
111
|
+
<%- end -%>
|
112
|
+
<%-# b4_declare_yydebug & b4_YYDEBUG_define -%>
|
113
|
+
/* Debug traces. */
|
114
|
+
#ifndef YYDEBUG
|
115
|
+
# define YYDEBUG 0
|
116
|
+
#endif
|
117
|
+
#if YYDEBUG
|
118
|
+
extern int yydebug;
|
119
|
+
#endif
|
120
|
+
<%-# b4_percent_code_get([[requires]]). %code is not supported -%>
|
121
|
+
|
122
|
+
<%-# b4_token_enums_defines -%>
|
123
|
+
/* Token kinds. */
|
124
|
+
#ifndef YYTOKENTYPE
|
125
|
+
# define YYTOKENTYPE
|
126
|
+
enum yytokentype
|
127
|
+
{
|
128
|
+
<%= output.token_enums -%>
|
129
|
+
};
|
130
|
+
typedef enum yytokentype yytoken_kind_t;
|
131
|
+
#endif
|
132
|
+
|
133
|
+
<%-# b4_declare_yylstype -%>
|
134
|
+
<%-# b4_value_type_define -%>
|
135
|
+
/* Value type. */
|
136
|
+
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
137
|
+
union YYSTYPE
|
138
|
+
{
|
139
|
+
#line <%= output.grammar.union.lineno %> "<%= output.grammar_file_path %>"
|
140
|
+
<%= output.grammar.union.braces_less_code %>
|
141
|
+
#line [@oline@] [@ofile@]
|
142
|
+
|
143
|
+
};
|
144
|
+
typedef union YYSTYPE YYSTYPE;
|
145
|
+
# define YYSTYPE_IS_TRIVIAL 1
|
146
|
+
# define YYSTYPE_IS_DECLARED 1
|
147
|
+
#endif
|
148
|
+
|
149
|
+
<%-# b4_location_type_define -%>
|
150
|
+
/* Location type. */
|
151
|
+
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
152
|
+
typedef struct YYLTYPE YYLTYPE;
|
153
|
+
struct YYLTYPE
|
154
|
+
{
|
155
|
+
int first_line;
|
156
|
+
int first_column;
|
157
|
+
int last_line;
|
158
|
+
int last_column;
|
159
|
+
};
|
160
|
+
# define YYLTYPE_IS_DECLARED 1
|
161
|
+
# define YYLTYPE_IS_TRIVIAL 1
|
162
|
+
#endif
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<%-# b4_declare_yyerror_and_yylex. Not supported -%>
|
168
|
+
<%-# b4_declare_yyparse -%>
|
169
|
+
int yyparse (<%= output.parse_param %>);
|
170
|
+
|
171
|
+
|
172
|
+
<%-# b4_percent_code_get([[provides]]). %code is not supported -%>
|
173
|
+
<%-# b4_cpp_guard_close([b4_spec_mapped_header_file]) -%>
|
174
|
+
<%- if output.spec_mapped_header_file -%>
|
175
|
+
#endif /* !<%= output.b4_cpp_guard__b4_spec_mapped_header_file %> */
|
176
|
+
<%- end -%>
|
177
|
+
<%# b4_declare_symbol_enum -%>
|
178
|
+
/* Symbol kind. */
|
179
|
+
enum yysymbol_kind_t
|
180
|
+
{
|
181
|
+
<%= output.symbol_enum -%>
|
182
|
+
};
|
183
|
+
typedef enum yysymbol_kind_t yysymbol_kind_t;
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<%# b4_user_post_prologue -%>
|
189
|
+
<%# b4_c99_int_type_define -%>
|
190
|
+
#ifdef short
|
191
|
+
# undef short
|
192
|
+
#endif
|
193
|
+
|
194
|
+
/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
|
195
|
+
<limits.h> and (if available) <stdint.h> are included
|
196
|
+
so that the code can choose integer types of a good width. */
|
197
|
+
|
198
|
+
#ifndef __PTRDIFF_MAX__
|
199
|
+
# include <limits.h> /* INFRINGES ON USER NAME SPACE */
|
200
|
+
# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
201
|
+
# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
|
202
|
+
# define YY_STDINT_H
|
203
|
+
# endif
|
204
|
+
#endif
|
205
|
+
|
206
|
+
/* Narrow types that promote to a signed type and that can represent a
|
207
|
+
signed or unsigned integer of at least N bits. In tables they can
|
208
|
+
save space and decrease cache pressure. Promoting to a signed type
|
209
|
+
helps avoid bugs in integer arithmetic. */
|
210
|
+
|
211
|
+
#ifdef __INT_LEAST8_MAX__
|
212
|
+
typedef __INT_LEAST8_TYPE__ yytype_int8;
|
213
|
+
#elif defined YY_STDINT_H
|
214
|
+
typedef int_least8_t yytype_int8;
|
215
|
+
#else
|
216
|
+
typedef signed char yytype_int8;
|
217
|
+
#endif
|
218
|
+
|
219
|
+
#ifdef __INT_LEAST16_MAX__
|
220
|
+
typedef __INT_LEAST16_TYPE__ yytype_int16;
|
221
|
+
#elif defined YY_STDINT_H
|
222
|
+
typedef int_least16_t yytype_int16;
|
223
|
+
#else
|
224
|
+
typedef short yytype_int16;
|
225
|
+
#endif
|
226
|
+
|
227
|
+
/* Work around bug in HP-UX 11.23, which defines these macros
|
228
|
+
incorrectly for preprocessor constants. This workaround can likely
|
229
|
+
be removed in 2023, as HPE has promised support for HP-UX 11.23
|
230
|
+
(aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
|
231
|
+
<https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
|
232
|
+
#ifdef __hpux
|
233
|
+
# undef UINT_LEAST8_MAX
|
234
|
+
# undef UINT_LEAST16_MAX
|
235
|
+
# define UINT_LEAST8_MAX 255
|
236
|
+
# define UINT_LEAST16_MAX 65535
|
237
|
+
#endif
|
238
|
+
|
239
|
+
#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
|
240
|
+
typedef __UINT_LEAST8_TYPE__ yytype_uint8;
|
241
|
+
#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
|
242
|
+
&& UINT_LEAST8_MAX <= INT_MAX)
|
243
|
+
typedef uint_least8_t yytype_uint8;
|
244
|
+
#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
|
245
|
+
typedef unsigned char yytype_uint8;
|
246
|
+
#else
|
247
|
+
typedef short yytype_uint8;
|
248
|
+
#endif
|
249
|
+
|
250
|
+
#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
|
251
|
+
typedef __UINT_LEAST16_TYPE__ yytype_uint16;
|
252
|
+
#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
|
253
|
+
&& UINT_LEAST16_MAX <= INT_MAX)
|
254
|
+
typedef uint_least16_t yytype_uint16;
|
255
|
+
#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
|
256
|
+
typedef unsigned short yytype_uint16;
|
257
|
+
#else
|
258
|
+
typedef int yytype_uint16;
|
259
|
+
#endif
|
260
|
+
|
261
|
+
<%# b4_sizes_types_define -%>
|
262
|
+
#ifndef YYPTRDIFF_T
|
263
|
+
# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
|
264
|
+
# define YYPTRDIFF_T __PTRDIFF_TYPE__
|
265
|
+
# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
|
266
|
+
# elif defined PTRDIFF_MAX
|
267
|
+
# ifndef ptrdiff_t
|
268
|
+
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
269
|
+
# endif
|
270
|
+
# define YYPTRDIFF_T ptrdiff_t
|
271
|
+
# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
|
272
|
+
# else
|
273
|
+
# define YYPTRDIFF_T long
|
274
|
+
# define YYPTRDIFF_MAXIMUM LONG_MAX
|
275
|
+
# endif
|
276
|
+
#endif
|
277
|
+
|
278
|
+
#ifndef YYSIZE_T
|
279
|
+
# ifdef __SIZE_TYPE__
|
280
|
+
# define YYSIZE_T __SIZE_TYPE__
|
281
|
+
# elif defined size_t
|
282
|
+
# define YYSIZE_T size_t
|
283
|
+
# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
|
284
|
+
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
|
285
|
+
# define YYSIZE_T size_t
|
286
|
+
# else
|
287
|
+
# define YYSIZE_T unsigned
|
288
|
+
# endif
|
289
|
+
#endif
|
290
|
+
|
291
|
+
#define YYSIZE_MAXIMUM \
|
292
|
+
YY_CAST (YYPTRDIFF_T, \
|
293
|
+
(YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
|
294
|
+
? YYPTRDIFF_MAXIMUM \
|
295
|
+
: YY_CAST (YYSIZE_T, -1)))
|
296
|
+
|
297
|
+
#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
|
298
|
+
|
299
|
+
|
300
|
+
/* Stored state numbers (used for stacks). */
|
301
|
+
typedef <%= output.int_type_for([output.yynstates - 1]) %> yy_state_t;
|
302
|
+
|
303
|
+
/* State numbers in computations. */
|
304
|
+
typedef int yy_state_fast_t;
|
305
|
+
|
306
|
+
#ifndef YY_
|
307
|
+
# if defined YYENABLE_NLS && YYENABLE_NLS
|
308
|
+
# if ENABLE_NLS
|
309
|
+
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
|
310
|
+
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
|
311
|
+
# endif
|
312
|
+
# endif
|
313
|
+
# ifndef YY_
|
314
|
+
# define YY_(Msgid) Msgid
|
315
|
+
# endif
|
316
|
+
#endif
|
317
|
+
|
318
|
+
|
319
|
+
<%# b4_attribute_define -%>
|
320
|
+
#ifndef YY_ATTRIBUTE_PURE
|
321
|
+
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
|
322
|
+
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
|
323
|
+
# else
|
324
|
+
# define YY_ATTRIBUTE_PURE
|
325
|
+
# endif
|
326
|
+
#endif
|
327
|
+
|
328
|
+
#ifndef YY_ATTRIBUTE_UNUSED
|
329
|
+
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
|
330
|
+
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
331
|
+
# else
|
332
|
+
# define YY_ATTRIBUTE_UNUSED
|
333
|
+
# endif
|
334
|
+
#endif
|
335
|
+
|
336
|
+
/* Suppress unused-variable warnings by "using" E. */
|
337
|
+
#if ! defined lint || defined __GNUC__
|
338
|
+
# define YY_USE(E) ((void) (E))
|
339
|
+
#else
|
340
|
+
# define YY_USE(E) /* empty */
|
341
|
+
#endif
|
342
|
+
|
343
|
+
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
|
344
|
+
#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
|
345
|
+
# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
|
346
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
347
|
+
_Pragma ("GCC diagnostic push") \
|
348
|
+
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
|
349
|
+
# else
|
350
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
|
351
|
+
_Pragma ("GCC diagnostic push") \
|
352
|
+
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
|
353
|
+
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
|
354
|
+
# endif
|
355
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
|
356
|
+
_Pragma ("GCC diagnostic pop")
|
357
|
+
#else
|
358
|
+
# define YY_INITIAL_VALUE(Value) Value
|
359
|
+
#endif
|
360
|
+
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
361
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
362
|
+
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
|
363
|
+
#endif
|
364
|
+
#ifndef YY_INITIAL_VALUE
|
365
|
+
# define YY_INITIAL_VALUE(Value) /* Nothing. */
|
366
|
+
#endif
|
367
|
+
|
368
|
+
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
|
369
|
+
# define YY_IGNORE_USELESS_CAST_BEGIN \
|
370
|
+
_Pragma ("GCC diagnostic push") \
|
371
|
+
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
|
372
|
+
# define YY_IGNORE_USELESS_CAST_END \
|
373
|
+
_Pragma ("GCC diagnostic pop")
|
374
|
+
#endif
|
375
|
+
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
|
376
|
+
# define YY_IGNORE_USELESS_CAST_BEGIN
|
377
|
+
# define YY_IGNORE_USELESS_CAST_END
|
378
|
+
#endif
|
379
|
+
|
380
|
+
|
381
|
+
#define YY_ASSERT(E) ((void) (0 && (E)))
|
382
|
+
|
383
|
+
#if 1
|
384
|
+
|
385
|
+
/* The parser invokes alloca or malloc; define the necessary symbols. */
|
386
|
+
|
387
|
+
# ifdef YYSTACK_USE_ALLOCA
|
388
|
+
# if YYSTACK_USE_ALLOCA
|
389
|
+
# ifdef __GNUC__
|
390
|
+
# define YYSTACK_ALLOC __builtin_alloca
|
391
|
+
# elif defined __BUILTIN_VA_ARG_INCR
|
392
|
+
# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
|
393
|
+
# elif defined _AIX
|
394
|
+
# define YYSTACK_ALLOC __alloca
|
395
|
+
# elif defined _MSC_VER
|
396
|
+
# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
|
397
|
+
# define alloca _alloca
|
398
|
+
# else
|
399
|
+
# define YYSTACK_ALLOC alloca
|
400
|
+
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
|
401
|
+
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
402
|
+
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
|
403
|
+
# ifndef EXIT_SUCCESS
|
404
|
+
# define EXIT_SUCCESS 0
|
405
|
+
# endif
|
406
|
+
# endif
|
407
|
+
# endif
|
408
|
+
# endif
|
409
|
+
# endif
|
410
|
+
|
411
|
+
# ifdef YYSTACK_ALLOC
|
412
|
+
/* Pacify GCC's 'empty if-body' warning. */
|
413
|
+
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
|
414
|
+
# ifndef YYSTACK_ALLOC_MAXIMUM
|
415
|
+
/* The OS might guarantee only one guard page at the bottom of the stack,
|
416
|
+
and a page size can be as small as 4096 bytes. So we cannot safely
|
417
|
+
invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
|
418
|
+
to allow for a few compiler-allocated temporary stack slots. */
|
419
|
+
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
|
420
|
+
# endif
|
421
|
+
# else
|
422
|
+
# define YYSTACK_ALLOC YYMALLOC
|
423
|
+
# define YYSTACK_FREE YYFREE
|
424
|
+
# ifndef YYSTACK_ALLOC_MAXIMUM
|
425
|
+
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
|
426
|
+
# endif
|
427
|
+
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
|
428
|
+
&& ! ((defined YYMALLOC || defined malloc) \
|
429
|
+
&& (defined YYFREE || defined free)))
|
430
|
+
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
|
431
|
+
# ifndef EXIT_SUCCESS
|
432
|
+
# define EXIT_SUCCESS 0
|
433
|
+
# endif
|
434
|
+
# endif
|
435
|
+
# ifndef YYMALLOC
|
436
|
+
# define YYMALLOC malloc
|
437
|
+
# if ! defined malloc && ! defined EXIT_SUCCESS
|
438
|
+
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
|
439
|
+
# endif
|
440
|
+
# endif
|
441
|
+
# ifndef YYFREE
|
442
|
+
# define YYFREE free
|
443
|
+
# if ! defined free && ! defined EXIT_SUCCESS
|
444
|
+
void free (void *); /* INFRINGES ON USER NAME SPACE */
|
445
|
+
# endif
|
446
|
+
# endif
|
447
|
+
# endif
|
448
|
+
#endif /* 1 */
|
449
|
+
|
450
|
+
#if (! defined yyoverflow \
|
451
|
+
&& (! defined __cplusplus \
|
452
|
+
|| (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
|
453
|
+
&& defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
454
|
+
|
455
|
+
/* A type that is properly aligned for any stack member. */
|
456
|
+
union yyalloc
|
457
|
+
{
|
458
|
+
yy_state_t yyss_alloc;
|
459
|
+
YYSTYPE yyvs_alloc;
|
460
|
+
YYLTYPE yyls_alloc;
|
461
|
+
};
|
462
|
+
|
463
|
+
/* The size of the maximum gap between one aligned stack and the next. */
|
464
|
+
# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
|
465
|
+
|
466
|
+
/* The size of an array large to enough to hold all stacks, each with
|
467
|
+
N elements. */
|
468
|
+
# define YYSTACK_BYTES(N) \
|
469
|
+
((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
|
470
|
+
+ YYSIZEOF (YYLTYPE)) \
|
471
|
+
+ 2 * YYSTACK_GAP_MAXIMUM)
|
472
|
+
|
473
|
+
# define YYCOPY_NEEDED 1
|
474
|
+
|
475
|
+
/* Relocate STACK from its old location to the new one. The
|
476
|
+
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
477
|
+
elements in the stack, and YYPTR gives the new location of the
|
478
|
+
stack. Advance YYPTR to a properly aligned location for the next
|
479
|
+
stack. */
|
480
|
+
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
|
481
|
+
do \
|
482
|
+
{ \
|
483
|
+
YYPTRDIFF_T yynewbytes; \
|
484
|
+
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
|
485
|
+
Stack = &yyptr->Stack_alloc; \
|
486
|
+
yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
|
487
|
+
yyptr += yynewbytes / YYSIZEOF (*yyptr); \
|
488
|
+
} \
|
489
|
+
while (0)
|
490
|
+
|
491
|
+
#endif
|
492
|
+
|
493
|
+
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
|
494
|
+
/* Copy COUNT objects from SRC to DST. The source and destination do
|
495
|
+
not overlap. */
|
496
|
+
# ifndef YYCOPY
|
497
|
+
# if defined __GNUC__ && 1 < __GNUC__
|
498
|
+
# define YYCOPY(Dst, Src, Count) \
|
499
|
+
__builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
|
500
|
+
# else
|
501
|
+
# define YYCOPY(Dst, Src, Count) \
|
502
|
+
do \
|
503
|
+
{ \
|
504
|
+
YYPTRDIFF_T yyi; \
|
505
|
+
for (yyi = 0; yyi < (Count); yyi++) \
|
506
|
+
(Dst)[yyi] = (Src)[yyi]; \
|
507
|
+
} \
|
508
|
+
while (0)
|
509
|
+
# endif
|
510
|
+
# endif
|
511
|
+
#endif /* !YYCOPY_NEEDED */
|
512
|
+
|
513
|
+
/* YYFINAL -- State number of the termination state. */
|
514
|
+
#define YYFINAL <%= output.yyfinal %>
|
515
|
+
/* YYLAST -- Last index in YYTABLE. */
|
516
|
+
#define YYLAST <%= output.yylast %>
|
517
|
+
|
518
|
+
/* YYNTOKENS -- Number of terminals. */
|
519
|
+
#define YYNTOKENS <%= output.yyntokens %>
|
520
|
+
/* YYNNTS -- Number of nonterminals. */
|
521
|
+
#define YYNNTS <%= output.yynnts %>
|
522
|
+
/* YYNRULES -- Number of rules. */
|
523
|
+
#define YYNRULES <%= output.yynrules %>
|
524
|
+
/* YYNSTATES -- Number of states. */
|
525
|
+
#define YYNSTATES <%= output.yynstates %>
|
526
|
+
|
527
|
+
/* YYMAXUTOK -- Last valid token kind. */
|
528
|
+
#define YYMAXUTOK <%= output.yymaxutok %>
|
529
|
+
|
530
|
+
|
531
|
+
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
|
532
|
+
as returned by yylex, with out-of-bounds checking. */
|
533
|
+
#define YYTRANSLATE(YYX) \
|
534
|
+
(0 <= (YYX) && (YYX) <= YYMAXUTOK \
|
535
|
+
? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
|
536
|
+
: YYSYMBOL_YYUNDEF)
|
537
|
+
|
538
|
+
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
|
539
|
+
as returned by yylex. */
|
540
|
+
static const <%= output.int_type_for(output.context.yytranslate) %> yytranslate[] =
|
541
|
+
{
|
542
|
+
<%= output.yytranslate %>
|
543
|
+
};
|
544
|
+
|
545
|
+
#if YYDEBUG
|
546
|
+
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
547
|
+
static const <%= output.int_type_for(output.context.yyrline) %> yyrline[] =
|
548
|
+
{
|
549
|
+
<%= output.yyrline %>
|
550
|
+
};
|
551
|
+
#endif
|
552
|
+
|
553
|
+
/** Accessing symbol of state STATE. */
|
554
|
+
#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
|
555
|
+
|
556
|
+
#if 1
|
557
|
+
/* The user-facing name of the symbol whose (internal) number is
|
558
|
+
YYSYMBOL. No bounds checking. */
|
559
|
+
static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
|
560
|
+
|
561
|
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
|
562
|
+
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
|
563
|
+
static const char *const yytname[] =
|
564
|
+
{
|
565
|
+
<%= output.yytname %>
|
566
|
+
};
|
567
|
+
|
568
|
+
static const char *
|
569
|
+
yysymbol_name (yysymbol_kind_t yysymbol)
|
570
|
+
{
|
571
|
+
return yytname[yysymbol];
|
572
|
+
}
|
573
|
+
#endif
|
574
|
+
|
575
|
+
#define YYPACT_NINF (<%= output.yypact_ninf %>)
|
576
|
+
|
577
|
+
#define yypact_value_is_default(Yyn) \
|
578
|
+
<%= output.table_value_equals(output.context.yypact, "Yyn", output.yypact_ninf, "YYPACT_NINF") %>
|
579
|
+
|
580
|
+
#define YYTABLE_NINF (<%= output.yytable_ninf %>)
|
581
|
+
|
582
|
+
#define yytable_value_is_error(Yyn) \
|
583
|
+
<%= output.table_value_equals(output.context.yytable, "Yyn", output.yytable_ninf, "YYTABLE_NINF") %>
|
584
|
+
|
585
|
+
<%# b4_parser_tables_define -%>
|
586
|
+
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
587
|
+
STATE-NUM. */
|
588
|
+
static const <%= output.int_type_for(output.context.yypact) %> yypact[] =
|
589
|
+
{
|
590
|
+
<%= output.int_array_to_string(output.context.yypact) %>
|
591
|
+
};
|
592
|
+
|
593
|
+
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
594
|
+
Performed when YYTABLE does not specify something else to do. Zero
|
595
|
+
means the default is an error. */
|
596
|
+
static const <%= output.int_type_for(output.context.yydefact) %> yydefact[] =
|
597
|
+
{
|
598
|
+
<%= output.int_array_to_string(output.context.yydefact) %>
|
599
|
+
};
|
600
|
+
|
601
|
+
/* YYPGOTO[NTERM-NUM]. */
|
602
|
+
static const <%= output.int_type_for(output.context.yypgoto) %> yypgoto[] =
|
603
|
+
{
|
604
|
+
<%= output.int_array_to_string(output.context.yypgoto) %>
|
605
|
+
};
|
606
|
+
|
607
|
+
/* YYDEFGOTO[NTERM-NUM]. */
|
608
|
+
static const <%= output.int_type_for(output.context.yydefgoto) %> yydefgoto[] =
|
609
|
+
{
|
610
|
+
<%= output.int_array_to_string(output.context.yydefgoto) %>
|
611
|
+
};
|
612
|
+
|
613
|
+
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
614
|
+
positive, shift that token. If negative, reduce the rule whose
|
615
|
+
number is the opposite. If YYTABLE_NINF, syntax error. */
|
616
|
+
static const <%= output.int_type_for(output.context.yytable) %> yytable[] =
|
617
|
+
{
|
618
|
+
<%= output.int_array_to_string(output.context.yytable) %>
|
619
|
+
};
|
620
|
+
|
621
|
+
static const <%= output.int_type_for(output.context.yycheck) %> yycheck[] =
|
622
|
+
{
|
623
|
+
<%= output.int_array_to_string(output.context.yycheck) %>
|
624
|
+
};
|
625
|
+
|
626
|
+
/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
|
627
|
+
state STATE-NUM. */
|
628
|
+
static const <%= output.int_type_for(output.context.yystos) %> yystos[] =
|
629
|
+
{
|
630
|
+
<%= output.int_array_to_string(output.context.yystos) %>
|
631
|
+
};
|
632
|
+
|
633
|
+
/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
|
634
|
+
static const <%= output.int_type_for(output.context.yyr1) %> yyr1[] =
|
635
|
+
{
|
636
|
+
<%= output.int_array_to_string(output.context.yyr1) %>
|
637
|
+
};
|
638
|
+
|
639
|
+
/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
|
640
|
+
static const <%= output.int_type_for(output.context.yyr2) %> yyr2[] =
|
641
|
+
{
|
642
|
+
<%= output.int_array_to_string(output.context.yyr2) %>
|
643
|
+
};
|
644
|
+
|
645
|
+
|
646
|
+
enum { YYENOMEM = -2 };
|
647
|
+
|
648
|
+
#define yyerrok (yyerrstatus = 0)
|
649
|
+
#define yyclearin (yychar = YYEMPTY)
|
650
|
+
|
651
|
+
#define YYACCEPT goto yyacceptlab
|
652
|
+
#define YYABORT goto yyabortlab
|
653
|
+
#define YYERROR goto yyerrorlab
|
654
|
+
#define YYNOMEM goto yyexhaustedlab
|
655
|
+
|
656
|
+
|
657
|
+
#define YYRECOVERING() (!!yyerrstatus)
|
658
|
+
|
659
|
+
#define YYBACKUP(Token, Value) \
|
660
|
+
do \
|
661
|
+
if (yychar == YYEMPTY) \
|
662
|
+
{ \
|
663
|
+
yychar = (Token); \
|
664
|
+
yylval = (Value); \
|
665
|
+
YYPOPSTACK (yylen); \
|
666
|
+
yystate = *yyssp; \
|
667
|
+
goto yybackup; \
|
668
|
+
} \
|
669
|
+
else \
|
670
|
+
{ \
|
671
|
+
yyerror (&yylloc, p, YY_("syntax error: cannot back up")); \
|
672
|
+
YYERROR; \
|
673
|
+
} \
|
674
|
+
while (0)
|
675
|
+
|
676
|
+
/* Backward compatibility with an undocumented macro.
|
677
|
+
Use YYerror or YYUNDEF. */
|
678
|
+
#define YYERRCODE YYUNDEF
|
679
|
+
|
680
|
+
<%# b4_yylloc_default_define -%>
|
681
|
+
/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
|
682
|
+
If N is 0, then set CURRENT to the empty location which ends
|
683
|
+
the previous symbol: RHS[0] (always defined). */
|
684
|
+
|
685
|
+
#ifndef YYLLOC_DEFAULT
|
686
|
+
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
687
|
+
do \
|
688
|
+
if (N) \
|
689
|
+
{ \
|
690
|
+
(Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
|
691
|
+
(Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
|
692
|
+
(Current).last_line = YYRHSLOC (Rhs, N).last_line; \
|
693
|
+
(Current).last_column = YYRHSLOC (Rhs, N).last_column; \
|
694
|
+
} \
|
695
|
+
else \
|
696
|
+
{ \
|
697
|
+
(Current).first_line = (Current).last_line = \
|
698
|
+
YYRHSLOC (Rhs, 0).last_line; \
|
699
|
+
(Current).first_column = (Current).last_column = \
|
700
|
+
YYRHSLOC (Rhs, 0).last_column; \
|
701
|
+
} \
|
702
|
+
while (0)
|
703
|
+
#endif
|
704
|
+
|
705
|
+
#define YYRHSLOC(Rhs, K) ((Rhs)[K])
|
706
|
+
|
707
|
+
|
708
|
+
/* Enable debugging if requested. */
|
709
|
+
#if YYDEBUG
|
710
|
+
|
711
|
+
# ifndef YYFPRINTF
|
712
|
+
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
|
713
|
+
# define YYFPRINTF fprintf
|
714
|
+
# endif
|
715
|
+
|
716
|
+
# define YYDPRINTF(Args) \
|
717
|
+
do { \
|
718
|
+
if (yydebug) \
|
719
|
+
YYFPRINTF Args; \
|
720
|
+
} while (0)
|
721
|
+
|
722
|
+
|
723
|
+
<%# b4_yylocation_print_define -%>
|
724
|
+
/* YYLOCATION_PRINT -- Print the location on the stream.
|
725
|
+
This macro was not mandated originally: define only if we know
|
726
|
+
we won't break user code: when these are the locations we know. */
|
727
|
+
|
728
|
+
# ifndef YYLOCATION_PRINT
|
729
|
+
|
730
|
+
# if defined YY_LOCATION_PRINT
|
731
|
+
|
732
|
+
/* Temporary convenience wrapper in case some people defined the
|
733
|
+
undocumented and private YY_LOCATION_PRINT macros. */
|
734
|
+
# define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
|
735
|
+
|
736
|
+
# elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
737
|
+
|
738
|
+
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
|
739
|
+
|
740
|
+
YY_ATTRIBUTE_UNUSED
|
741
|
+
static int
|
742
|
+
yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
|
743
|
+
{
|
744
|
+
int res = 0;
|
745
|
+
int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
|
746
|
+
if (0 <= yylocp->first_line)
|
747
|
+
{
|
748
|
+
res += YYFPRINTF (yyo, "%d", yylocp->first_line);
|
749
|
+
if (0 <= yylocp->first_column)
|
750
|
+
res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
|
751
|
+
}
|
752
|
+
if (0 <= yylocp->last_line)
|
753
|
+
{
|
754
|
+
if (yylocp->first_line < yylocp->last_line)
|
755
|
+
{
|
756
|
+
res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
|
757
|
+
if (0 <= end_col)
|
758
|
+
res += YYFPRINTF (yyo, ".%d", end_col);
|
759
|
+
}
|
760
|
+
else if (0 <= end_col && yylocp->first_column < end_col)
|
761
|
+
res += YYFPRINTF (yyo, "-%d", end_col);
|
762
|
+
}
|
763
|
+
return res;
|
764
|
+
}
|
765
|
+
|
766
|
+
# define YYLOCATION_PRINT yy_location_print_
|
767
|
+
|
768
|
+
/* Temporary convenience wrapper in case some people defined the
|
769
|
+
undocumented and private YY_LOCATION_PRINT macros. */
|
770
|
+
# define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
|
771
|
+
|
772
|
+
# else
|
773
|
+
|
774
|
+
# define YYLOCATION_PRINT(File, Loc) ((void) 0)
|
775
|
+
/* Temporary convenience wrapper in case some people defined the
|
776
|
+
undocumented and private YY_LOCATION_PRINT macros. */
|
777
|
+
# define YY_LOCATION_PRINT YYLOCATION_PRINT
|
778
|
+
|
779
|
+
# endif
|
780
|
+
# endif /* !defined YYLOCATION_PRINT */
|
781
|
+
|
782
|
+
|
783
|
+
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
|
784
|
+
do { \
|
785
|
+
if (yydebug) \
|
786
|
+
{ \
|
787
|
+
YYFPRINTF (stderr, "%s ", Title); \
|
788
|
+
yy_symbol_print (stderr, \
|
789
|
+
Kind, Value, Location, p); \
|
790
|
+
YYFPRINTF (stderr, "\n"); \
|
791
|
+
} \
|
792
|
+
} while (0)
|
793
|
+
|
794
|
+
|
795
|
+
<%# b4_yy_symbol_print_define -%>
|
796
|
+
/*-----------------------------------.
|
797
|
+
| Print this symbol's value on YYO. |
|
798
|
+
`-----------------------------------*/
|
799
|
+
|
800
|
+
static void
|
801
|
+
yy_symbol_value_print (FILE *yyo,
|
802
|
+
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp<%= output.user_formals %>)
|
803
|
+
{
|
804
|
+
FILE *yyoutput = yyo;
|
805
|
+
YY_USE (yyoutput);
|
806
|
+
YY_USE (yylocationp);
|
807
|
+
YY_USE (p);
|
808
|
+
if (!yyvaluep)
|
809
|
+
return;
|
810
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
811
|
+
<%# b4_symbol_actions(printer) -%>
|
812
|
+
switch (yykind)
|
813
|
+
{
|
814
|
+
<%= output.symbol_actions_for_printer -%>
|
815
|
+
default:
|
816
|
+
break;
|
817
|
+
}
|
818
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
819
|
+
}
|
820
|
+
|
821
|
+
|
822
|
+
/*---------------------------.
|
823
|
+
| Print this symbol on YYO. |
|
824
|
+
`---------------------------*/
|
825
|
+
|
826
|
+
static void
|
827
|
+
yy_symbol_print (FILE *yyo,
|
828
|
+
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp<%= output.user_formals %>)
|
829
|
+
{
|
830
|
+
YYFPRINTF (yyo, "%s %s (",
|
831
|
+
yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
|
832
|
+
|
833
|
+
YYLOCATION_PRINT (yyo, yylocationp);
|
834
|
+
YYFPRINTF (yyo, ": ");
|
835
|
+
yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, p);
|
836
|
+
YYFPRINTF (yyo, ")");
|
837
|
+
}
|
838
|
+
|
839
|
+
/*------------------------------------------------------------------.
|
840
|
+
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
|
841
|
+
| TOP (included). |
|
842
|
+
`------------------------------------------------------------------*/
|
843
|
+
|
844
|
+
static void
|
845
|
+
yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
|
846
|
+
{
|
847
|
+
YYFPRINTF (stderr, "Stack now");
|
848
|
+
for (; yybottom <= yytop; yybottom++)
|
849
|
+
{
|
850
|
+
int yybot = *yybottom;
|
851
|
+
YYFPRINTF (stderr, " %d", yybot);
|
852
|
+
}
|
853
|
+
YYFPRINTF (stderr, "\n");
|
854
|
+
}
|
855
|
+
|
856
|
+
# define YY_STACK_PRINT(Bottom, Top) \
|
857
|
+
do { \
|
858
|
+
if (yydebug) \
|
859
|
+
yy_stack_print ((Bottom), (Top)); \
|
860
|
+
} while (0)
|
861
|
+
|
862
|
+
|
863
|
+
/*------------------------------------------------.
|
864
|
+
| Report that the YYRULE is going to be reduced. |
|
865
|
+
`------------------------------------------------*/
|
866
|
+
|
867
|
+
static void
|
868
|
+
yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
|
869
|
+
int yyrule<%= output.user_formals %>)
|
870
|
+
{
|
871
|
+
int yylno = yyrline[yyrule];
|
872
|
+
int yynrhs = yyr2[yyrule];
|
873
|
+
int yyi;
|
874
|
+
YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
|
875
|
+
yyrule - 1, yylno);
|
876
|
+
/* The symbols being reduced. */
|
877
|
+
for (yyi = 0; yyi < yynrhs; yyi++)
|
878
|
+
{
|
879
|
+
YYFPRINTF (stderr, " $%d = ", yyi + 1);
|
880
|
+
yy_symbol_print (stderr,
|
881
|
+
YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
|
882
|
+
&yyvsp[(yyi + 1) - (yynrhs)],
|
883
|
+
&(yylsp[(yyi + 1) - (yynrhs)]), p);
|
884
|
+
YYFPRINTF (stderr, "\n");
|
885
|
+
}
|
886
|
+
}
|
887
|
+
|
888
|
+
# define YY_REDUCE_PRINT(Rule) \
|
889
|
+
do { \
|
890
|
+
if (yydebug) \
|
891
|
+
yy_reduce_print (yyssp, yyvsp, yylsp, Rule, p); \
|
892
|
+
} while (0)
|
893
|
+
|
894
|
+
/* Nonzero means print parse trace. It is left uninitialized so that
|
895
|
+
multiple parsers can coexist. */
|
896
|
+
int yydebug;
|
897
|
+
#else /* !YYDEBUG */
|
898
|
+
# define YYDPRINTF(Args) ((void) 0)
|
899
|
+
# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
|
900
|
+
# define YY_STACK_PRINT(Bottom, Top)
|
901
|
+
# define YY_REDUCE_PRINT(Rule)
|
902
|
+
#endif /* !YYDEBUG */
|
903
|
+
|
904
|
+
|
905
|
+
/* YYINITDEPTH -- initial size of the parser's stacks. */
|
906
|
+
#ifndef YYINITDEPTH
|
907
|
+
# define YYINITDEPTH 200
|
908
|
+
#endif
|
909
|
+
|
910
|
+
/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
|
911
|
+
if the built-in stack extension method is used).
|
912
|
+
|
913
|
+
Do not make this value too large; the results are undefined if
|
914
|
+
YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
|
915
|
+
evaluated with infinite-precision integer arithmetic. */
|
916
|
+
|
917
|
+
#ifndef YYMAXDEPTH
|
918
|
+
# define YYMAXDEPTH 10000
|
919
|
+
#endif
|
920
|
+
|
921
|
+
|
922
|
+
/* Context of a parse error. */
|
923
|
+
typedef struct
|
924
|
+
{
|
925
|
+
yy_state_t *yyssp;
|
926
|
+
yysymbol_kind_t yytoken;
|
927
|
+
YYLTYPE *yylloc;
|
928
|
+
} yypcontext_t;
|
929
|
+
|
930
|
+
/* Put in YYARG at most YYARGN of the expected tokens given the
|
931
|
+
current YYCTX, and return the number of tokens stored in YYARG. If
|
932
|
+
YYARG is null, return the number of expected tokens (guaranteed to
|
933
|
+
be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
|
934
|
+
Return 0 if there are more than YYARGN expected tokens, yet fill
|
935
|
+
YYARG up to YYARGN. */
|
936
|
+
static int
|
937
|
+
yypcontext_expected_tokens (const yypcontext_t *yyctx,
|
938
|
+
yysymbol_kind_t yyarg[], int yyargn)
|
939
|
+
{
|
940
|
+
/* Actual size of YYARG. */
|
941
|
+
int yycount = 0;
|
942
|
+
int yyn = yypact[+*yyctx->yyssp];
|
943
|
+
if (!yypact_value_is_default (yyn))
|
944
|
+
{
|
945
|
+
/* Start YYX at -YYN if negative to avoid negative indexes in
|
946
|
+
YYCHECK. In other words, skip the first -YYN actions for
|
947
|
+
this state because they are default actions. */
|
948
|
+
int yyxbegin = yyn < 0 ? -yyn : 0;
|
949
|
+
/* Stay within bounds of both yycheck and yytname. */
|
950
|
+
int yychecklim = YYLAST - yyn + 1;
|
951
|
+
int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
|
952
|
+
int yyx;
|
953
|
+
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
|
954
|
+
if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
|
955
|
+
&& !yytable_value_is_error (yytable[yyx + yyn]))
|
956
|
+
{
|
957
|
+
if (!yyarg)
|
958
|
+
++yycount;
|
959
|
+
else if (yycount == yyargn)
|
960
|
+
return 0;
|
961
|
+
else
|
962
|
+
yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
|
963
|
+
}
|
964
|
+
}
|
965
|
+
if (yyarg && yycount == 0 && 0 < yyargn)
|
966
|
+
yyarg[0] = YYSYMBOL_YYEMPTY;
|
967
|
+
return yycount;
|
968
|
+
}
|
969
|
+
|
970
|
+
|
971
|
+
|
972
|
+
|
973
|
+
#ifndef yystrlen
|
974
|
+
# if defined __GLIBC__ && defined _STRING_H
|
975
|
+
# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
|
976
|
+
# else
|
977
|
+
/* Return the length of YYSTR. */
|
978
|
+
static YYPTRDIFF_T
|
979
|
+
yystrlen (const char *yystr)
|
980
|
+
{
|
981
|
+
YYPTRDIFF_T yylen;
|
982
|
+
for (yylen = 0; yystr[yylen]; yylen++)
|
983
|
+
continue;
|
984
|
+
return yylen;
|
985
|
+
}
|
986
|
+
# endif
|
987
|
+
#endif
|
988
|
+
|
989
|
+
#ifndef yystpcpy
|
990
|
+
# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
|
991
|
+
# define yystpcpy stpcpy
|
992
|
+
# else
|
993
|
+
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
|
994
|
+
YYDEST. */
|
995
|
+
static char *
|
996
|
+
yystpcpy (char *yydest, const char *yysrc)
|
997
|
+
{
|
998
|
+
char *yyd = yydest;
|
999
|
+
const char *yys = yysrc;
|
1000
|
+
|
1001
|
+
while ((*yyd++ = *yys++) != '\0')
|
1002
|
+
continue;
|
1003
|
+
|
1004
|
+
return yyd - 1;
|
1005
|
+
}
|
1006
|
+
# endif
|
1007
|
+
#endif
|
1008
|
+
|
1009
|
+
#ifndef yytnamerr
|
1010
|
+
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
|
1011
|
+
quotes and backslashes, so that it's suitable for yyerror. The
|
1012
|
+
heuristic is that double-quoting is unnecessary unless the string
|
1013
|
+
contains an apostrophe, a comma, or backslash (other than
|
1014
|
+
backslash-backslash). YYSTR is taken from yytname. If YYRES is
|
1015
|
+
null, do not copy; instead, return the length of what the result
|
1016
|
+
would have been. */
|
1017
|
+
static YYPTRDIFF_T
|
1018
|
+
yytnamerr (char *yyres, const char *yystr)
|
1019
|
+
{
|
1020
|
+
if (*yystr == '"')
|
1021
|
+
{
|
1022
|
+
YYPTRDIFF_T yyn = 0;
|
1023
|
+
char const *yyp = yystr;
|
1024
|
+
for (;;)
|
1025
|
+
switch (*++yyp)
|
1026
|
+
{
|
1027
|
+
case '\'':
|
1028
|
+
case ',':
|
1029
|
+
goto do_not_strip_quotes;
|
1030
|
+
|
1031
|
+
case '\\':
|
1032
|
+
if (*++yyp != '\\')
|
1033
|
+
goto do_not_strip_quotes;
|
1034
|
+
else
|
1035
|
+
goto append;
|
1036
|
+
|
1037
|
+
append:
|
1038
|
+
default:
|
1039
|
+
if (yyres)
|
1040
|
+
yyres[yyn] = *yyp;
|
1041
|
+
yyn++;
|
1042
|
+
break;
|
1043
|
+
|
1044
|
+
case '"':
|
1045
|
+
if (yyres)
|
1046
|
+
yyres[yyn] = '\0';
|
1047
|
+
return yyn;
|
1048
|
+
}
|
1049
|
+
do_not_strip_quotes: ;
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
if (yyres)
|
1053
|
+
return yystpcpy (yyres, yystr) - yyres;
|
1054
|
+
else
|
1055
|
+
return yystrlen (yystr);
|
1056
|
+
}
|
1057
|
+
#endif
|
1058
|
+
|
1059
|
+
|
1060
|
+
static int
|
1061
|
+
yy_syntax_error_arguments (const yypcontext_t *yyctx,
|
1062
|
+
yysymbol_kind_t yyarg[], int yyargn)
|
1063
|
+
{
|
1064
|
+
/* Actual size of YYARG. */
|
1065
|
+
int yycount = 0;
|
1066
|
+
/* There are many possibilities here to consider:
|
1067
|
+
- If this state is a consistent state with a default action, then
|
1068
|
+
the only way this function was invoked is if the default action
|
1069
|
+
is an error action. In that case, don't check for expected
|
1070
|
+
tokens because there are none.
|
1071
|
+
- The only way there can be no lookahead present (in yychar) is if
|
1072
|
+
this state is a consistent state with a default action. Thus,
|
1073
|
+
detecting the absence of a lookahead is sufficient to determine
|
1074
|
+
that there is no unexpected or expected token to report. In that
|
1075
|
+
case, just report a simple "syntax error".
|
1076
|
+
- Don't assume there isn't a lookahead just because this state is a
|
1077
|
+
consistent state with a default action. There might have been a
|
1078
|
+
previous inconsistent state, consistent state with a non-default
|
1079
|
+
action, or user semantic action that manipulated yychar.
|
1080
|
+
- Of course, the expected token list depends on states to have
|
1081
|
+
correct lookahead information, and it depends on the parser not
|
1082
|
+
to perform extra reductions after fetching a lookahead from the
|
1083
|
+
scanner and before detecting a syntax error. Thus, state merging
|
1084
|
+
(from LALR or IELR) and default reductions corrupt the expected
|
1085
|
+
token list. However, the list is correct for canonical LR with
|
1086
|
+
one exception: it will still contain any token that will not be
|
1087
|
+
accepted due to an error action in a later state.
|
1088
|
+
*/
|
1089
|
+
if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
|
1090
|
+
{
|
1091
|
+
int yyn;
|
1092
|
+
if (yyarg)
|
1093
|
+
yyarg[yycount] = yyctx->yytoken;
|
1094
|
+
++yycount;
|
1095
|
+
yyn = yypcontext_expected_tokens (yyctx,
|
1096
|
+
yyarg ? yyarg + 1 : yyarg, yyargn - 1);
|
1097
|
+
if (yyn == YYENOMEM)
|
1098
|
+
return YYENOMEM;
|
1099
|
+
else
|
1100
|
+
yycount += yyn;
|
1101
|
+
}
|
1102
|
+
return yycount;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
|
1106
|
+
about the unexpected token YYTOKEN for the state stack whose top is
|
1107
|
+
YYSSP.
|
1108
|
+
|
1109
|
+
Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
|
1110
|
+
not large enough to hold the message. In that case, also set
|
1111
|
+
*YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
|
1112
|
+
required number of bytes is too large to store. */
|
1113
|
+
static int
|
1114
|
+
yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
|
1115
|
+
const yypcontext_t *yyctx)
|
1116
|
+
{
|
1117
|
+
enum { YYARGS_MAX = 5 };
|
1118
|
+
/* Internationalized format string. */
|
1119
|
+
const char *yyformat = YY_NULLPTR;
|
1120
|
+
/* Arguments of yyformat: reported tokens (one for the "unexpected",
|
1121
|
+
one per "expected"). */
|
1122
|
+
yysymbol_kind_t yyarg[YYARGS_MAX];
|
1123
|
+
/* Cumulated lengths of YYARG. */
|
1124
|
+
YYPTRDIFF_T yysize = 0;
|
1125
|
+
|
1126
|
+
/* Actual size of YYARG. */
|
1127
|
+
int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
|
1128
|
+
if (yycount == YYENOMEM)
|
1129
|
+
return YYENOMEM;
|
1130
|
+
|
1131
|
+
switch (yycount)
|
1132
|
+
{
|
1133
|
+
#define YYCASE_(N, S) \
|
1134
|
+
case N: \
|
1135
|
+
yyformat = S; \
|
1136
|
+
break
|
1137
|
+
default: /* Avoid compiler warnings. */
|
1138
|
+
YYCASE_(0, YY_("syntax error"));
|
1139
|
+
YYCASE_(1, YY_("syntax error, unexpected %s"));
|
1140
|
+
YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
|
1141
|
+
YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
|
1142
|
+
YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
|
1143
|
+
YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
|
1144
|
+
#undef YYCASE_
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/* Compute error message size. Don't count the "%s"s, but reserve
|
1148
|
+
room for the terminator. */
|
1149
|
+
yysize = yystrlen (yyformat) - 2 * yycount + 1;
|
1150
|
+
{
|
1151
|
+
int yyi;
|
1152
|
+
for (yyi = 0; yyi < yycount; ++yyi)
|
1153
|
+
{
|
1154
|
+
YYPTRDIFF_T yysize1
|
1155
|
+
= yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
|
1156
|
+
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
|
1157
|
+
yysize = yysize1;
|
1158
|
+
else
|
1159
|
+
return YYENOMEM;
|
1160
|
+
}
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
if (*yymsg_alloc < yysize)
|
1164
|
+
{
|
1165
|
+
*yymsg_alloc = 2 * yysize;
|
1166
|
+
if (! (yysize <= *yymsg_alloc
|
1167
|
+
&& *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
|
1168
|
+
*yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
|
1169
|
+
return -1;
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
/* Avoid sprintf, as that infringes on the user's name space.
|
1173
|
+
Don't have undefined behavior even if the translation
|
1174
|
+
produced a string with the wrong number of "%s"s. */
|
1175
|
+
{
|
1176
|
+
char *yyp = *yymsg;
|
1177
|
+
int yyi = 0;
|
1178
|
+
while ((*yyp = *yyformat) != '\0')
|
1179
|
+
if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
|
1180
|
+
{
|
1181
|
+
yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
|
1182
|
+
yyformat += 2;
|
1183
|
+
}
|
1184
|
+
else
|
1185
|
+
{
|
1186
|
+
++yyp;
|
1187
|
+
++yyformat;
|
1188
|
+
}
|
1189
|
+
}
|
1190
|
+
return 0;
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
<%# b4_yydestruct_define %>
|
1194
|
+
/*-----------------------------------------------.
|
1195
|
+
| Release the memory associated to this symbol. |
|
1196
|
+
`-----------------------------------------------*/
|
1197
|
+
|
1198
|
+
static void
|
1199
|
+
yydestruct (const char *yymsg,
|
1200
|
+
yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp<%= output.user_formals %>)
|
1201
|
+
{
|
1202
|
+
YY_USE (yyvaluep);
|
1203
|
+
YY_USE (yylocationp);
|
1204
|
+
YY_USE (p);
|
1205
|
+
if (!yymsg)
|
1206
|
+
yymsg = "Deleting";
|
1207
|
+
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
|
1208
|
+
|
1209
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1210
|
+
YY_USE (yykind);
|
1211
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
|
1215
|
+
|
1216
|
+
|
1217
|
+
|
1218
|
+
|
1219
|
+
/*----------.
|
1220
|
+
| yyparse. |
|
1221
|
+
`----------*/
|
1222
|
+
|
1223
|
+
int
|
1224
|
+
yyparse (<%= output.parse_param %>)
|
1225
|
+
{
|
1226
|
+
<%# b4_declare_scanner_communication_variables -%>
|
1227
|
+
/* Lookahead token kind. */
|
1228
|
+
int yychar;
|
1229
|
+
|
1230
|
+
|
1231
|
+
/* The semantic value of the lookahead symbol. */
|
1232
|
+
/* Default value used for initialization, for pacifying older GCCs
|
1233
|
+
or non-GCC compilers. */
|
1234
|
+
YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
|
1235
|
+
YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
|
1236
|
+
|
1237
|
+
/* Location data for the lookahead symbol. */
|
1238
|
+
static YYLTYPE yyloc_default
|
1239
|
+
# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
|
1240
|
+
= { 1, 1, 1, 1 }
|
1241
|
+
# endif
|
1242
|
+
;
|
1243
|
+
YYLTYPE yylloc = yyloc_default;
|
1244
|
+
|
1245
|
+
<%# b4_declare_parser_state_variables -%>
|
1246
|
+
/* Number of syntax errors so far. */
|
1247
|
+
int yynerrs = 0;
|
1248
|
+
|
1249
|
+
yy_state_fast_t yystate = 0;
|
1250
|
+
/* Number of tokens to shift before error messages enabled. */
|
1251
|
+
int yyerrstatus = 0;
|
1252
|
+
|
1253
|
+
/* Refer to the stacks through separate pointers, to allow yyoverflow
|
1254
|
+
to reallocate them elsewhere. */
|
1255
|
+
|
1256
|
+
/* Their size. */
|
1257
|
+
YYPTRDIFF_T yystacksize = YYINITDEPTH;
|
1258
|
+
|
1259
|
+
/* The state stack: array, bottom, top. */
|
1260
|
+
yy_state_t yyssa[YYINITDEPTH];
|
1261
|
+
yy_state_t *yyss = yyssa;
|
1262
|
+
yy_state_t *yyssp = yyss;
|
1263
|
+
|
1264
|
+
/* The semantic value stack: array, bottom, top. */
|
1265
|
+
YYSTYPE yyvsa[YYINITDEPTH];
|
1266
|
+
YYSTYPE *yyvs = yyvsa;
|
1267
|
+
YYSTYPE *yyvsp = yyvs;
|
1268
|
+
|
1269
|
+
/* The location stack: array, bottom, top. */
|
1270
|
+
YYLTYPE yylsa[YYINITDEPTH];
|
1271
|
+
YYLTYPE *yyls = yylsa;
|
1272
|
+
YYLTYPE *yylsp = yyls;
|
1273
|
+
|
1274
|
+
int yyn;
|
1275
|
+
/* The return value of yyparse. */
|
1276
|
+
int yyresult;
|
1277
|
+
/* Lookahead symbol kind. */
|
1278
|
+
yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
|
1279
|
+
/* The variables used to return semantic value and location from the
|
1280
|
+
action routines. */
|
1281
|
+
YYSTYPE yyval;
|
1282
|
+
YYLTYPE yyloc;
|
1283
|
+
|
1284
|
+
/* The locations where the error started and ended. */
|
1285
|
+
YYLTYPE yyerror_range[3];
|
1286
|
+
|
1287
|
+
/* Buffer for error messages, and its allocated size. */
|
1288
|
+
char yymsgbuf[128];
|
1289
|
+
char *yymsg = yymsgbuf;
|
1290
|
+
YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
|
1291
|
+
|
1292
|
+
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
|
1293
|
+
|
1294
|
+
/* The number of symbols on the RHS of the reduced rule.
|
1295
|
+
Keep to zero when no symbol should be popped. */
|
1296
|
+
int yylen = 0;
|
1297
|
+
|
1298
|
+
YYDPRINTF ((stderr, "Starting parse\n"));
|
1299
|
+
|
1300
|
+
yychar = YYEMPTY; /* Cause a token to be read. */
|
1301
|
+
|
1302
|
+
|
1303
|
+
<%# b4_user_initial_action -%>
|
1304
|
+
/* User initialization code. */
|
1305
|
+
#line <%= output.grammar.initial_action.line %> "<%= output.grammar_file_path %>"
|
1306
|
+
<%= output.grammar.initial_action.translated_code %>
|
1307
|
+
|
1308
|
+
#line [@oline@] [@ofile@]
|
1309
|
+
|
1310
|
+
yylsp[0] = yylloc;
|
1311
|
+
goto yysetstate;
|
1312
|
+
|
1313
|
+
|
1314
|
+
/*------------------------------------------------------------.
|
1315
|
+
| yynewstate -- push a new state, which is found in yystate. |
|
1316
|
+
`------------------------------------------------------------*/
|
1317
|
+
yynewstate:
|
1318
|
+
/* In all cases, when you get here, the value and location stacks
|
1319
|
+
have just been pushed. So pushing a state here evens the stacks. */
|
1320
|
+
yyssp++;
|
1321
|
+
|
1322
|
+
|
1323
|
+
/*--------------------------------------------------------------------.
|
1324
|
+
| yysetstate -- set current state (the top of the stack) to yystate. |
|
1325
|
+
`--------------------------------------------------------------------*/
|
1326
|
+
yysetstate:
|
1327
|
+
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
|
1328
|
+
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
|
1329
|
+
YY_IGNORE_USELESS_CAST_BEGIN
|
1330
|
+
*yyssp = YY_CAST (yy_state_t, yystate);
|
1331
|
+
YY_IGNORE_USELESS_CAST_END
|
1332
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1333
|
+
|
1334
|
+
if (yyss + yystacksize - 1 <= yyssp)
|
1335
|
+
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
|
1336
|
+
YYNOMEM;
|
1337
|
+
#else
|
1338
|
+
{
|
1339
|
+
/* Get the current used size of the three stacks, in elements. */
|
1340
|
+
YYPTRDIFF_T yysize = yyssp - yyss + 1;
|
1341
|
+
|
1342
|
+
# if defined yyoverflow
|
1343
|
+
{
|
1344
|
+
/* Give user a chance to reallocate the stack. Use copies of
|
1345
|
+
these so that the &'s don't force the real ones into
|
1346
|
+
memory. */
|
1347
|
+
yy_state_t *yyss1 = yyss;
|
1348
|
+
YYSTYPE *yyvs1 = yyvs;
|
1349
|
+
YYLTYPE *yyls1 = yyls;
|
1350
|
+
|
1351
|
+
/* Each stack pointer address is followed by the size of the
|
1352
|
+
data in use in that stack, in bytes. This used to be a
|
1353
|
+
conditional around just the two extra args, but that might
|
1354
|
+
be undefined if yyoverflow is a macro. */
|
1355
|
+
yyoverflow (YY_("memory exhausted"),
|
1356
|
+
&yyss1, yysize * YYSIZEOF (*yyssp),
|
1357
|
+
&yyvs1, yysize * YYSIZEOF (*yyvsp),
|
1358
|
+
&yyls1, yysize * YYSIZEOF (*yylsp),
|
1359
|
+
&yystacksize);
|
1360
|
+
yyss = yyss1;
|
1361
|
+
yyvs = yyvs1;
|
1362
|
+
yyls = yyls1;
|
1363
|
+
}
|
1364
|
+
# else /* defined YYSTACK_RELOCATE */
|
1365
|
+
/* Extend the stack our own way. */
|
1366
|
+
if (YYMAXDEPTH <= yystacksize)
|
1367
|
+
YYNOMEM;
|
1368
|
+
yystacksize *= 2;
|
1369
|
+
if (YYMAXDEPTH < yystacksize)
|
1370
|
+
yystacksize = YYMAXDEPTH;
|
1371
|
+
|
1372
|
+
{
|
1373
|
+
yy_state_t *yyss1 = yyss;
|
1374
|
+
union yyalloc *yyptr =
|
1375
|
+
YY_CAST (union yyalloc *,
|
1376
|
+
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
|
1377
|
+
if (! yyptr)
|
1378
|
+
YYNOMEM;
|
1379
|
+
YYSTACK_RELOCATE (yyss_alloc, yyss);
|
1380
|
+
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
|
1381
|
+
YYSTACK_RELOCATE (yyls_alloc, yyls);
|
1382
|
+
# undef YYSTACK_RELOCATE
|
1383
|
+
if (yyss1 != yyssa)
|
1384
|
+
YYSTACK_FREE (yyss1);
|
1385
|
+
}
|
1386
|
+
# endif
|
1387
|
+
|
1388
|
+
yyssp = yyss + yysize - 1;
|
1389
|
+
yyvsp = yyvs + yysize - 1;
|
1390
|
+
yylsp = yyls + yysize - 1;
|
1391
|
+
|
1392
|
+
YY_IGNORE_USELESS_CAST_BEGIN
|
1393
|
+
YYDPRINTF ((stderr, "Stack size increased to %ld\n",
|
1394
|
+
YY_CAST (long, yystacksize)));
|
1395
|
+
YY_IGNORE_USELESS_CAST_END
|
1396
|
+
|
1397
|
+
if (yyss + yystacksize - 1 <= yyssp)
|
1398
|
+
YYABORT;
|
1399
|
+
}
|
1400
|
+
#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
|
1401
|
+
|
1402
|
+
|
1403
|
+
if (yystate == YYFINAL)
|
1404
|
+
YYACCEPT;
|
1405
|
+
|
1406
|
+
goto yybackup;
|
1407
|
+
|
1408
|
+
|
1409
|
+
/*-----------.
|
1410
|
+
| yybackup. |
|
1411
|
+
`-----------*/
|
1412
|
+
yybackup:
|
1413
|
+
/* Do appropriate processing given the current state. Read a
|
1414
|
+
lookahead token if we need one and don't already have one. */
|
1415
|
+
|
1416
|
+
/* First try to decide what to do without reference to lookahead token. */
|
1417
|
+
yyn = yypact[yystate];
|
1418
|
+
if (yypact_value_is_default (yyn))
|
1419
|
+
goto yydefault;
|
1420
|
+
|
1421
|
+
/* Not known => get a lookahead token if don't already have one. */
|
1422
|
+
|
1423
|
+
/* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
|
1424
|
+
if (yychar == YYEMPTY)
|
1425
|
+
{
|
1426
|
+
YYDPRINTF ((stderr, "Reading a token\n"));
|
1427
|
+
yychar = yylex (&yylval, &yylloc, p);
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
if (yychar <= <%= output.eof_symbol.id.s_value %>)
|
1431
|
+
{
|
1432
|
+
yychar = <%= output.eof_symbol.id.s_value %>;
|
1433
|
+
yytoken = <%= output.eof_symbol.enum_name %>;
|
1434
|
+
YYDPRINTF ((stderr, "Now at end of input.\n"));
|
1435
|
+
}
|
1436
|
+
else if (yychar == <%= output.error_symbol.id.s_value %>)
|
1437
|
+
{
|
1438
|
+
/* The scanner already issued an error message, process directly
|
1439
|
+
to error recovery. But do not keep the error token as
|
1440
|
+
lookahead, it is too special and may lead us to an endless
|
1441
|
+
loop in error recovery. */
|
1442
|
+
yychar = <%= output.undef_symbol.id.s_value %>;
|
1443
|
+
yytoken = <%= output.error_symbol.enum_name %>;
|
1444
|
+
yyerror_range[1] = yylloc;
|
1445
|
+
goto yyerrlab1;
|
1446
|
+
}
|
1447
|
+
else
|
1448
|
+
{
|
1449
|
+
yytoken = YYTRANSLATE (yychar);
|
1450
|
+
YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
/* If the proper action on seeing token YYTOKEN is to reduce or to
|
1454
|
+
detect an error, take that action. */
|
1455
|
+
yyn += yytoken;
|
1456
|
+
if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
|
1457
|
+
goto yydefault;
|
1458
|
+
yyn = yytable[yyn];
|
1459
|
+
if (yyn <= 0)
|
1460
|
+
{
|
1461
|
+
if (yytable_value_is_error (yyn))
|
1462
|
+
goto yyerrlab;
|
1463
|
+
yyn = -yyn;
|
1464
|
+
goto yyreduce;
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
/* Count tokens shifted since error; after three, turn off error
|
1468
|
+
status. */
|
1469
|
+
if (yyerrstatus)
|
1470
|
+
yyerrstatus--;
|
1471
|
+
|
1472
|
+
/* Shift the lookahead token. */
|
1473
|
+
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
|
1474
|
+
yystate = yyn;
|
1475
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1476
|
+
*++yyvsp = yylval;
|
1477
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1478
|
+
*++yylsp = yylloc;
|
1479
|
+
|
1480
|
+
/* Discard the shifted token. */
|
1481
|
+
yychar = YYEMPTY;
|
1482
|
+
goto yynewstate;
|
1483
|
+
|
1484
|
+
|
1485
|
+
/*-----------------------------------------------------------.
|
1486
|
+
| yydefault -- do the default action for the current state. |
|
1487
|
+
`-----------------------------------------------------------*/
|
1488
|
+
yydefault:
|
1489
|
+
yyn = yydefact[yystate];
|
1490
|
+
if (yyn == 0)
|
1491
|
+
goto yyerrlab;
|
1492
|
+
goto yyreduce;
|
1493
|
+
|
1494
|
+
|
1495
|
+
/*-----------------------------.
|
1496
|
+
| yyreduce -- do a reduction. |
|
1497
|
+
`-----------------------------*/
|
1498
|
+
yyreduce:
|
1499
|
+
/* yyn is the number of a rule to reduce with. */
|
1500
|
+
yylen = yyr2[yyn];
|
1501
|
+
|
1502
|
+
/* If YYLEN is nonzero, implement the default value of the action:
|
1503
|
+
'$$ = $1'.
|
1504
|
+
|
1505
|
+
Otherwise, the following line sets YYVAL to garbage.
|
1506
|
+
This behavior is undocumented and Bison
|
1507
|
+
users should not rely upon it. Assigning to YYVAL
|
1508
|
+
unconditionally makes the parser a bit smaller, and it avoids a
|
1509
|
+
GCC warning that YYVAL may be used uninitialized. */
|
1510
|
+
yyval = yyvsp[1-yylen];
|
1511
|
+
|
1512
|
+
/* Default location. */
|
1513
|
+
YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
|
1514
|
+
yyerror_range[1] = yyloc;
|
1515
|
+
YY_REDUCE_PRINT (yyn);
|
1516
|
+
switch (yyn)
|
1517
|
+
{
|
1518
|
+
<%= output.user_actions -%>
|
1519
|
+
|
1520
|
+
default: break;
|
1521
|
+
}
|
1522
|
+
/* User semantic actions sometimes alter yychar, and that requires
|
1523
|
+
that yytoken be updated with the new translation. We take the
|
1524
|
+
approach of translating immediately before every use of yytoken.
|
1525
|
+
One alternative is translating here after every semantic action,
|
1526
|
+
but that translation would be missed if the semantic action invokes
|
1527
|
+
YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
|
1528
|
+
if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
|
1529
|
+
incorrect destructor might then be invoked immediately. In the
|
1530
|
+
case of YYERROR or YYBACKUP, subsequent parser actions might lead
|
1531
|
+
to an incorrect destructor call or verbose syntax error message
|
1532
|
+
before the lookahead is translated. */
|
1533
|
+
YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
|
1534
|
+
|
1535
|
+
YYPOPSTACK (yylen);
|
1536
|
+
yylen = 0;
|
1537
|
+
|
1538
|
+
*++yyvsp = yyval;
|
1539
|
+
*++yylsp = yyloc;
|
1540
|
+
|
1541
|
+
/* Now 'shift' the result of the reduction. Determine what state
|
1542
|
+
that goes to, based on the state we popped back to and the rule
|
1543
|
+
number reduced by. */
|
1544
|
+
{
|
1545
|
+
const int yylhs = yyr1[yyn] - YYNTOKENS;
|
1546
|
+
const int yyi = yypgoto[yylhs] + *yyssp;
|
1547
|
+
yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
|
1548
|
+
? yytable[yyi]
|
1549
|
+
: yydefgoto[yylhs]);
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
goto yynewstate;
|
1553
|
+
|
1554
|
+
|
1555
|
+
/*--------------------------------------.
|
1556
|
+
| yyerrlab -- here on detecting error. |
|
1557
|
+
`--------------------------------------*/
|
1558
|
+
yyerrlab:
|
1559
|
+
/* Make sure we have latest lookahead translation. See comments at
|
1560
|
+
user semantic actions for why this is necessary. */
|
1561
|
+
yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
|
1562
|
+
/* If not already recovering from an error, report this error. */
|
1563
|
+
if (!yyerrstatus)
|
1564
|
+
{
|
1565
|
+
++yynerrs;
|
1566
|
+
{
|
1567
|
+
yypcontext_t yyctx
|
1568
|
+
= {yyssp, yytoken, &yylloc};
|
1569
|
+
char const *yymsgp = YY_("syntax error");
|
1570
|
+
int yysyntax_error_status;
|
1571
|
+
yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
1572
|
+
if (yysyntax_error_status == 0)
|
1573
|
+
yymsgp = yymsg;
|
1574
|
+
else if (yysyntax_error_status == -1)
|
1575
|
+
{
|
1576
|
+
if (yymsg != yymsgbuf)
|
1577
|
+
YYSTACK_FREE (yymsg);
|
1578
|
+
yymsg = YY_CAST (char *,
|
1579
|
+
YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
|
1580
|
+
if (yymsg)
|
1581
|
+
{
|
1582
|
+
yysyntax_error_status
|
1583
|
+
= yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
|
1584
|
+
yymsgp = yymsg;
|
1585
|
+
}
|
1586
|
+
else
|
1587
|
+
{
|
1588
|
+
yymsg = yymsgbuf;
|
1589
|
+
yymsg_alloc = sizeof yymsgbuf;
|
1590
|
+
yysyntax_error_status = YYENOMEM;
|
1591
|
+
}
|
1592
|
+
}
|
1593
|
+
yyerror (&yylloc, p, yymsgp);
|
1594
|
+
if (yysyntax_error_status == YYENOMEM)
|
1595
|
+
YYNOMEM;
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
yyerror_range[1] = yylloc;
|
1600
|
+
if (yyerrstatus == 3)
|
1601
|
+
{
|
1602
|
+
/* If just tried and failed to reuse lookahead token after an
|
1603
|
+
error, discard it. */
|
1604
|
+
|
1605
|
+
if (yychar <= <%= output.eof_symbol.id.s_value %>)
|
1606
|
+
{
|
1607
|
+
/* Return failure if at end of input. */
|
1608
|
+
if (yychar == <%= output.eof_symbol.id.s_value %>)
|
1609
|
+
YYABORT;
|
1610
|
+
}
|
1611
|
+
else
|
1612
|
+
{
|
1613
|
+
yydestruct ("Error: discarding",
|
1614
|
+
yytoken, &yylval, &yylloc, p);
|
1615
|
+
yychar = YYEMPTY;
|
1616
|
+
}
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
/* Else will try to reuse lookahead token after shifting the error
|
1620
|
+
token. */
|
1621
|
+
goto yyerrlab1;
|
1622
|
+
|
1623
|
+
|
1624
|
+
/*---------------------------------------------------.
|
1625
|
+
| yyerrorlab -- error raised explicitly by YYERROR. |
|
1626
|
+
`---------------------------------------------------*/
|
1627
|
+
yyerrorlab:
|
1628
|
+
/* Pacify compilers when the user code never invokes YYERROR and the
|
1629
|
+
label yyerrorlab therefore never appears in user code. */
|
1630
|
+
if (0)
|
1631
|
+
YYERROR;
|
1632
|
+
++yynerrs;
|
1633
|
+
|
1634
|
+
/* Do not reclaim the symbols of the rule whose action triggered
|
1635
|
+
this YYERROR. */
|
1636
|
+
YYPOPSTACK (yylen);
|
1637
|
+
yylen = 0;
|
1638
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1639
|
+
yystate = *yyssp;
|
1640
|
+
goto yyerrlab1;
|
1641
|
+
|
1642
|
+
|
1643
|
+
/*-------------------------------------------------------------.
|
1644
|
+
| yyerrlab1 -- common code for both syntax error and YYERROR. |
|
1645
|
+
`-------------------------------------------------------------*/
|
1646
|
+
yyerrlab1:
|
1647
|
+
yyerrstatus = 3; /* Each real token shifted decrements this. */
|
1648
|
+
|
1649
|
+
/* Pop stack until we find a state that shifts the error token. */
|
1650
|
+
for (;;)
|
1651
|
+
{
|
1652
|
+
yyn = yypact[yystate];
|
1653
|
+
if (!yypact_value_is_default (yyn))
|
1654
|
+
{
|
1655
|
+
yyn += YYSYMBOL_YYerror;
|
1656
|
+
if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
|
1657
|
+
{
|
1658
|
+
yyn = yytable[yyn];
|
1659
|
+
if (0 < yyn)
|
1660
|
+
break;
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
/* Pop the current state because it cannot handle the error token. */
|
1665
|
+
if (yyssp == yyss)
|
1666
|
+
YYABORT;
|
1667
|
+
|
1668
|
+
yyerror_range[1] = *yylsp;
|
1669
|
+
yydestruct ("Error: popping",
|
1670
|
+
YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp, p);
|
1671
|
+
YYPOPSTACK (1);
|
1672
|
+
yystate = *yyssp;
|
1673
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
|
1677
|
+
*++yyvsp = yylval;
|
1678
|
+
YY_IGNORE_MAYBE_UNINITIALIZED_END
|
1679
|
+
|
1680
|
+
yyerror_range[2] = yylloc;
|
1681
|
+
++yylsp;
|
1682
|
+
YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
|
1683
|
+
|
1684
|
+
/* Shift the error token. */
|
1685
|
+
YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
|
1686
|
+
|
1687
|
+
yystate = yyn;
|
1688
|
+
goto yynewstate;
|
1689
|
+
|
1690
|
+
|
1691
|
+
/*-------------------------------------.
|
1692
|
+
| yyacceptlab -- YYACCEPT comes here. |
|
1693
|
+
`-------------------------------------*/
|
1694
|
+
yyacceptlab:
|
1695
|
+
yyresult = 0;
|
1696
|
+
goto yyreturnlab;
|
1697
|
+
|
1698
|
+
|
1699
|
+
/*-----------------------------------.
|
1700
|
+
| yyabortlab -- YYABORT comes here. |
|
1701
|
+
`-----------------------------------*/
|
1702
|
+
yyabortlab:
|
1703
|
+
yyresult = 1;
|
1704
|
+
goto yyreturnlab;
|
1705
|
+
|
1706
|
+
|
1707
|
+
/*-----------------------------------------------------------.
|
1708
|
+
| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
|
1709
|
+
`-----------------------------------------------------------*/
|
1710
|
+
yyexhaustedlab:
|
1711
|
+
yyerror (&yylloc, p, YY_("memory exhausted"));
|
1712
|
+
yyresult = 2;
|
1713
|
+
goto yyreturnlab;
|
1714
|
+
|
1715
|
+
|
1716
|
+
/*----------------------------------------------------------.
|
1717
|
+
| yyreturnlab -- parsing is finished, clean up and return. |
|
1718
|
+
`----------------------------------------------------------*/
|
1719
|
+
yyreturnlab:
|
1720
|
+
if (yychar != YYEMPTY)
|
1721
|
+
{
|
1722
|
+
/* Make sure we have latest lookahead translation. See comments at
|
1723
|
+
user semantic actions for why this is necessary. */
|
1724
|
+
yytoken = YYTRANSLATE (yychar);
|
1725
|
+
yydestruct ("Cleanup: discarding lookahead",
|
1726
|
+
yytoken, &yylval, &yylloc, p);
|
1727
|
+
}
|
1728
|
+
/* Do not reclaim the symbols of the rule whose action triggered
|
1729
|
+
this YYABORT or YYACCEPT. */
|
1730
|
+
YYPOPSTACK (yylen);
|
1731
|
+
YY_STACK_PRINT (yyss, yyssp);
|
1732
|
+
while (yyssp != yyss)
|
1733
|
+
{
|
1734
|
+
yydestruct ("Cleanup: popping",
|
1735
|
+
YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp, p);
|
1736
|
+
YYPOPSTACK (1);
|
1737
|
+
}
|
1738
|
+
#ifndef yyoverflow
|
1739
|
+
if (yyss != yyssa)
|
1740
|
+
YYSTACK_FREE (yyss);
|
1741
|
+
#endif
|
1742
|
+
if (yymsg != yymsgbuf)
|
1743
|
+
YYSTACK_FREE (yymsg);
|
1744
|
+
return yyresult;
|
1745
|
+
}
|
1746
|
+
|
1747
|
+
<%# b4_percent_code_get([[epilogue]]) -%>
|
1748
|
+
#line <%= output.aux.epilogue_first_lineno - 1 %> "<%= output.grammar_file_path %>"
|
1749
|
+
|
1750
|
+
<%= output.aux.epilogue -%>
|