1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with grecs_meta1_ or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 #line 1 "meta1-gram.y" /* yacc.c:339 */
66
67 /* MeTA1 configuration parser for Grecs.
68 Copyright (C) 2007-2016 Sergey Poznyakoff
69
70 Grecs is free software; you can redistribute it and/or modify it
71 under the terms of the GNU General Public License as published by the
72 Free Software Foundation; either version 3 of the License, or (at your
73 option) any later version.
74
75 Grecs is distributed in the hope that it will be useful,
76 but WITHOUT ANY WARRANTY; without even the implied warranty of
77 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
78 GNU General Public License for more details.
79
80 You should have received a copy of the GNU General Public License along
81 with Grecs. If not, see <http://www.gnu.org/licenses/>. */
82
83 #ifdef HAVE_CONFIG_H
84 # include <config.h>
85 #endif
86 #include <errno.h>
87 #include <string.h>
88 #include "grecs.h"
89
90 int grecs_meta1_lex(void);
91 int grecs_meta1_error(char const *s);
92
93 static struct grecs_node *parse_tree;
94 extern int grecs_meta1__flex_debug;
95 extern void grecs_meta1_set_in(FILE *);
96
97 #line 98 "meta1-gram.c" /* yacc.c:339 */
98
99 # ifndef YY_NULLPTR
100 # if defined __cplusplus && 201103L <= __cplusplus
101 # define YY_NULLPTR nullptr
102 # else
103 # define YY_NULLPTR 0
104 # endif
105 # endif
106
107 /* Enabling verbose error messages. */
108 #ifdef YYERROR_VERBOSE
109 # undef YYERROR_VERBOSE
110 # define YYERROR_VERBOSE 1
111 #else
112 # define YYERROR_VERBOSE 1
113 #endif
114
115 /* In a future release of Bison, this section will be replaced
116 by #include "y.tab.h". */
117 #ifndef YY_YY_META_GRAM_H_INCLUDED
118 # define YY_YY_META_GRAM_H_INCLUDED
119 /* Debug traces. */
120 #ifndef YYDEBUG
121 # define YYDEBUG 1
122 #endif
123 #if YYDEBUG
124 extern int grecs_meta1_debug;
125 #endif
126
127 /* Token type. */
128 #ifndef YYTOKENTYPE
129 # define YYTOKENTYPE
130 enum grecs_meta1_tokentype
131 {
132 META1_STRING = 258,
133 META1_IDENT = 259
134 };
135 #endif
136 /* Tokens. */
137 #define META1_STRING 258
138 #define META1_IDENT 259
139
140 /* Value type. */
141 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
142
143 union YYSTYPE
144 {
145 #line 36 "meta1-gram.y" /* yacc.c:355 */
146
147 char *string;
148 grecs_value_t svalue, *pvalue;
149 struct grecs_list *list;
150 struct { struct grecs_node *head, *tail; } node_list;
151 struct grecs_node *node;
152
153 #line 154 "meta1-gram.c" /* yacc.c:355 */
154 };
155
156 typedef union YYSTYPE YYSTYPE;
157 # define YYSTYPE_IS_TRIVIAL 1
158 # define YYSTYPE_IS_DECLARED 1
159 #endif
160
161 /* Location type. */
162 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
163 typedef struct YYLTYPE YYLTYPE;
164 struct YYLTYPE
165 {
166 int first_line;
167 int first_column;
168 int last_line;
169 int last_column;
170 };
171 # define YYLTYPE_IS_DECLARED 1
172 # define YYLTYPE_IS_TRIVIAL 1
173 #endif
174
175
176 extern YYSTYPE grecs_meta1_lval;
177 extern YYLTYPE grecs_meta1_lloc;
178 int grecs_meta1_parse (void);
179
180 #endif /* !YY_YY_META_GRAM_H_INCLUDED */
181
182 /* Copy the second part of user declarations. */
183
184 #line 185 "meta1-gram.c" /* yacc.c:358 */
185
186 #ifdef short
187 # undef short
188 #endif
189
190 #ifdef YYTYPE_UINT8
191 typedef YYTYPE_UINT8 grecs_meta1_type_uint8;
192 #else
193 typedef unsigned char grecs_meta1_type_uint8;
194 #endif
195
196 #ifdef YYTYPE_INT8
197 typedef YYTYPE_INT8 grecs_meta1_type_int8;
198 #else
199 typedef signed char grecs_meta1_type_int8;
200 #endif
201
202 #ifdef YYTYPE_UINT16
203 typedef YYTYPE_UINT16 grecs_meta1_type_uint16;
204 #else
205 typedef unsigned short int grecs_meta1_type_uint16;
206 #endif
207
208 #ifdef YYTYPE_INT16
209 typedef YYTYPE_INT16 grecs_meta1_type_int16;
210 #else
211 typedef short int grecs_meta1_type_int16;
212 #endif
213
214 #ifndef YYSIZE_T
215 # ifdef __SIZE_TYPE__
216 # define YYSIZE_T __SIZE_TYPE__
217 # elif defined size_t
218 # define YYSIZE_T size_t
219 # elif ! defined YYSIZE_T
220 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
221 # define YYSIZE_T size_t
222 # else
223 # define YYSIZE_T unsigned int
224 # endif
225 #endif
226
227 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
228
229 #ifndef YY_
230 # if defined YYENABLE_NLS && YYENABLE_NLS
231 # if ENABLE_NLS
232 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
233 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
234 # endif
235 # endif
236 # ifndef YY_
237 # define YY_(Msgid) Msgid
238 # endif
239 #endif
240
241 #ifndef YY_ATTRIBUTE
242 # if (defined __GNUC__ \
243 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
244 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
245 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
246 # else
247 # define YY_ATTRIBUTE(Spec) /* empty */
248 # endif
249 #endif
250
251 #ifndef YY_ATTRIBUTE_PURE
252 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
253 #endif
254
255 #ifndef YY_ATTRIBUTE_UNUSED
256 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
257 #endif
258
259 #if !defined _Noreturn \
260 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
261 # if defined _MSC_VER && 1200 <= _MSC_VER
262 # define _Noreturn __declspec (noreturn)
263 # else
264 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
265 # endif
266 #endif
267
268 /* Suppress unused-variable warnings by "using" E. */
269 #if ! defined lint || defined __GNUC__
270 # define YYUSE(E) ((void) (E))
271 #else
272 # define YYUSE(E) /* empty */
273 #endif
274
275 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
276 /* Suppress an incorrect diagnostic about grecs_meta1_lval being uninitialized. */
277 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
278 _Pragma ("GCC diagnostic push") \
279 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
280 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
281 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
282 _Pragma ("GCC diagnostic pop")
283 #else
284 # define YY_INITIAL_VALUE(Value) Value
285 #endif
286 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
287 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
288 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
289 #endif
290 #ifndef YY_INITIAL_VALUE
291 # define YY_INITIAL_VALUE(Value) /* Nothing. */
292 #endif
293
294
295 #if ! defined grecs_meta1_overflow || YYERROR_VERBOSE
296
297 /* The parser invokes alloca or malloc; define the necessary symbols. */
298
299 # ifdef YYSTACK_USE_ALLOCA
300 # if YYSTACK_USE_ALLOCA
301 # ifdef __GNUC__
302 # define YYSTACK_ALLOC __builtin_alloca
303 # elif defined __BUILTIN_VA_ARG_INCR
304 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
305 # elif defined _AIX
306 # define YYSTACK_ALLOC __alloca
307 # elif defined _MSC_VER
308 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
309 # define alloca _alloca
310 # else
311 # define YYSTACK_ALLOC alloca
312 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
313 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
314 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
315 # ifndef EXIT_SUCCESS
316 # define EXIT_SUCCESS 0
317 # endif
318 # endif
319 # endif
320 # endif
321 # endif
322
323 # ifdef YYSTACK_ALLOC
324 /* Pacify GCC's 'empty if-body' warning. */
325 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
326 # ifndef YYSTACK_ALLOC_MAXIMUM
327 /* The OS might guarantee only one guard page at the bottom of the stack,
328 and a page size can be as small as 4096 bytes. So we cannot safely
329 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
330 to allow for a few compiler-allocated temporary stack slots. */
331 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
332 # endif
333 # else
334 # define YYSTACK_ALLOC YYMALLOC
335 # define YYSTACK_FREE YYFREE
336 # ifndef YYSTACK_ALLOC_MAXIMUM
337 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
338 # endif
339 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
340 && ! ((defined YYMALLOC || defined malloc) \
341 && (defined YYFREE || defined free)))
342 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
343 # ifndef EXIT_SUCCESS
344 # define EXIT_SUCCESS 0
345 # endif
346 # endif
347 # ifndef YYMALLOC
348 # define YYMALLOC malloc
349 # if ! defined malloc && ! defined EXIT_SUCCESS
350 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
351 # endif
352 # endif
353 # ifndef YYFREE
354 # define YYFREE free
355 # if ! defined free && ! defined EXIT_SUCCESS
356 void free (void *); /* INFRINGES ON USER NAME SPACE */
357 # endif
358 # endif
359 # endif
360 #endif /* ! defined grecs_meta1_overflow || YYERROR_VERBOSE */
361
362
363 #if (! defined grecs_meta1_overflow \
364 && (! defined __cplusplus \
365 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
366 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
367
368 /* A type that is properly aligned for any stack member. */
369 union grecs_meta1_alloc
370 {
371 grecs_meta1_type_int16 grecs_meta1_ss_alloc;
372 YYSTYPE grecs_meta1_vs_alloc;
373 YYLTYPE grecs_meta1_ls_alloc;
374 };
375
376 /* The size of the maximum gap between one aligned stack and the next. */
377 # define YYSTACK_GAP_MAXIMUM (sizeof (union grecs_meta1_alloc) - 1)
378
379 /* The size of an array large to enough to hold all stacks, each with
380 N elements. */
381 # define YYSTACK_BYTES(N) \
382 ((N) * (sizeof (grecs_meta1_type_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
383 + 2 * YYSTACK_GAP_MAXIMUM)
384
385 # define YYCOPY_NEEDED 1
386
387 /* Relocate STACK from its old location to the new one. The
388 local variables YYSIZE and YYSTACKSIZE give the old and new number of
389 elements in the stack, and YYPTR gives the new location of the
390 stack. Advance YYPTR to a properly aligned location for the next
391 stack. */
392 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
393 do \
394 { \
395 YYSIZE_T grecs_meta1_newbytes; \
396 YYCOPY (&grecs_meta1_ptr->Stack_alloc, Stack, grecs_meta1_size); \
397 Stack = &grecs_meta1_ptr->Stack_alloc; \
398 grecs_meta1_newbytes = grecs_meta1_stacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
399 grecs_meta1_ptr += grecs_meta1_newbytes / sizeof (*grecs_meta1_ptr); \
400 } \
401 while (0)
402
403 #endif
404
405 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
406 /* Copy COUNT objects from SRC to DST. The source and destination do
407 not overlap. */
408 # ifndef YYCOPY
409 # if defined __GNUC__ && 1 < __GNUC__
410 # define YYCOPY(Dst, Src, Count) \
411 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
412 # else
413 # define YYCOPY(Dst, Src, Count) \
414 do \
415 { \
416 YYSIZE_T grecs_meta1_i; \
417 for (grecs_meta1_i = 0; grecs_meta1_i < (Count); grecs_meta1_i++) \
418 (Dst)[grecs_meta1_i] = (Src)[grecs_meta1_i]; \
419 } \
420 while (0)
421 # endif
422 # endif
423 #endif /* !YYCOPY_NEEDED */
424
425 /* YYFINAL -- State number of the termination state. */
426 #define YYFINAL 11
427 /* YYLAST -- Last index in YYTABLE. */
428 #define YYLAST 23
429
430 /* YYNTOKENS -- Number of terminals. */
431 #define YYNTOKENS 10
432 /* YYNNTS -- Number of nonterminals. */
433 #define YYNNTS 15
434 /* YYNRULES -- Number of rules. */
435 #define YYNRULES 25
436 /* YYNSTATES -- Number of states. */
437 #define YYNSTATES 34
438
439 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
440 by grecs_meta1_lex, with out-of-bounds checking. */
441 #define YYUNDEFTOK 2
442 #define YYMAXUTOK 259
443
444 #define YYTRANSLATE(YYX) \
445 ((unsigned int) (YYX) <= YYMAXUTOK ? grecs_meta1_translate[YYX] : YYUNDEFTOK)
446
447 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
448 as returned by grecs_meta1_lex, without out-of-bounds checking. */
449 static const grecs_meta1_type_uint8 grecs_meta1_translate[] =
450 {
451 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 8, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 9,
457 2, 5, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 6, 2, 7, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
465 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
466 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
467 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
468 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
469 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
470 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
471 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
472 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
473 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
474 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
475 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
476 2, 2, 2, 2, 2, 2, 1, 2, 3, 4
477 };
478
479 #if YYDEBUG
480 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
481 static const grecs_meta1_type_uint8 grecs_meta1_rline[] =
482 {
483 0, 53, 53, 63, 66, 72, 76, 82, 83, 86,
484 96, 108, 111, 119, 126, 135, 136, 139, 153, 158,
485 165, 169, 175, 180, 187, 188
486 };
487 #endif
488
489 #if YYDEBUG || YYERROR_VERBOSE || 1
490 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
491 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
492 static const char *const grecs_meta1_tname[] =
493 {
494 "$end", "error", "$undefined", "META1_STRING", "META1_IDENT", "'='",
495 "'{'", "'}'", "','", "';'", "$accept", "input", "maybe_stmtlist",
496 "stmtlist", "stmt", "simple", "block", "tag", "value", "string", "slist",
497 "slist0", "list", "values", "opt_sc", YY_NULLPTR
498 };
499 #endif
500
501 # ifdef YYPRINT
502 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
503 (internal) symbol number NUM (which must be that of a token). */
504 static const grecs_meta1_type_uint16 grecs_meta1_toknum[] =
505 {
506 0, 256, 257, 258, 259, 61, 123, 125, 44, 59
507 };
508 # endif
509
510 #define YYPACT_NINF -15
511
512 #define grecs_meta1_pact_value_is_default(Yystate) \
513 (!!((Yystate) == (-15)))
514
515 #define YYTABLE_NINF -1
516
517 #define grecs_meta1_table_value_is_error(Yytable_value) \
518 0
519
520 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
521 STATE-NUM. */
522 static const grecs_meta1_type_int8 grecs_meta1_pact[] =
523 {
524 0, 9, 11, -15, 0, -15, -15, -15, -15, 4,
525 13, -15, -15, -15, -15, 4, 7, -15, -15, 17,
526 -15, 0, -15, 10, -15, -15, -15, 5, -15, -1,
527 7, -15, -15, -15
528 };
529
530 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
531 Performed when YYTABLE does not specify something else to do. Zero
532 means the default is an error. */
533 static const grecs_meta1_type_uint8 grecs_meta1_defact[] =
534 {
535 3, 11, 0, 2, 4, 5, 7, 8, 12, 0,
536 0, 1, 6, 18, 15, 0, 24, 13, 16, 17,
537 14, 0, 22, 0, 25, 9, 19, 0, 20, 0,
538 24, 21, 23, 10
539 };
540
541 /* YYPGOTO[NTERM-NUM]. */
542 static const grecs_meta1_type_int8 grecs_meta1_pgoto[] =
543 {
544 -15, -15, -15, 1, -4, -15, -15, -15, -14, -15,
545 -15, -15, -15, -15, -9
546 };
547
548 /* YYDEFGOTO[NTERM-NUM]. */
549 static const grecs_meta1_type_int8 grecs_meta1_defgoto[] =
550 {
551 -1, 2, 3, 4, 5, 6, 7, 10, 16, 17,
552 18, 19, 20, 23, 25
553 };
554
555 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
556 positive, shift that token. If negative, reduce the rule whose
557 number is the opposite. If YYTABLE_NINF, syntax error. */
558 static const grecs_meta1_type_uint8 grecs_meta1_table[] =
559 {
560 12, 22, 13, 14, 1, 15, 31, 13, 14, 1,
561 15, 11, 30, 8, 9, 32, 24, 28, 29, 21,
562 26, 33, 27, 12
563 };
564
565 static const grecs_meta1_type_uint8 grecs_meta1_check[] =
566 {
567 4, 15, 3, 4, 4, 6, 7, 3, 4, 4,
568 6, 0, 7, 4, 5, 29, 9, 7, 8, 6,
569 3, 30, 21, 27
570 };
571
572 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
573 symbol of state STATE-NUM. */
574 static const grecs_meta1_type_uint8 grecs_meta1_stos[] =
575 {
576 0, 4, 11, 12, 13, 14, 15, 16, 4, 5,
577 17, 0, 14, 3, 4, 6, 18, 19, 20, 21,
578 22, 6, 18, 23, 9, 24, 3, 13, 7, 8,
579 7, 7, 18, 24
580 };
581
582 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
583 static const grecs_meta1_type_uint8 grecs_meta1_r1[] =
584 {
585 0, 10, 11, 12, 12, 13, 13, 14, 14, 15,
586 16, 17, 17, 18, 18, 19, 19, 20, 21, 21,
587 22, 22, 23, 23, 24, 24
588 };
589
590 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
591 static const grecs_meta1_type_uint8 grecs_meta1_r2[] =
592 {
593 0, 2, 1, 0, 1, 1, 2, 1, 1, 4,
594 6, 0, 1, 1, 1, 1, 1, 1, 1, 2,
595 3, 4, 1, 3, 0, 1
596 };
597
598
599 #define grecs_meta1_errok (grecs_meta1_errstatus = 0)
600 #define grecs_meta1_clearin (grecs_meta1_char = YYEMPTY)
601 #define YYEMPTY (-2)
602 #define YYEOF 0
603
604 #define YYACCEPT goto grecs_meta1_acceptlab
605 #define YYABORT goto grecs_meta1_abortlab
606 #define YYERROR goto grecs_meta1_errorlab
607
608
609 #define YYRECOVERING() (!!grecs_meta1_errstatus)
610
611 #define YYBACKUP(Token, Value) \
612 do \
613 if (grecs_meta1_char == YYEMPTY) \
614 { \
615 grecs_meta1_char = (Token); \
616 grecs_meta1_lval = (Value); \
617 YYPOPSTACK (grecs_meta1_len); \
618 grecs_meta1_state = *grecs_meta1_ssp; \
619 goto grecs_meta1_backup; \
620 } \
621 else \
622 { \
623 grecs_meta1_error (YY_("syntax error: cannot back up")); \
624 YYERROR; \
625 } \
626 while (0)
627
628 /* Error token number */
629 #define YYTERROR 1
630 #define YYERRCODE 256
631
632
633 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
634 If N is 0, then set CURRENT to the empty location which ends
635 the previous symbol: RHS[0] (always defined). */
636
637 #ifndef YYLLOC_DEFAULT
638 # define YYLLOC_DEFAULT(Current, Rhs, N) \
639 do \
640 if (N) \
641 { \
642 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
643 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
644 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
645 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
646 } \
647 else \
648 { \
649 (Current).first_line = (Current).last_line = \
650 YYRHSLOC (Rhs, 0).last_line; \
651 (Current).first_column = (Current).last_column = \
652 YYRHSLOC (Rhs, 0).last_column; \
653 } \
654 while (0)
655 #endif
656
657 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
658
659
660 /* Enable debugging if requested. */
661 #if YYDEBUG
662
663 # ifndef YYFPRINTF
664 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
665 # define YYFPRINTF fprintf
666 # endif
667
668 # define YYDPRINTF(Args) \
669 do { \
670 if (grecs_meta1_debug) \
671 YYFPRINTF Args; \
672 } while (0)
673
674
675 /* YY_LOCATION_PRINT -- Print the location on the stream.
676 This macro was not mandated originally: define only if we know
677 we won't break user code: when these are the locations we know. */
678
679 #ifndef YY_LOCATION_PRINT
680 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
681
682 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
683
684 YY_ATTRIBUTE_UNUSED
685 static unsigned
grecs_meta1__location_print_(FILE * grecs_meta1_o,YYLTYPE const * const grecs_meta1_locp)686 grecs_meta1__location_print_ (FILE *grecs_meta1_o, YYLTYPE const * const grecs_meta1_locp)
687 {
688 unsigned res = 0;
689 int end_col = 0 != grecs_meta1_locp->last_column ? grecs_meta1_locp->last_column - 1 : 0;
690 if (0 <= grecs_meta1_locp->first_line)
691 {
692 res += YYFPRINTF (grecs_meta1_o, "%d", grecs_meta1_locp->first_line);
693 if (0 <= grecs_meta1_locp->first_column)
694 res += YYFPRINTF (grecs_meta1_o, ".%d", grecs_meta1_locp->first_column);
695 }
696 if (0 <= grecs_meta1_locp->last_line)
697 {
698 if (grecs_meta1_locp->first_line < grecs_meta1_locp->last_line)
699 {
700 res += YYFPRINTF (grecs_meta1_o, "-%d", grecs_meta1_locp->last_line);
701 if (0 <= end_col)
702 res += YYFPRINTF (grecs_meta1_o, ".%d", end_col);
703 }
704 else if (0 <= end_col && grecs_meta1_locp->first_column < end_col)
705 res += YYFPRINTF (grecs_meta1_o, "-%d", end_col);
706 }
707 return res;
708 }
709
710 # define YY_LOCATION_PRINT(File, Loc) \
711 grecs_meta1__location_print_ (File, &(Loc))
712
713 # else
714 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
715 # endif
716 #endif
717
718
719 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
720 do { \
721 if (grecs_meta1_debug) \
722 { \
723 YYFPRINTF (stderr, "%s ", Title); \
724 grecs_meta1__symbol_print (stderr, \
725 Type, Value, Location); \
726 YYFPRINTF (stderr, "\n"); \
727 } \
728 } while (0)
729
730
731 /*----------------------------------------.
732 | Print this symbol's value on YYOUTPUT. |
733 `----------------------------------------*/
734
735 static void
grecs_meta1__symbol_value_print(FILE * grecs_meta1_output,int grecs_meta1_type,YYSTYPE const * const grecs_meta1_valuep,YYLTYPE const * const grecs_meta1_locationp)736 grecs_meta1__symbol_value_print (FILE *grecs_meta1_output, int grecs_meta1_type, YYSTYPE const * const grecs_meta1_valuep, YYLTYPE const * const grecs_meta1_locationp)
737 {
738 FILE *grecs_meta1_o = grecs_meta1_output;
739 YYUSE (grecs_meta1_o);
740 YYUSE (grecs_meta1_locationp);
741 if (!grecs_meta1_valuep)
742 return;
743 # ifdef YYPRINT
744 if (grecs_meta1_type < YYNTOKENS)
745 YYPRINT (grecs_meta1_output, grecs_meta1_toknum[grecs_meta1_type], *grecs_meta1_valuep);
746 # endif
747 YYUSE (grecs_meta1_type);
748 }
749
750
751 /*--------------------------------.
752 | Print this symbol on YYOUTPUT. |
753 `--------------------------------*/
754
755 static void
grecs_meta1__symbol_print(FILE * grecs_meta1_output,int grecs_meta1_type,YYSTYPE const * const grecs_meta1_valuep,YYLTYPE const * const grecs_meta1_locationp)756 grecs_meta1__symbol_print (FILE *grecs_meta1_output, int grecs_meta1_type, YYSTYPE const * const grecs_meta1_valuep, YYLTYPE const * const grecs_meta1_locationp)
757 {
758 YYFPRINTF (grecs_meta1_output, "%s %s (",
759 grecs_meta1_type < YYNTOKENS ? "token" : "nterm", grecs_meta1_tname[grecs_meta1_type]);
760
761 YY_LOCATION_PRINT (grecs_meta1_output, *grecs_meta1_locationp);
762 YYFPRINTF (grecs_meta1_output, ": ");
763 grecs_meta1__symbol_value_print (grecs_meta1_output, grecs_meta1_type, grecs_meta1_valuep, grecs_meta1_locationp);
764 YYFPRINTF (grecs_meta1_output, ")");
765 }
766
767 /*------------------------------------------------------------------.
768 | grecs_meta1__stack_print -- Print the state stack from its BOTTOM up to its |
769 | TOP (included). |
770 `------------------------------------------------------------------*/
771
772 static void
grecs_meta1__stack_print(grecs_meta1_type_int16 * grecs_meta1_bottom,grecs_meta1_type_int16 * grecs_meta1_top)773 grecs_meta1__stack_print (grecs_meta1_type_int16 *grecs_meta1_bottom, grecs_meta1_type_int16 *grecs_meta1_top)
774 {
775 YYFPRINTF (stderr, "Stack now");
776 for (; grecs_meta1_bottom <= grecs_meta1_top; grecs_meta1_bottom++)
777 {
778 int grecs_meta1_bot = *grecs_meta1_bottom;
779 YYFPRINTF (stderr, " %d", grecs_meta1_bot);
780 }
781 YYFPRINTF (stderr, "\n");
782 }
783
784 # define YY_STACK_PRINT(Bottom, Top) \
785 do { \
786 if (grecs_meta1_debug) \
787 grecs_meta1__stack_print ((Bottom), (Top)); \
788 } while (0)
789
790
791 /*------------------------------------------------.
792 | Report that the YYRULE is going to be reduced. |
793 `------------------------------------------------*/
794
795 static void
grecs_meta1__reduce_print(grecs_meta1_type_int16 * grecs_meta1_ssp,YYSTYPE * grecs_meta1_vsp,YYLTYPE * grecs_meta1_lsp,int grecs_meta1_rule)796 grecs_meta1__reduce_print (grecs_meta1_type_int16 *grecs_meta1_ssp, YYSTYPE *grecs_meta1_vsp, YYLTYPE *grecs_meta1_lsp, int grecs_meta1_rule)
797 {
798 unsigned long int grecs_meta1_lno = grecs_meta1_rline[grecs_meta1_rule];
799 int grecs_meta1_nrhs = grecs_meta1_r2[grecs_meta1_rule];
800 int grecs_meta1_i;
801 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
802 grecs_meta1_rule - 1, grecs_meta1_lno);
803 /* The symbols being reduced. */
804 for (grecs_meta1_i = 0; grecs_meta1_i < grecs_meta1_nrhs; grecs_meta1_i++)
805 {
806 YYFPRINTF (stderr, " $%d = ", grecs_meta1_i + 1);
807 grecs_meta1__symbol_print (stderr,
808 grecs_meta1_stos[grecs_meta1_ssp[grecs_meta1_i + 1 - grecs_meta1_nrhs]],
809 &(grecs_meta1_vsp[(grecs_meta1_i + 1) - (grecs_meta1_nrhs)])
810 , &(grecs_meta1_lsp[(grecs_meta1_i + 1) - (grecs_meta1_nrhs)]) );
811 YYFPRINTF (stderr, "\n");
812 }
813 }
814
815 # define YY_REDUCE_PRINT(Rule) \
816 do { \
817 if (grecs_meta1_debug) \
818 grecs_meta1__reduce_print (grecs_meta1_ssp, grecs_meta1_vsp, grecs_meta1_lsp, Rule); \
819 } while (0)
820
821 /* Nonzero means print parse trace. It is left uninitialized so that
822 multiple parsers can coexist. */
823 int grecs_meta1_debug;
824 #else /* !YYDEBUG */
825 # define YYDPRINTF(Args)
826 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
827 # define YY_STACK_PRINT(Bottom, Top)
828 # define YY_REDUCE_PRINT(Rule)
829 #endif /* !YYDEBUG */
830
831
832 /* YYINITDEPTH -- initial size of the parser's stacks. */
833 #ifndef YYINITDEPTH
834 # define YYINITDEPTH 200
835 #endif
836
837 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
838 if the built-in stack extension method is used).
839
840 Do not make this value too large; the results are undefined if
841 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
842 evaluated with infinite-precision integer arithmetic. */
843
844 #ifndef YYMAXDEPTH
845 # define YYMAXDEPTH 10000
846 #endif
847
848
849 #if YYERROR_VERBOSE
850
851 # ifndef grecs_meta1_strlen
852 # if defined __GLIBC__ && defined _STRING_H
853 # define grecs_meta1_strlen strlen
854 # else
855 /* Return the length of YYSTR. */
856 static YYSIZE_T
grecs_meta1_strlen(const char * grecs_meta1_str)857 grecs_meta1_strlen (const char *grecs_meta1_str)
858 {
859 YYSIZE_T grecs_meta1_len;
860 for (grecs_meta1_len = 0; grecs_meta1_str[grecs_meta1_len]; grecs_meta1_len++)
861 continue;
862 return grecs_meta1_len;
863 }
864 # endif
865 # endif
866
867 # ifndef grecs_meta1_stpcpy
868 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
869 # define grecs_meta1_stpcpy stpcpy
870 # else
871 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
872 YYDEST. */
873 static char *
grecs_meta1_stpcpy(char * grecs_meta1_dest,const char * grecs_meta1_src)874 grecs_meta1_stpcpy (char *grecs_meta1_dest, const char *grecs_meta1_src)
875 {
876 char *grecs_meta1_d = grecs_meta1_dest;
877 const char *grecs_meta1_s = grecs_meta1_src;
878
879 while ((*grecs_meta1_d++ = *grecs_meta1_s++) != '\0')
880 continue;
881
882 return grecs_meta1_d - 1;
883 }
884 # endif
885 # endif
886
887 # ifndef grecs_meta1_tnamerr
888 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
889 quotes and backslashes, so that it's suitable for grecs_meta1_error. The
890 heuristic is that double-quoting is unnecessary unless the string
891 contains an apostrophe, a comma, or backslash (other than
892 backslash-backslash). YYSTR is taken from grecs_meta1_tname. If YYRES is
893 null, do not copy; instead, return the length of what the result
894 would have been. */
895 static YYSIZE_T
grecs_meta1_tnamerr(char * grecs_meta1_res,const char * grecs_meta1_str)896 grecs_meta1_tnamerr (char *grecs_meta1_res, const char *grecs_meta1_str)
897 {
898 if (*grecs_meta1_str == '"')
899 {
900 YYSIZE_T grecs_meta1_n = 0;
901 char const *grecs_meta1_p = grecs_meta1_str;
902
903 for (;;)
904 switch (*++grecs_meta1_p)
905 {
906 case '\'':
907 case ',':
908 goto do_not_strip_quotes;
909
910 case '\\':
911 if (*++grecs_meta1_p != '\\')
912 goto do_not_strip_quotes;
913 /* Fall through. */
914 default:
915 if (grecs_meta1_res)
916 grecs_meta1_res[grecs_meta1_n] = *grecs_meta1_p;
917 grecs_meta1_n++;
918 break;
919
920 case '"':
921 if (grecs_meta1_res)
922 grecs_meta1_res[grecs_meta1_n] = '\0';
923 return grecs_meta1_n;
924 }
925 do_not_strip_quotes: ;
926 }
927
928 if (! grecs_meta1_res)
929 return grecs_meta1_strlen (grecs_meta1_str);
930
931 return grecs_meta1_stpcpy (grecs_meta1_res, grecs_meta1_str) - grecs_meta1_res;
932 }
933 # endif
934
935 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
936 about the unexpected token YYTOKEN for the state stack whose top is
937 YYSSP.
938
939 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
940 not large enough to hold the message. In that case, also set
941 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
942 required number of bytes is too large to store. */
943 static int
grecs_meta1_syntax_error(YYSIZE_T * grecs_meta1_msg_alloc,char ** grecs_meta1_msg,grecs_meta1_type_int16 * grecs_meta1_ssp,int grecs_meta1_token)944 grecs_meta1_syntax_error (YYSIZE_T *grecs_meta1_msg_alloc, char **grecs_meta1_msg,
945 grecs_meta1_type_int16 *grecs_meta1_ssp, int grecs_meta1_token)
946 {
947 YYSIZE_T grecs_meta1_size0 = grecs_meta1_tnamerr (YY_NULLPTR, grecs_meta1_tname[grecs_meta1_token]);
948 YYSIZE_T grecs_meta1_size = grecs_meta1_size0;
949 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
950 /* Internationalized format string. */
951 const char *grecs_meta1_format = YY_NULLPTR;
952 /* Arguments of grecs_meta1_format. */
953 char const *grecs_meta1_arg[YYERROR_VERBOSE_ARGS_MAXIMUM];
954 /* Number of reported tokens (one for the "unexpected", one per
955 "expected"). */
956 int grecs_meta1_count = 0;
957
958 /* There are many possibilities here to consider:
959 - If this state is a consistent state with a default action, then
960 the only way this function was invoked is if the default action
961 is an error action. In that case, don't check for expected
962 tokens because there are none.
963 - The only way there can be no lookahead present (in grecs_meta1_char) is if
964 this state is a consistent state with a default action. Thus,
965 detecting the absence of a lookahead is sufficient to determine
966 that there is no unexpected or expected token to report. In that
967 case, just report a simple "syntax error".
968 - Don't assume there isn't a lookahead just because this state is a
969 consistent state with a default action. There might have been a
970 previous inconsistent state, consistent state with a non-default
971 action, or user semantic action that manipulated grecs_meta1_char.
972 - Of course, the expected token list depends on states to have
973 correct lookahead information, and it depends on the parser not
974 to perform extra reductions after fetching a lookahead from the
975 scanner and before detecting a syntax error. Thus, state merging
976 (from LALR or IELR) and default reductions corrupt the expected
977 token list. However, the list is correct for canonical LR with
978 one exception: it will still contain any token that will not be
979 accepted due to an error action in a later state.
980 */
981 if (grecs_meta1_token != YYEMPTY)
982 {
983 int grecs_meta1_n = grecs_meta1_pact[*grecs_meta1_ssp];
984 grecs_meta1_arg[grecs_meta1_count++] = grecs_meta1_tname[grecs_meta1_token];
985 if (!grecs_meta1_pact_value_is_default (grecs_meta1_n))
986 {
987 /* Start YYX at -YYN if negative to avoid negative indexes in
988 YYCHECK. In other words, skip the first -YYN actions for
989 this state because they are default actions. */
990 int grecs_meta1_xbegin = grecs_meta1_n < 0 ? -grecs_meta1_n : 0;
991 /* Stay within bounds of both grecs_meta1_check and grecs_meta1_tname. */
992 int grecs_meta1_checklim = YYLAST - grecs_meta1_n + 1;
993 int grecs_meta1_xend = grecs_meta1_checklim < YYNTOKENS ? grecs_meta1_checklim : YYNTOKENS;
994 int grecs_meta1_x;
995
996 for (grecs_meta1_x = grecs_meta1_xbegin; grecs_meta1_x < grecs_meta1_xend; ++grecs_meta1_x)
997 if (grecs_meta1_check[grecs_meta1_x + grecs_meta1_n] == grecs_meta1_x && grecs_meta1_x != YYTERROR
998 && !grecs_meta1_table_value_is_error (grecs_meta1_table[grecs_meta1_x + grecs_meta1_n]))
999 {
1000 if (grecs_meta1_count == YYERROR_VERBOSE_ARGS_MAXIMUM)
1001 {
1002 grecs_meta1_count = 1;
1003 grecs_meta1_size = grecs_meta1_size0;
1004 break;
1005 }
1006 grecs_meta1_arg[grecs_meta1_count++] = grecs_meta1_tname[grecs_meta1_x];
1007 {
1008 YYSIZE_T grecs_meta1_size1 = grecs_meta1_size + grecs_meta1_tnamerr (YY_NULLPTR, grecs_meta1_tname[grecs_meta1_x]);
1009 if (! (grecs_meta1_size <= grecs_meta1_size1
1010 && grecs_meta1_size1 <= YYSTACK_ALLOC_MAXIMUM))
1011 return 2;
1012 grecs_meta1_size = grecs_meta1_size1;
1013 }
1014 }
1015 }
1016 }
1017
1018 switch (grecs_meta1_count)
1019 {
1020 # define YYCASE_(N, S) \
1021 case N: \
1022 grecs_meta1_format = S; \
1023 break
1024 YYCASE_(0, YY_("syntax error"));
1025 YYCASE_(1, YY_("syntax error, unexpected %s"));
1026 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1027 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1028 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1029 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1030 # undef YYCASE_
1031 }
1032
1033 {
1034 YYSIZE_T grecs_meta1_size1 = grecs_meta1_size + grecs_meta1_strlen (grecs_meta1_format);
1035 if (! (grecs_meta1_size <= grecs_meta1_size1 && grecs_meta1_size1 <= YYSTACK_ALLOC_MAXIMUM))
1036 return 2;
1037 grecs_meta1_size = grecs_meta1_size1;
1038 }
1039
1040 if (*grecs_meta1_msg_alloc < grecs_meta1_size)
1041 {
1042 *grecs_meta1_msg_alloc = 2 * grecs_meta1_size;
1043 if (! (grecs_meta1_size <= *grecs_meta1_msg_alloc
1044 && *grecs_meta1_msg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1045 *grecs_meta1_msg_alloc = YYSTACK_ALLOC_MAXIMUM;
1046 return 1;
1047 }
1048
1049 /* Avoid sprintf, as that infringes on the user's name space.
1050 Don't have undefined behavior even if the translation
1051 produced a string with the wrong number of "%s"s. */
1052 {
1053 char *grecs_meta1_p = *grecs_meta1_msg;
1054 int grecs_meta1_i = 0;
1055 while ((*grecs_meta1_p = *grecs_meta1_format) != '\0')
1056 if (*grecs_meta1_p == '%' && grecs_meta1_format[1] == 's' && grecs_meta1_i < grecs_meta1_count)
1057 {
1058 grecs_meta1_p += grecs_meta1_tnamerr (grecs_meta1_p, grecs_meta1_arg[grecs_meta1_i++]);
1059 grecs_meta1_format += 2;
1060 }
1061 else
1062 {
1063 grecs_meta1_p++;
1064 grecs_meta1_format++;
1065 }
1066 }
1067 return 0;
1068 }
1069 #endif /* YYERROR_VERBOSE */
1070
1071 /*-----------------------------------------------.
1072 | Release the memory associated to this symbol. |
1073 `-----------------------------------------------*/
1074
1075 static void
grecs_meta1_destruct(const char * grecs_meta1_msg,int grecs_meta1_type,YYSTYPE * grecs_meta1_valuep,YYLTYPE * grecs_meta1_locationp)1076 grecs_meta1_destruct (const char *grecs_meta1_msg, int grecs_meta1_type, YYSTYPE *grecs_meta1_valuep, YYLTYPE *grecs_meta1_locationp)
1077 {
1078 YYUSE (grecs_meta1_valuep);
1079 YYUSE (grecs_meta1_locationp);
1080 if (!grecs_meta1_msg)
1081 grecs_meta1_msg = "Deleting";
1082 YY_SYMBOL_PRINT (grecs_meta1_msg, grecs_meta1_type, grecs_meta1_valuep, grecs_meta1_locationp);
1083
1084 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1085 YYUSE (grecs_meta1_type);
1086 YY_IGNORE_MAYBE_UNINITIALIZED_END
1087 }
1088
1089
1090
1091
1092 /* The lookahead symbol. */
1093 int grecs_meta1_char;
1094
1095 /* The semantic value of the lookahead symbol. */
1096 YYSTYPE grecs_meta1_lval;
1097 /* Location data for the lookahead symbol. */
1098 YYLTYPE grecs_meta1_lloc
1099 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1100 = { 1, 1, 1, 1 }
1101 # endif
1102 ;
1103 /* Number of syntax errors so far. */
1104 int grecs_meta1_nerrs;
1105
1106
1107 /*----------.
1108 | grecs_meta1_parse. |
1109 `----------*/
1110
1111 int
grecs_meta1_parse(void)1112 grecs_meta1_parse (void)
1113 {
1114 int grecs_meta1_state;
1115 /* Number of tokens to shift before error messages enabled. */
1116 int grecs_meta1_errstatus;
1117
1118 /* The stacks and their tools:
1119 'grecs_meta1_ss': related to states.
1120 'grecs_meta1_vs': related to semantic values.
1121 'grecs_meta1_ls': related to locations.
1122
1123 Refer to the stacks through separate pointers, to allow grecs_meta1_overflow
1124 to reallocate them elsewhere. */
1125
1126 /* The state stack. */
1127 grecs_meta1_type_int16 grecs_meta1_ssa[YYINITDEPTH];
1128 grecs_meta1_type_int16 *grecs_meta1_ss;
1129 grecs_meta1_type_int16 *grecs_meta1_ssp;
1130
1131 /* The semantic value stack. */
1132 YYSTYPE grecs_meta1_vsa[YYINITDEPTH];
1133 YYSTYPE *grecs_meta1_vs;
1134 YYSTYPE *grecs_meta1_vsp;
1135
1136 /* The location stack. */
1137 YYLTYPE grecs_meta1_lsa[YYINITDEPTH];
1138 YYLTYPE *grecs_meta1_ls;
1139 YYLTYPE *grecs_meta1_lsp;
1140
1141 /* The locations where the error started and ended. */
1142 YYLTYPE grecs_meta1_error_range[3];
1143
1144 YYSIZE_T grecs_meta1_stacksize;
1145
1146 int grecs_meta1_n;
1147 int grecs_meta1_result;
1148 /* Lookahead token as an internal (translated) token number. */
1149 int grecs_meta1_token = 0;
1150 /* The variables used to return semantic value and location from the
1151 action routines. */
1152 YYSTYPE grecs_meta1_val;
1153 YYLTYPE grecs_meta1_loc;
1154
1155 #if YYERROR_VERBOSE
1156 /* Buffer for error messages, and its allocated size. */
1157 char grecs_meta1_msgbuf[128];
1158 char *grecs_meta1_msg = grecs_meta1_msgbuf;
1159 YYSIZE_T grecs_meta1_msg_alloc = sizeof grecs_meta1_msgbuf;
1160 #endif
1161
1162 #define YYPOPSTACK(N) (grecs_meta1_vsp -= (N), grecs_meta1_ssp -= (N), grecs_meta1_lsp -= (N))
1163
1164 /* The number of symbols on the RHS of the reduced rule.
1165 Keep to zero when no symbol should be popped. */
1166 int grecs_meta1_len = 0;
1167
1168 grecs_meta1_ssp = grecs_meta1_ss = grecs_meta1_ssa;
1169 grecs_meta1_vsp = grecs_meta1_vs = grecs_meta1_vsa;
1170 grecs_meta1_lsp = grecs_meta1_ls = grecs_meta1_lsa;
1171 grecs_meta1_stacksize = YYINITDEPTH;
1172
1173 YYDPRINTF ((stderr, "Starting parse\n"));
1174
1175 grecs_meta1_state = 0;
1176 grecs_meta1_errstatus = 0;
1177 grecs_meta1_nerrs = 0;
1178 grecs_meta1_char = YYEMPTY; /* Cause a token to be read. */
1179 grecs_meta1_lsp[0] = grecs_meta1_lloc;
1180 goto grecs_meta1_setstate;
1181
1182 /*------------------------------------------------------------.
1183 | grecs_meta1_newstate -- Push a new state, which is found in grecs_meta1_state. |
1184 `------------------------------------------------------------*/
1185 grecs_meta1_newstate:
1186 /* In all cases, when you get here, the value and location stacks
1187 have just been pushed. So pushing a state here evens the stacks. */
1188 grecs_meta1_ssp++;
1189
1190 grecs_meta1_setstate:
1191 *grecs_meta1_ssp = grecs_meta1_state;
1192
1193 if (grecs_meta1_ss + grecs_meta1_stacksize - 1 <= grecs_meta1_ssp)
1194 {
1195 /* Get the current used size of the three stacks, in elements. */
1196 YYSIZE_T grecs_meta1_size = grecs_meta1_ssp - grecs_meta1_ss + 1;
1197
1198 #ifdef grecs_meta1_overflow
1199 {
1200 /* Give user a chance to reallocate the stack. Use copies of
1201 these so that the &'s don't force the real ones into
1202 memory. */
1203 YYSTYPE *grecs_meta1_vs1 = grecs_meta1_vs;
1204 grecs_meta1_type_int16 *grecs_meta1_ss1 = grecs_meta1_ss;
1205 YYLTYPE *grecs_meta1_ls1 = grecs_meta1_ls;
1206
1207 /* Each stack pointer address is followed by the size of the
1208 data in use in that stack, in bytes. This used to be a
1209 conditional around just the two extra args, but that might
1210 be undefined if grecs_meta1_overflow is a macro. */
1211 grecs_meta1_overflow (YY_("memory exhausted"),
1212 &grecs_meta1_ss1, grecs_meta1_size * sizeof (*grecs_meta1_ssp),
1213 &grecs_meta1_vs1, grecs_meta1_size * sizeof (*grecs_meta1_vsp),
1214 &grecs_meta1_ls1, grecs_meta1_size * sizeof (*grecs_meta1_lsp),
1215 &grecs_meta1_stacksize);
1216
1217 grecs_meta1_ls = grecs_meta1_ls1;
1218 grecs_meta1_ss = grecs_meta1_ss1;
1219 grecs_meta1_vs = grecs_meta1_vs1;
1220 }
1221 #else /* no grecs_meta1_overflow */
1222 # ifndef YYSTACK_RELOCATE
1223 goto grecs_meta1_exhaustedlab;
1224 # else
1225 /* Extend the stack our own way. */
1226 if (YYMAXDEPTH <= grecs_meta1_stacksize)
1227 goto grecs_meta1_exhaustedlab;
1228 grecs_meta1_stacksize *= 2;
1229 if (YYMAXDEPTH < grecs_meta1_stacksize)
1230 grecs_meta1_stacksize = YYMAXDEPTH;
1231
1232 {
1233 grecs_meta1_type_int16 *grecs_meta1_ss1 = grecs_meta1_ss;
1234 union grecs_meta1_alloc *grecs_meta1_ptr =
1235 (union grecs_meta1_alloc *) YYSTACK_ALLOC (YYSTACK_BYTES (grecs_meta1_stacksize));
1236 if (! grecs_meta1_ptr)
1237 goto grecs_meta1_exhaustedlab;
1238 YYSTACK_RELOCATE (grecs_meta1_ss_alloc, grecs_meta1_ss);
1239 YYSTACK_RELOCATE (grecs_meta1_vs_alloc, grecs_meta1_vs);
1240 YYSTACK_RELOCATE (grecs_meta1_ls_alloc, grecs_meta1_ls);
1241 # undef YYSTACK_RELOCATE
1242 if (grecs_meta1_ss1 != grecs_meta1_ssa)
1243 YYSTACK_FREE (grecs_meta1_ss1);
1244 }
1245 # endif
1246 #endif /* no grecs_meta1_overflow */
1247
1248 grecs_meta1_ssp = grecs_meta1_ss + grecs_meta1_size - 1;
1249 grecs_meta1_vsp = grecs_meta1_vs + grecs_meta1_size - 1;
1250 grecs_meta1_lsp = grecs_meta1_ls + grecs_meta1_size - 1;
1251
1252 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1253 (unsigned long int) grecs_meta1_stacksize));
1254
1255 if (grecs_meta1_ss + grecs_meta1_stacksize - 1 <= grecs_meta1_ssp)
1256 YYABORT;
1257 }
1258
1259 YYDPRINTF ((stderr, "Entering state %d\n", grecs_meta1_state));
1260
1261 if (grecs_meta1_state == YYFINAL)
1262 YYACCEPT;
1263
1264 goto grecs_meta1_backup;
1265
1266 /*-----------.
1267 | grecs_meta1_backup. |
1268 `-----------*/
1269 grecs_meta1_backup:
1270
1271 /* Do appropriate processing given the current state. Read a
1272 lookahead token if we need one and don't already have one. */
1273
1274 /* First try to decide what to do without reference to lookahead token. */
1275 grecs_meta1_n = grecs_meta1_pact[grecs_meta1_state];
1276 if (grecs_meta1_pact_value_is_default (grecs_meta1_n))
1277 goto grecs_meta1_default;
1278
1279 /* Not known => get a lookahead token if don't already have one. */
1280
1281 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1282 if (grecs_meta1_char == YYEMPTY)
1283 {
1284 YYDPRINTF ((stderr, "Reading a token: "));
1285 grecs_meta1_char = grecs_meta1_lex ();
1286 }
1287
1288 if (grecs_meta1_char <= YYEOF)
1289 {
1290 grecs_meta1_char = grecs_meta1_token = YYEOF;
1291 YYDPRINTF ((stderr, "Now at end of input.\n"));
1292 }
1293 else
1294 {
1295 grecs_meta1_token = YYTRANSLATE (grecs_meta1_char);
1296 YY_SYMBOL_PRINT ("Next token is", grecs_meta1_token, &grecs_meta1_lval, &grecs_meta1_lloc);
1297 }
1298
1299 /* If the proper action on seeing token YYTOKEN is to reduce or to
1300 detect an error, take that action. */
1301 grecs_meta1_n += grecs_meta1_token;
1302 if (grecs_meta1_n < 0 || YYLAST < grecs_meta1_n || grecs_meta1_check[grecs_meta1_n] != grecs_meta1_token)
1303 goto grecs_meta1_default;
1304 grecs_meta1_n = grecs_meta1_table[grecs_meta1_n];
1305 if (grecs_meta1_n <= 0)
1306 {
1307 if (grecs_meta1_table_value_is_error (grecs_meta1_n))
1308 goto grecs_meta1_errlab;
1309 grecs_meta1_n = -grecs_meta1_n;
1310 goto grecs_meta1_reduce;
1311 }
1312
1313 /* Count tokens shifted since error; after three, turn off error
1314 status. */
1315 if (grecs_meta1_errstatus)
1316 grecs_meta1_errstatus--;
1317
1318 /* Shift the lookahead token. */
1319 YY_SYMBOL_PRINT ("Shifting", grecs_meta1_token, &grecs_meta1_lval, &grecs_meta1_lloc);
1320
1321 /* Discard the shifted token. */
1322 grecs_meta1_char = YYEMPTY;
1323
1324 grecs_meta1_state = grecs_meta1_n;
1325 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1326 *++grecs_meta1_vsp = grecs_meta1_lval;
1327 YY_IGNORE_MAYBE_UNINITIALIZED_END
1328 *++grecs_meta1_lsp = grecs_meta1_lloc;
1329 goto grecs_meta1_newstate;
1330
1331
1332 /*-----------------------------------------------------------.
1333 | grecs_meta1_default -- do the default action for the current state. |
1334 `-----------------------------------------------------------*/
1335 grecs_meta1_default:
1336 grecs_meta1_n = grecs_meta1_defact[grecs_meta1_state];
1337 if (grecs_meta1_n == 0)
1338 goto grecs_meta1_errlab;
1339 goto grecs_meta1_reduce;
1340
1341
1342 /*-----------------------------.
1343 | grecs_meta1_reduce -- Do a reduction. |
1344 `-----------------------------*/
1345 grecs_meta1_reduce:
1346 /* grecs_meta1_n is the number of a rule to reduce with. */
1347 grecs_meta1_len = grecs_meta1_r2[grecs_meta1_n];
1348
1349 /* If YYLEN is nonzero, implement the default value of the action:
1350 '$$ = $1'.
1351
1352 Otherwise, the following line sets YYVAL to garbage.
1353 This behavior is undocumented and Bison
1354 users should not rely upon it. Assigning to YYVAL
1355 unconditionally makes the parser a bit smaller, and it avoids a
1356 GCC warning that YYVAL may be used uninitialized. */
1357 grecs_meta1_val = grecs_meta1_vsp[1-grecs_meta1_len];
1358
1359 /* Default location. */
1360 YYLLOC_DEFAULT (grecs_meta1_loc, (grecs_meta1_lsp - grecs_meta1_len), grecs_meta1_len);
1361 YY_REDUCE_PRINT (grecs_meta1_n);
1362 switch (grecs_meta1_n)
1363 {
1364 case 2:
1365 #line 54 "meta1-gram.y" /* yacc.c:1646 */
1366 {
1367 parse_tree = grecs_node_create(grecs_node_root, &(grecs_meta1_lsp[0]));
1368 parse_tree->v.texttab = grecs_text_table();
1369 grecs_node_bind(parse_tree, (grecs_meta1_vsp[0].node), 1);
1370 }
1371 #line 1372 "meta1-gram.c" /* yacc.c:1646 */
1372 break;
1373
1374 case 3:
1375 #line 63 "meta1-gram.y" /* yacc.c:1646 */
1376 {
1377 (grecs_meta1_val.node) = NULL;
1378 }
1379 #line 1380 "meta1-gram.c" /* yacc.c:1646 */
1380 break;
1381
1382 case 4:
1383 #line 67 "meta1-gram.y" /* yacc.c:1646 */
1384 {
1385 (grecs_meta1_val.node) = (grecs_meta1_vsp[0].node_list).head;
1386 }
1387 #line 1388 "meta1-gram.c" /* yacc.c:1646 */
1388 break;
1389
1390 case 5:
1391 #line 73 "meta1-gram.y" /* yacc.c:1646 */
1392 {
1393 (grecs_meta1_val.node_list).head = (grecs_meta1_val.node_list).tail = (grecs_meta1_vsp[0].node);
1394 }
1395 #line 1396 "meta1-gram.c" /* yacc.c:1646 */
1396 break;
1397
1398 case 6:
1399 #line 77 "meta1-gram.y" /* yacc.c:1646 */
1400 {
1401 grecs_node_bind((grecs_meta1_vsp[-1].node_list).tail, (grecs_meta1_vsp[0].node), 0);
1402 }
1403 #line 1404 "meta1-gram.c" /* yacc.c:1646 */
1404 break;
1405
1406 case 9:
1407 #line 87 "meta1-gram.y" /* yacc.c:1646 */
1408 {
1409 (grecs_meta1_val.node) = grecs_node_create_points(grecs_node_stmt,
1410 (grecs_meta1_lsp[-3]).beg, (grecs_meta1_lsp[-1]).end);
1411 (grecs_meta1_val.node)->ident = (grecs_meta1_vsp[-3].string);
1412 (grecs_meta1_val.node)->idloc = (grecs_meta1_lsp[-3]);
1413 (grecs_meta1_val.node)->v.value = (grecs_meta1_vsp[-1].pvalue);
1414 }
1415 #line 1416 "meta1-gram.c" /* yacc.c:1646 */
1416 break;
1417
1418 case 10:
1419 #line 97 "meta1-gram.y" /* yacc.c:1646 */
1420 {
1421 (grecs_meta1_val.node) = grecs_node_create_points(grecs_node_block,
1422 (grecs_meta1_lsp[-5]).beg, (grecs_meta1_lsp[-1]).end);
1423 (grecs_meta1_val.node)->ident = (grecs_meta1_vsp[-5].string);
1424 (grecs_meta1_val.node)->idloc = (grecs_meta1_lsp[-5]);
1425 (grecs_meta1_val.node)->v.value = (grecs_meta1_vsp[-4].pvalue);
1426 grecs_node_bind((grecs_meta1_val.node), (grecs_meta1_vsp[-2].node_list).head, 1);
1427 }
1428 #line 1429 "meta1-gram.c" /* yacc.c:1646 */
1429 break;
1430
1431 case 11:
1432 #line 108 "meta1-gram.y" /* yacc.c:1646 */
1433 {
1434 (grecs_meta1_val.pvalue) = NULL;
1435 }
1436 #line 1437 "meta1-gram.c" /* yacc.c:1646 */
1437 break;
1438
1439 case 12:
1440 #line 112 "meta1-gram.y" /* yacc.c:1646 */
1441 {
1442 (grecs_meta1_val.pvalue) = grecs_malloc(sizeof((grecs_meta1_val.pvalue)[0]));
1443 (grecs_meta1_val.pvalue)->type = GRECS_TYPE_STRING;
1444 (grecs_meta1_val.pvalue)->v.string = (grecs_meta1_vsp[0].string);
1445 }
1446 #line 1447 "meta1-gram.c" /* yacc.c:1646 */
1447 break;
1448
1449 case 13:
1450 #line 120 "meta1-gram.y" /* yacc.c:1646 */
1451 {
1452 (grecs_meta1_val.pvalue) = grecs_malloc(sizeof((grecs_meta1_val.pvalue)[0]));
1453 (grecs_meta1_val.pvalue)->type = GRECS_TYPE_STRING;
1454 (grecs_meta1_val.pvalue)->locus = (grecs_meta1_lsp[0]);
1455 (grecs_meta1_val.pvalue)->v.string = (grecs_meta1_vsp[0].string);
1456 }
1457 #line 1458 "meta1-gram.c" /* yacc.c:1646 */
1458 break;
1459
1460 case 14:
1461 #line 127 "meta1-gram.y" /* yacc.c:1646 */
1462 {
1463 (grecs_meta1_val.pvalue) = grecs_malloc(sizeof((grecs_meta1_val.pvalue)[0]));
1464 (grecs_meta1_val.pvalue)->type = GRECS_TYPE_LIST;
1465 (grecs_meta1_val.pvalue)->locus = (grecs_meta1_lsp[0]);
1466 (grecs_meta1_val.pvalue)->v.list = (grecs_meta1_vsp[0].list);
1467 }
1468 #line 1469 "meta1-gram.c" /* yacc.c:1646 */
1469 break;
1470
1471 case 17:
1472 #line 140 "meta1-gram.y" /* yacc.c:1646 */
1473 {
1474 struct grecs_list_entry *ep;
1475
1476 grecs_line_begin();
1477 for (ep = (grecs_meta1_vsp[0].list)->head; ep; ep = ep->next) {
1478 grecs_line_add(ep->data, strlen(ep->data));
1479 free(ep->data);
1480 ep->data = NULL;
1481 }
1482 (grecs_meta1_val.string) = grecs_line_finish();
1483 grecs_list_free((grecs_meta1_vsp[0].list));
1484 }
1485 #line 1486 "meta1-gram.c" /* yacc.c:1646 */
1486 break;
1487
1488 case 18:
1489 #line 154 "meta1-gram.y" /* yacc.c:1646 */
1490 {
1491 (grecs_meta1_val.list) = grecs_list_create();
1492 grecs_list_append((grecs_meta1_val.list), (grecs_meta1_vsp[0].string));
1493 }
1494 #line 1495 "meta1-gram.c" /* yacc.c:1646 */
1495 break;
1496
1497 case 19:
1498 #line 159 "meta1-gram.y" /* yacc.c:1646 */
1499 {
1500 grecs_list_append((grecs_meta1_vsp[-1].list), (grecs_meta1_vsp[0].string));
1501 (grecs_meta1_val.list) = (grecs_meta1_vsp[-1].list);
1502 }
1503 #line 1504 "meta1-gram.c" /* yacc.c:1646 */
1504 break;
1505
1506 case 20:
1507 #line 166 "meta1-gram.y" /* yacc.c:1646 */
1508 {
1509 (grecs_meta1_val.list) = (grecs_meta1_vsp[-1].list);
1510 }
1511 #line 1512 "meta1-gram.c" /* yacc.c:1646 */
1512 break;
1513
1514 case 21:
1515 #line 170 "meta1-gram.y" /* yacc.c:1646 */
1516 {
1517 (grecs_meta1_val.list) = (grecs_meta1_vsp[-2].list);
1518 }
1519 #line 1520 "meta1-gram.c" /* yacc.c:1646 */
1520 break;
1521
1522 case 22:
1523 #line 176 "meta1-gram.y" /* yacc.c:1646 */
1524 {
1525 (grecs_meta1_val.list) = grecs_value_list_create();
1526 grecs_list_append((grecs_meta1_val.list), (grecs_meta1_vsp[0].pvalue));
1527 }
1528 #line 1529 "meta1-gram.c" /* yacc.c:1646 */
1529 break;
1530
1531 case 23:
1532 #line 181 "meta1-gram.y" /* yacc.c:1646 */
1533 {
1534 grecs_list_append((grecs_meta1_vsp[-2].list), (grecs_meta1_vsp[0].pvalue));
1535 (grecs_meta1_val.list) = (grecs_meta1_vsp[-2].list);
1536 }
1537 #line 1538 "meta1-gram.c" /* yacc.c:1646 */
1538 break;
1539
1540
1541 #line 1542 "meta1-gram.c" /* yacc.c:1646 */
1542 default: break;
1543 }
1544 /* User semantic actions sometimes alter grecs_meta1_char, and that requires
1545 that grecs_meta1_token be updated with the new translation. We take the
1546 approach of translating immediately before every use of grecs_meta1_token.
1547 One alternative is translating here after every semantic action,
1548 but that translation would be missed if the semantic action invokes
1549 YYABORT, YYACCEPT, or YYERROR immediately after altering grecs_meta1_char or
1550 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1551 incorrect destructor might then be invoked immediately. In the
1552 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1553 to an incorrect destructor call or verbose syntax error message
1554 before the lookahead is translated. */
1555 YY_SYMBOL_PRINT ("-> $$ =", grecs_meta1_r1[grecs_meta1_n], &grecs_meta1_val, &grecs_meta1_loc);
1556
1557 YYPOPSTACK (grecs_meta1_len);
1558 grecs_meta1_len = 0;
1559 YY_STACK_PRINT (grecs_meta1_ss, grecs_meta1_ssp);
1560
1561 *++grecs_meta1_vsp = grecs_meta1_val;
1562 *++grecs_meta1_lsp = grecs_meta1_loc;
1563
1564 /* Now 'shift' the result of the reduction. Determine what state
1565 that goes to, based on the state we popped back to and the rule
1566 number reduced by. */
1567
1568 grecs_meta1_n = grecs_meta1_r1[grecs_meta1_n];
1569
1570 grecs_meta1_state = grecs_meta1_pgoto[grecs_meta1_n - YYNTOKENS] + *grecs_meta1_ssp;
1571 if (0 <= grecs_meta1_state && grecs_meta1_state <= YYLAST && grecs_meta1_check[grecs_meta1_state] == *grecs_meta1_ssp)
1572 grecs_meta1_state = grecs_meta1_table[grecs_meta1_state];
1573 else
1574 grecs_meta1_state = grecs_meta1_defgoto[grecs_meta1_n - YYNTOKENS];
1575
1576 goto grecs_meta1_newstate;
1577
1578
1579 /*--------------------------------------.
1580 | grecs_meta1_errlab -- here on detecting error. |
1581 `--------------------------------------*/
1582 grecs_meta1_errlab:
1583 /* Make sure we have latest lookahead translation. See comments at
1584 user semantic actions for why this is necessary. */
1585 grecs_meta1_token = grecs_meta1_char == YYEMPTY ? YYEMPTY : YYTRANSLATE (grecs_meta1_char);
1586
1587 /* If not already recovering from an error, report this error. */
1588 if (!grecs_meta1_errstatus)
1589 {
1590 ++grecs_meta1_nerrs;
1591 #if ! YYERROR_VERBOSE
1592 grecs_meta1_error (YY_("syntax error"));
1593 #else
1594 # define YYSYNTAX_ERROR grecs_meta1_syntax_error (&grecs_meta1_msg_alloc, &grecs_meta1_msg, \
1595 grecs_meta1_ssp, grecs_meta1_token)
1596 {
1597 char const *grecs_meta1_msgp = YY_("syntax error");
1598 int grecs_meta1_syntax_error_status;
1599 grecs_meta1_syntax_error_status = YYSYNTAX_ERROR;
1600 if (grecs_meta1_syntax_error_status == 0)
1601 grecs_meta1_msgp = grecs_meta1_msg;
1602 else if (grecs_meta1_syntax_error_status == 1)
1603 {
1604 if (grecs_meta1_msg != grecs_meta1_msgbuf)
1605 YYSTACK_FREE (grecs_meta1_msg);
1606 grecs_meta1_msg = (char *) YYSTACK_ALLOC (grecs_meta1_msg_alloc);
1607 if (!grecs_meta1_msg)
1608 {
1609 grecs_meta1_msg = grecs_meta1_msgbuf;
1610 grecs_meta1_msg_alloc = sizeof grecs_meta1_msgbuf;
1611 grecs_meta1_syntax_error_status = 2;
1612 }
1613 else
1614 {
1615 grecs_meta1_syntax_error_status = YYSYNTAX_ERROR;
1616 grecs_meta1_msgp = grecs_meta1_msg;
1617 }
1618 }
1619 grecs_meta1_error (grecs_meta1_msgp);
1620 if (grecs_meta1_syntax_error_status == 2)
1621 goto grecs_meta1_exhaustedlab;
1622 }
1623 # undef YYSYNTAX_ERROR
1624 #endif
1625 }
1626
1627 grecs_meta1_error_range[1] = grecs_meta1_lloc;
1628
1629 if (grecs_meta1_errstatus == 3)
1630 {
1631 /* If just tried and failed to reuse lookahead token after an
1632 error, discard it. */
1633
1634 if (grecs_meta1_char <= YYEOF)
1635 {
1636 /* Return failure if at end of input. */
1637 if (grecs_meta1_char == YYEOF)
1638 YYABORT;
1639 }
1640 else
1641 {
1642 grecs_meta1_destruct ("Error: discarding",
1643 grecs_meta1_token, &grecs_meta1_lval, &grecs_meta1_lloc);
1644 grecs_meta1_char = YYEMPTY;
1645 }
1646 }
1647
1648 /* Else will try to reuse lookahead token after shifting the error
1649 token. */
1650 goto grecs_meta1_errlab1;
1651
1652
1653 /*---------------------------------------------------.
1654 | grecs_meta1_errorlab -- error raised explicitly by YYERROR. |
1655 `---------------------------------------------------*/
1656 grecs_meta1_errorlab:
1657
1658 /* Pacify compilers like GCC when the user code never invokes
1659 YYERROR and the label grecs_meta1_errorlab therefore never appears in user
1660 code. */
1661 if (/*CONSTCOND*/ 0)
1662 goto grecs_meta1_errorlab;
1663
1664 grecs_meta1_error_range[1] = grecs_meta1_lsp[1-grecs_meta1_len];
1665 /* Do not reclaim the symbols of the rule whose action triggered
1666 this YYERROR. */
1667 YYPOPSTACK (grecs_meta1_len);
1668 grecs_meta1_len = 0;
1669 YY_STACK_PRINT (grecs_meta1_ss, grecs_meta1_ssp);
1670 grecs_meta1_state = *grecs_meta1_ssp;
1671 goto grecs_meta1_errlab1;
1672
1673
1674 /*-------------------------------------------------------------.
1675 | grecs_meta1_errlab1 -- common code for both syntax error and YYERROR. |
1676 `-------------------------------------------------------------*/
1677 grecs_meta1_errlab1:
1678 grecs_meta1_errstatus = 3; /* Each real token shifted decrements this. */
1679
1680 for (;;)
1681 {
1682 grecs_meta1_n = grecs_meta1_pact[grecs_meta1_state];
1683 if (!grecs_meta1_pact_value_is_default (grecs_meta1_n))
1684 {
1685 grecs_meta1_n += YYTERROR;
1686 if (0 <= grecs_meta1_n && grecs_meta1_n <= YYLAST && grecs_meta1_check[grecs_meta1_n] == YYTERROR)
1687 {
1688 grecs_meta1_n = grecs_meta1_table[grecs_meta1_n];
1689 if (0 < grecs_meta1_n)
1690 break;
1691 }
1692 }
1693
1694 /* Pop the current state because it cannot handle the error token. */
1695 if (grecs_meta1_ssp == grecs_meta1_ss)
1696 YYABORT;
1697
1698 grecs_meta1_error_range[1] = *grecs_meta1_lsp;
1699 grecs_meta1_destruct ("Error: popping",
1700 grecs_meta1_stos[grecs_meta1_state], grecs_meta1_vsp, grecs_meta1_lsp);
1701 YYPOPSTACK (1);
1702 grecs_meta1_state = *grecs_meta1_ssp;
1703 YY_STACK_PRINT (grecs_meta1_ss, grecs_meta1_ssp);
1704 }
1705
1706 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1707 *++grecs_meta1_vsp = grecs_meta1_lval;
1708 YY_IGNORE_MAYBE_UNINITIALIZED_END
1709
1710 grecs_meta1_error_range[2] = grecs_meta1_lloc;
1711 /* Using YYLLOC is tempting, but would change the location of
1712 the lookahead. YYLOC is available though. */
1713 YYLLOC_DEFAULT (grecs_meta1_loc, grecs_meta1_error_range, 2);
1714 *++grecs_meta1_lsp = grecs_meta1_loc;
1715
1716 /* Shift the error token. */
1717 YY_SYMBOL_PRINT ("Shifting", grecs_meta1_stos[grecs_meta1_n], grecs_meta1_vsp, grecs_meta1_lsp);
1718
1719 grecs_meta1_state = grecs_meta1_n;
1720 goto grecs_meta1_newstate;
1721
1722
1723 /*-------------------------------------.
1724 | grecs_meta1_acceptlab -- YYACCEPT comes here. |
1725 `-------------------------------------*/
1726 grecs_meta1_acceptlab:
1727 grecs_meta1_result = 0;
1728 goto grecs_meta1_return;
1729
1730 /*-----------------------------------.
1731 | grecs_meta1_abortlab -- YYABORT comes here. |
1732 `-----------------------------------*/
1733 grecs_meta1_abortlab:
1734 grecs_meta1_result = 1;
1735 goto grecs_meta1_return;
1736
1737 #if !defined grecs_meta1_overflow || YYERROR_VERBOSE
1738 /*-------------------------------------------------.
1739 | grecs_meta1_exhaustedlab -- memory exhaustion comes here. |
1740 `-------------------------------------------------*/
1741 grecs_meta1_exhaustedlab:
1742 grecs_meta1_error (YY_("memory exhausted"));
1743 grecs_meta1_result = 2;
1744 /* Fall through. */
1745 #endif
1746
1747 grecs_meta1_return:
1748 if (grecs_meta1_char != YYEMPTY)
1749 {
1750 /* Make sure we have latest lookahead translation. See comments at
1751 user semantic actions for why this is necessary. */
1752 grecs_meta1_token = YYTRANSLATE (grecs_meta1_char);
1753 grecs_meta1_destruct ("Cleanup: discarding lookahead",
1754 grecs_meta1_token, &grecs_meta1_lval, &grecs_meta1_lloc);
1755 }
1756 /* Do not reclaim the symbols of the rule whose action triggered
1757 this YYABORT or YYACCEPT. */
1758 YYPOPSTACK (grecs_meta1_len);
1759 YY_STACK_PRINT (grecs_meta1_ss, grecs_meta1_ssp);
1760 while (grecs_meta1_ssp != grecs_meta1_ss)
1761 {
1762 grecs_meta1_destruct ("Cleanup: popping",
1763 grecs_meta1_stos[*grecs_meta1_ssp], grecs_meta1_vsp, grecs_meta1_lsp);
1764 YYPOPSTACK (1);
1765 }
1766 #ifndef grecs_meta1_overflow
1767 if (grecs_meta1_ss != grecs_meta1_ssa)
1768 YYSTACK_FREE (grecs_meta1_ss);
1769 #endif
1770 #if YYERROR_VERBOSE
1771 if (grecs_meta1_msg != grecs_meta1_msgbuf)
1772 YYSTACK_FREE (grecs_meta1_msg);
1773 #endif
1774 return grecs_meta1_result;
1775 }
1776 #line 191 "meta1-gram.y" /* yacc.c:1906 */
1777
1778 int
grecs_meta1_error(char const * s)1779 grecs_meta1_error(char const *s)
1780 {
1781 grecs_error(&grecs_meta1_lloc, 0, "%s", s);
1782 return 0;
1783 }
1784
1785 struct grecs_node *
grecs_meta1_parser(const char * name,int traceflags)1786 grecs_meta1_parser(const char *name, int traceflags)
1787 {
1788 int rc;
1789 FILE *fp;
1790
1791 fp = fopen(name, "r");
1792 if (!fp) {
1793 grecs_error(NULL, errno, _("Cannot open `%s'"), name);
1794 return NULL;
1795 }
1796 grecs_meta1_set_in(fp);
1797 grecs_meta1__flex_debug = traceflags & GRECS_TRACE_LEX;
1798 grecs_meta1_debug = traceflags & GRECS_TRACE_GRAM;
1799 parse_tree = NULL;
1800 grecs_line_acc_create();
1801 rc = grecs_meta1_parse();
1802 fclose(fp);
1803 if (grecs_error_count)
1804 rc = 1;
1805 grecs_line_acc_free();
1806 if (rc) {
1807 grecs_tree_free(parse_tree);
1808 parse_tree = NULL;
1809 }
1810 return parse_tree;
1811 }
1812
1813