1 /* A Bison parser, made by GNU Bison 2.7. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2012 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_grecs_ 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 "2.7"
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 371 of yacc.c */
66 #line 1 "grecs-gram.y"
67
68 /* grecs - Gray's Extensible Configuration System
69 Copyright (C) 2007-2016 Sergey Poznyakoff
70
71 Grecs is free software; you can redistribute it and/or modify it
72 under the terms of the GNU General Public License as published by the
73 Free Software Foundation; either version 3 of the License, or (at your
74 option) any later version.
75
76 Grecs is distributed in the hope that it will be useful,
77 but WITHOUT ANY WARRANTY; without even the implied warranty of
78 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
79 GNU General Public License for more details.
80
81 You should have received a copy of the GNU General Public License along
82 with Grecs. If not, see <http://www.gnu.org/licenses/>. */
83
84 #ifdef HAVE_CONFIG_H
85 # include <config.h>
86 #endif
87 #include <grecs.h>
88 #include <grecs-gram.h>
89 #include <stdlib.h>
90 #include <stdarg.h>
91 #include <string.h>
92 #include <errno.h>
93
94 int grecs_grecs_lex(void);
95 int grecs_grecs_error(char const *s);
96
97 static struct grecs_node *parse_tree;
98
99 /* Line 371 of yacc.c */
100 #line 101 "grecs-gram.c"
101
102 # ifndef YY_NULL
103 # if defined __cplusplus && 201103L <= __cplusplus
104 # define YY_NULL nullptr
105 # else
106 # define YY_NULL 0
107 # endif
108 # endif
109
110 /* Enabling verbose error messages. */
111 #ifdef YYERROR_VERBOSE
112 # undef YYERROR_VERBOSE
113 # define YYERROR_VERBOSE 1
114 #else
115 # define YYERROR_VERBOSE 1
116 #endif
117
118 /* In a future release of Bison, this section will be replaced
119 by #include "y.tab.h". */
120 #ifndef YY_YY_GRECS_GRAM_H_INCLUDED
121 # define YY_YY_GRECS_GRAM_H_INCLUDED
122 /* Enabling traces. */
123 #ifndef YYDEBUG
124 # define YYDEBUG 1
125 #endif
126 #if YYDEBUG
127 extern int grecs_grecs_debug;
128 #endif
129
130 /* Tokens. */
131 #ifndef YYTOKENTYPE
132 # define YYTOKENTYPE
133 /* Put the tokens into the symbol table, so that GDB and other debuggers
134 know about them. */
135 enum grecs_grecs_tokentype {
136 STRING = 258,
137 QSTRING = 259,
138 MSTRING = 260,
139 IDENT = 261
140 };
141 #endif
142 /* Tokens. */
143 #define STRING 258
144 #define QSTRING 259
145 #define MSTRING 260
146 #define IDENT 261
147
148
149
150 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
151 typedef union YYSTYPE
152 {
153 /* Line 387 of yacc.c */
154 #line 37 "grecs-gram.y"
155
156 char *string;
157 grecs_value_t svalue, *pvalue;
158 struct grecs_list *list;
159 struct grecs_node *node;
160 grecs_locus_t locus;
161 struct { struct grecs_node *head, *tail; } node_list;
162
163
164 /* Line 387 of yacc.c */
165 #line 166 "grecs-gram.c"
166 } YYSTYPE;
167 # define YYSTYPE_IS_TRIVIAL 1
168 # define grecs_grecs_stype YYSTYPE /* obsolescent; will be withdrawn */
169 # define YYSTYPE_IS_DECLARED 1
170 #endif
171
172 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
173 typedef struct YYLTYPE
174 {
175 int first_line;
176 int first_column;
177 int last_line;
178 int last_column;
179 } YYLTYPE;
180 # define grecs_grecs_ltype YYLTYPE /* obsolescent; will be withdrawn */
181 # define YYLTYPE_IS_DECLARED 1
182 # define YYLTYPE_IS_TRIVIAL 1
183 #endif
184
185 extern YYSTYPE grecs_grecs_lval;
186 extern YYLTYPE grecs_grecs_lloc;
187 #ifdef YYPARSE_PARAM
188 #if defined __STDC__ || defined __cplusplus
189 int grecs_grecs_parse (void *YYPARSE_PARAM);
190 #else
191 int grecs_grecs_parse ();
192 #endif
193 #else /* ! YYPARSE_PARAM */
194 #if defined __STDC__ || defined __cplusplus
195 int grecs_grecs_parse (void);
196 #else
197 int grecs_grecs_parse ();
198 #endif
199 #endif /* ! YYPARSE_PARAM */
200
201 #endif /* !YY_YY_GRECS_GRAM_H_INCLUDED */
202
203 /* Copy the second part of user declarations. */
204
205 /* Line 390 of yacc.c */
206 #line 207 "grecs-gram.c"
207
208 #ifdef short
209 # undef short
210 #endif
211
212 #ifdef YYTYPE_UINT8
213 typedef YYTYPE_UINT8 grecs_grecs_type_uint8;
214 #else
215 typedef unsigned char grecs_grecs_type_uint8;
216 #endif
217
218 #ifdef YYTYPE_INT8
219 typedef YYTYPE_INT8 grecs_grecs_type_int8;
220 #elif (defined __STDC__ || defined __C99__FUNC__ \
221 || defined __cplusplus || defined _MSC_VER)
222 typedef signed char grecs_grecs_type_int8;
223 #else
224 typedef short int grecs_grecs_type_int8;
225 #endif
226
227 #ifdef YYTYPE_UINT16
228 typedef YYTYPE_UINT16 grecs_grecs_type_uint16;
229 #else
230 typedef unsigned short int grecs_grecs_type_uint16;
231 #endif
232
233 #ifdef YYTYPE_INT16
234 typedef YYTYPE_INT16 grecs_grecs_type_int16;
235 #else
236 typedef short int grecs_grecs_type_int16;
237 #endif
238
239 #ifndef YYSIZE_T
240 # ifdef __SIZE_TYPE__
241 # define YYSIZE_T __SIZE_TYPE__
242 # elif defined size_t
243 # define YYSIZE_T size_t
244 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
245 || defined __cplusplus || defined _MSC_VER)
246 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
247 # define YYSIZE_T size_t
248 # else
249 # define YYSIZE_T unsigned int
250 # endif
251 #endif
252
253 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
254
255 #ifndef YY_
256 # if defined YYENABLE_NLS && YYENABLE_NLS
257 # if ENABLE_NLS
258 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
259 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
260 # endif
261 # endif
262 # ifndef YY_
263 # define YY_(Msgid) Msgid
264 # endif
265 #endif
266
267 /* Suppress unused-variable warnings by "using" E. */
268 #if ! defined lint || defined __GNUC__
269 # define YYUSE(E) ((void) (E))
270 #else
271 # define YYUSE(E) /* empty */
272 #endif
273
274 /* Identity function, used to suppress warnings about constant conditions. */
275 #ifndef lint
276 # define YYID(N) (N)
277 #else
278 #if (defined __STDC__ || defined __C99__FUNC__ \
279 || defined __cplusplus || defined _MSC_VER)
280 static int
YYID(int grecs_grecs_i)281 YYID (int grecs_grecs_i)
282 #else
283 static int
284 YYID (grecs_grecs_i)
285 int grecs_grecs_i;
286 #endif
287 {
288 return grecs_grecs_i;
289 }
290 #endif
291
292 #if ! defined grecs_grecs_overflow || YYERROR_VERBOSE
293
294 /* The parser invokes alloca or malloc; define the necessary symbols. */
295
296 # ifdef YYSTACK_USE_ALLOCA
297 # if YYSTACK_USE_ALLOCA
298 # ifdef __GNUC__
299 # define YYSTACK_ALLOC __builtin_alloca
300 # elif defined __BUILTIN_VA_ARG_INCR
301 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
302 # elif defined _AIX
303 # define YYSTACK_ALLOC __alloca
304 # elif defined _MSC_VER
305 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
306 # define alloca _alloca
307 # else
308 # define YYSTACK_ALLOC alloca
309 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
310 || defined __cplusplus || defined _MSC_VER)
311 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
312 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
313 # ifndef EXIT_SUCCESS
314 # define EXIT_SUCCESS 0
315 # endif
316 # endif
317 # endif
318 # endif
319 # endif
320
321 # ifdef YYSTACK_ALLOC
322 /* Pacify GCC's `empty if-body' warning. */
323 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
324 # ifndef YYSTACK_ALLOC_MAXIMUM
325 /* The OS might guarantee only one guard page at the bottom of the stack,
326 and a page size can be as small as 4096 bytes. So we cannot safely
327 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
328 to allow for a few compiler-allocated temporary stack slots. */
329 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
330 # endif
331 # else
332 # define YYSTACK_ALLOC YYMALLOC
333 # define YYSTACK_FREE YYFREE
334 # ifndef YYSTACK_ALLOC_MAXIMUM
335 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
336 # endif
337 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
338 && ! ((defined YYMALLOC || defined malloc) \
339 && (defined YYFREE || defined free)))
340 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
341 # ifndef EXIT_SUCCESS
342 # define EXIT_SUCCESS 0
343 # endif
344 # endif
345 # ifndef YYMALLOC
346 # define YYMALLOC malloc
347 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
348 || defined __cplusplus || defined _MSC_VER)
349 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
350 # endif
351 # endif
352 # ifndef YYFREE
353 # define YYFREE free
354 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
355 || defined __cplusplus || defined _MSC_VER)
356 void free (void *); /* INFRINGES ON USER NAME SPACE */
357 # endif
358 # endif
359 # endif
360 #endif /* ! defined grecs_grecs_overflow || YYERROR_VERBOSE */
361
362
363 #if (! defined grecs_grecs_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_grecs_alloc
370 {
371 grecs_grecs_type_int16 grecs_grecs_ss_alloc;
372 YYSTYPE grecs_grecs_vs_alloc;
373 YYLTYPE grecs_grecs_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_grecs_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_grecs_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_grecs_newbytes; \
396 YYCOPY (&grecs_grecs_ptr->Stack_alloc, Stack, grecs_grecs_size); \
397 Stack = &grecs_grecs_ptr->Stack_alloc; \
398 grecs_grecs_newbytes = grecs_grecs_stacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
399 grecs_grecs_ptr += grecs_grecs_newbytes / sizeof (*grecs_grecs_ptr); \
400 } \
401 while (YYID (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_grecs_i; \
417 for (grecs_grecs_i = 0; grecs_grecs_i < (Count); grecs_grecs_i++) \
418 (Dst)[grecs_grecs_i] = (Src)[grecs_grecs_i]; \
419 } \
420 while (YYID (0))
421 # endif
422 # endif
423 #endif /* !YYCOPY_NEEDED */
424
425 /* YYFINAL -- State number of the termination state. */
426 #define YYFINAL 22
427 /* YYLAST -- Last index in YYTABLE. */
428 #define YYLAST 39
429
430 /* YYNTOKENS -- Number of terminals. */
431 #define YYNTOKENS 13
432 /* YYNNTS -- Number of nonterminals. */
433 #define YYNNTS 17
434 /* YYNRULES -- Number of rules. */
435 #define YYNRULES 32
436 /* YYNRULES -- Number of states. */
437 #define YYNSTATES 39
438
439 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
440 #define YYUNDEFTOK 2
441 #define YYMAXUTOK 261
442
443 #define YYTRANSLATE(YYX) \
444 ((unsigned int) (YYX) <= YYMAXUTOK ? grecs_grecs_translate[YYX] : YYUNDEFTOK)
445
446 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
447 static const grecs_grecs_type_uint8 grecs_grecs_translate[] =
448 {
449 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 10, 11, 2, 2, 12, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 7,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 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, 8, 2, 9, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 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, 1, 2, 3, 4,
475 5, 6
476 };
477
478 #if YYDEBUG
479 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
480 YYRHS. */
481 static const grecs_grecs_type_uint8 grecs_grecs_prhs[] =
482 {
483 0, 0, 3, 5, 6, 8, 10, 13, 15, 17,
484 21, 24, 31, 32, 34, 36, 38, 41, 43, 45,
485 47, 49, 51, 53, 55, 57, 60, 63, 67, 72,
486 74, 78, 79
487 };
488
489 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
490 static const grecs_grecs_type_int8 grecs_grecs_rhs[] =
491 {
492 14, 0, -1, 15, -1, -1, 16, -1, 17, -1,
493 16, 17, -1, 18, -1, 19, -1, 6, 21, 7,
494 -1, 6, 7, -1, 6, 20, 8, 16, 9, 29,
495 -1, -1, 21, -1, 22, -1, 23, -1, 22, 23,
496 -1, 24, -1, 27, -1, 5, -1, 3, -1, 6,
497 -1, 25, -1, 26, -1, 4, -1, 26, 4, -1,
498 10, 11, -1, 10, 28, 11, -1, 10, 28, 12,
499 11, -1, 23, -1, 28, 12, 23, -1, -1, 7,
500 -1
501 };
502
503 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
504 static const grecs_grecs_type_uint8 grecs_grecs_rline[] =
505 {
506 0, 57, 57, 67, 70, 76, 80, 86, 87, 90,
507 98, 107, 119, 122, 125, 149, 154, 160, 166, 172,
508 180, 181, 182, 185, 200, 205, 212, 216, 220, 226,
509 231, 238, 239
510 };
511 #endif
512
513 #if YYDEBUG || YYERROR_VERBOSE || 1
514 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
515 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
516 static const char *const grecs_grecs_tname[] =
517 {
518 "$end", "error", "$undefined", "STRING", "QSTRING", "MSTRING", "IDENT",
519 "';'", "'{'", "'}'", "'('", "')'", "','", "$accept", "input",
520 "maybe_stmtlist", "stmtlist", "stmt", "simple", "block", "tag",
521 "vallist", "vlist", "value", "string", "slist", "slist0", "list",
522 "values", "opt_sc", YY_NULL
523 };
524 #endif
525
526 # ifdef YYPRINT
527 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
528 token YYLEX-NUM. */
529 static const grecs_grecs_type_uint16 grecs_grecs_toknum[] =
530 {
531 0, 256, 257, 258, 259, 260, 261, 59, 123, 125,
532 40, 41, 44
533 };
534 # endif
535
536 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
537 static const grecs_grecs_type_uint8 grecs_grecs_r1[] =
538 {
539 0, 13, 14, 15, 15, 16, 16, 17, 17, 18,
540 18, 19, 20, 20, 21, 22, 22, 23, 23, 23,
541 24, 24, 24, 25, 26, 26, 27, 27, 27, 28,
542 28, 29, 29
543 };
544
545 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
546 static const grecs_grecs_type_uint8 grecs_grecs_r2[] =
547 {
548 0, 2, 1, 0, 1, 1, 2, 1, 1, 3,
549 2, 6, 0, 1, 1, 1, 2, 1, 1, 1,
550 1, 1, 1, 1, 1, 2, 2, 3, 4, 1,
551 3, 0, 1
552 };
553
554 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
555 Performed when YYTABLE doesn't specify something else to do. Zero
556 means the default is an error. */
557 static const grecs_grecs_type_uint8 grecs_grecs_defact[] =
558 {
559 3, 12, 0, 2, 4, 5, 7, 8, 20, 24,
560 19, 21, 10, 0, 0, 13, 14, 15, 17, 22,
561 23, 18, 1, 6, 26, 29, 0, 0, 9, 16,
562 25, 27, 0, 0, 28, 30, 31, 32, 11
563 };
564
565 /* YYDEFGOTO[NTERM-NUM]. */
566 static const grecs_grecs_type_int8 grecs_grecs_defgoto[] =
567 {
568 -1, 2, 3, 4, 5, 6, 7, 14, 15, 16,
569 17, 18, 19, 20, 21, 26, 38
570 };
571
572 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
573 STATE-NUM. */
574 #define YYPACT_NINF -13
575 static const grecs_grecs_type_int8 grecs_grecs_pact[] =
576 {
577 3, 20, 10, -13, 3, -13, -13, -13, -13, -13,
578 -13, -13, -13, 2, 27, 4, 28, -13, -13, -13,
579 14, -13, -13, -13, -13, -13, -9, 3, -13, -13,
580 -13, -13, 11, 30, -13, -13, 12, -13, -13
581 };
582
583 /* YYPGOTO[NTERM-NUM]. */
584 static const grecs_grecs_type_int8 grecs_grecs_pgoto[] =
585 {
586 -13, -13, -13, 1, -4, -13, -13, -13, -13, -13,
587 -12, -13, -13, -13, -13, -13, -13
588 };
589
590 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
591 positive, shift that token. If negative, reduce the rule which
592 number is the opposite. If YYTABLE_NINF, syntax error. */
593 #define YYTABLE_NINF -1
594 static const grecs_grecs_type_uint8 grecs_grecs_table[] =
595 {
596 23, 25, 31, 32, 29, 8, 9, 10, 11, 1,
597 22, 28, 13, 24, 8, 9, 10, 11, 30, 37,
598 35, 13, 34, 8, 9, 10, 11, 12, 33, 23,
599 13, 8, 9, 10, 11, 27, 1, 0, 13, 36
600 };
601
602 #define grecs_grecs_pact_value_is_default(Yystate) \
603 (!!((Yystate) == (-13)))
604
605 #define grecs_grecs_table_value_is_error(Yytable_value) \
606 YYID (0)
607
608 static const grecs_grecs_type_int8 grecs_grecs_check[] =
609 {
610 4, 13, 11, 12, 16, 3, 4, 5, 6, 6,
611 0, 7, 10, 11, 3, 4, 5, 6, 4, 7,
612 32, 10, 11, 3, 4, 5, 6, 7, 27, 33,
613 10, 3, 4, 5, 6, 8, 6, -1, 10, 9
614 };
615
616 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
617 symbol of state STATE-NUM. */
618 static const grecs_grecs_type_uint8 grecs_grecs_stos[] =
619 {
620 0, 6, 14, 15, 16, 17, 18, 19, 3, 4,
621 5, 6, 7, 10, 20, 21, 22, 23, 24, 25,
622 26, 27, 0, 17, 11, 23, 28, 8, 7, 23,
623 4, 11, 12, 16, 11, 23, 9, 7, 29
624 };
625
626 #define grecs_grecs_errok (grecs_grecs_errstatus = 0)
627 #define grecs_grecs_clearin (grecs_grecs_char = YYEMPTY)
628 #define YYEMPTY (-2)
629 #define YYEOF 0
630
631 #define YYACCEPT goto grecs_grecs_acceptlab
632 #define YYABORT goto grecs_grecs_abortlab
633 #define YYERROR goto grecs_grecs_errorlab
634
635
636 /* Like YYERROR except do call grecs_grecs_error. This remains here temporarily
637 to ease the transition to the new meaning of YYERROR, for GCC.
638 Once GCC version 2 has supplanted version 1, this can go. However,
639 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
640 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
641 discussed. */
642
643 #define YYFAIL goto grecs_grecs_errlab
644 #if defined YYFAIL
645 /* This is here to suppress warnings from the GCC cpp's
646 -Wunused-macros. Normally we don't worry about that warning, but
647 some users do, and we want to make it easy for users to remove
648 YYFAIL uses, which will produce warnings from Bison 2.5. */
649 #endif
650
651 #define YYRECOVERING() (!!grecs_grecs_errstatus)
652
653 #define YYBACKUP(Token, Value) \
654 do \
655 if (grecs_grecs_char == YYEMPTY) \
656 { \
657 grecs_grecs_char = (Token); \
658 grecs_grecs_lval = (Value); \
659 YYPOPSTACK (grecs_grecs_len); \
660 grecs_grecs_state = *grecs_grecs_ssp; \
661 goto grecs_grecs_backup; \
662 } \
663 else \
664 { \
665 grecs_grecs_error (YY_("syntax error: cannot back up")); \
666 YYERROR; \
667 } \
668 while (YYID (0))
669
670 /* Error token number */
671 #define YYTERROR 1
672 #define YYERRCODE 256
673
674
675 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
676 If N is 0, then set CURRENT to the empty location which ends
677 the previous symbol: RHS[0] (always defined). */
678
679 #ifndef YYLLOC_DEFAULT
680 # define YYLLOC_DEFAULT(Current, Rhs, N) \
681 do \
682 if (YYID (N)) \
683 { \
684 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
685 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
686 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
687 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
688 } \
689 else \
690 { \
691 (Current).first_line = (Current).last_line = \
692 YYRHSLOC (Rhs, 0).last_line; \
693 (Current).first_column = (Current).last_column = \
694 YYRHSLOC (Rhs, 0).last_column; \
695 } \
696 while (YYID (0))
697 #endif
698
699 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
700
701
702 /* YY_LOCATION_PRINT -- Print the location on the stream.
703 This macro was not mandated originally: define only if we know
704 we won't break user code: when these are the locations we know. */
705
706 #ifndef YY_LOCATION_PRINT
707 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
708
709 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
710
711 __attribute__((__unused__))
712 #if (defined __STDC__ || defined __C99__FUNC__ \
713 || defined __cplusplus || defined _MSC_VER)
714 static unsigned
grecs_grecs__location_print_(FILE * grecs_grecs_o,YYLTYPE const * const grecs_grecs_locp)715 grecs_grecs__location_print_ (FILE *grecs_grecs_o, YYLTYPE const * const grecs_grecs_locp)
716 #else
717 static unsigned
718 grecs_grecs__location_print_ (grecs_grecs_o, grecs_grecs_locp)
719 FILE *grecs_grecs_o;
720 YYLTYPE const * const grecs_grecs_locp;
721 #endif
722 {
723 unsigned res = 0;
724 int end_col = 0 != grecs_grecs_locp->last_column ? grecs_grecs_locp->last_column - 1 : 0;
725 if (0 <= grecs_grecs_locp->first_line)
726 {
727 res += fprintf (grecs_grecs_o, "%d", grecs_grecs_locp->first_line);
728 if (0 <= grecs_grecs_locp->first_column)
729 res += fprintf (grecs_grecs_o, ".%d", grecs_grecs_locp->first_column);
730 }
731 if (0 <= grecs_grecs_locp->last_line)
732 {
733 if (grecs_grecs_locp->first_line < grecs_grecs_locp->last_line)
734 {
735 res += fprintf (grecs_grecs_o, "-%d", grecs_grecs_locp->last_line);
736 if (0 <= end_col)
737 res += fprintf (grecs_grecs_o, ".%d", end_col);
738 }
739 else if (0 <= end_col && grecs_grecs_locp->first_column < end_col)
740 res += fprintf (grecs_grecs_o, "-%d", end_col);
741 }
742 return res;
743 }
744
745 # define YY_LOCATION_PRINT(File, Loc) \
746 grecs_grecs__location_print_ (File, &(Loc))
747
748 # else
749 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
750 # endif
751 #endif
752
753
754 /* YYLEX -- calling `grecs_grecs_lex' with the right arguments. */
755 #ifdef YYLEX_PARAM
756 # define YYLEX grecs_grecs_lex (YYLEX_PARAM)
757 #else
758 # define YYLEX grecs_grecs_lex ()
759 #endif
760
761 /* Enable debugging if requested. */
762 #if YYDEBUG
763
764 # ifndef YYFPRINTF
765 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
766 # define YYFPRINTF fprintf
767 # endif
768
769 # define YYDPRINTF(Args) \
770 do { \
771 if (grecs_grecs_debug) \
772 YYFPRINTF Args; \
773 } while (YYID (0))
774
775 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
776 do { \
777 if (grecs_grecs_debug) \
778 { \
779 YYFPRINTF (stderr, "%s ", Title); \
780 grecs_grecs__symbol_print (stderr, \
781 Type, Value, Location); \
782 YYFPRINTF (stderr, "\n"); \
783 } \
784 } while (YYID (0))
785
786
787 /*--------------------------------.
788 | Print this symbol on YYOUTPUT. |
789 `--------------------------------*/
790
791 /*ARGSUSED*/
792 #if (defined __STDC__ || defined __C99__FUNC__ \
793 || defined __cplusplus || defined _MSC_VER)
794 static void
grecs_grecs__symbol_value_print(FILE * grecs_grecs_output,int grecs_grecs_type,YYSTYPE const * const grecs_grecs_valuep,YYLTYPE const * const grecs_grecs_locationp)795 grecs_grecs__symbol_value_print (FILE *grecs_grecs_output, int grecs_grecs_type, YYSTYPE const * const grecs_grecs_valuep, YYLTYPE const * const grecs_grecs_locationp)
796 #else
797 static void
798 grecs_grecs__symbol_value_print (grecs_grecs_output, grecs_grecs_type, grecs_grecs_valuep, grecs_grecs_locationp)
799 FILE *grecs_grecs_output;
800 int grecs_grecs_type;
801 YYSTYPE const * const grecs_grecs_valuep;
802 YYLTYPE const * const grecs_grecs_locationp;
803 #endif
804 {
805 FILE *grecs_grecs_o = grecs_grecs_output;
806 YYUSE (grecs_grecs_o);
807 if (!grecs_grecs_valuep)
808 return;
809 YYUSE (grecs_grecs_locationp);
810 # ifdef YYPRINT
811 if (grecs_grecs_type < YYNTOKENS)
812 YYPRINT (grecs_grecs_output, grecs_grecs_toknum[grecs_grecs_type], *grecs_grecs_valuep);
813 # else
814 YYUSE (grecs_grecs_output);
815 # endif
816 switch (grecs_grecs_type)
817 {
818 default:
819 break;
820 }
821 }
822
823
824 /*--------------------------------.
825 | Print this symbol on YYOUTPUT. |
826 `--------------------------------*/
827
828 #if (defined __STDC__ || defined __C99__FUNC__ \
829 || defined __cplusplus || defined _MSC_VER)
830 static void
grecs_grecs__symbol_print(FILE * grecs_grecs_output,int grecs_grecs_type,YYSTYPE const * const grecs_grecs_valuep,YYLTYPE const * const grecs_grecs_locationp)831 grecs_grecs__symbol_print (FILE *grecs_grecs_output, int grecs_grecs_type, YYSTYPE const * const grecs_grecs_valuep, YYLTYPE const * const grecs_grecs_locationp)
832 #else
833 static void
834 grecs_grecs__symbol_print (grecs_grecs_output, grecs_grecs_type, grecs_grecs_valuep, grecs_grecs_locationp)
835 FILE *grecs_grecs_output;
836 int grecs_grecs_type;
837 YYSTYPE const * const grecs_grecs_valuep;
838 YYLTYPE const * const grecs_grecs_locationp;
839 #endif
840 {
841 if (grecs_grecs_type < YYNTOKENS)
842 YYFPRINTF (grecs_grecs_output, "token %s (", grecs_grecs_tname[grecs_grecs_type]);
843 else
844 YYFPRINTF (grecs_grecs_output, "nterm %s (", grecs_grecs_tname[grecs_grecs_type]);
845
846 YY_LOCATION_PRINT (grecs_grecs_output, *grecs_grecs_locationp);
847 YYFPRINTF (grecs_grecs_output, ": ");
848 grecs_grecs__symbol_value_print (grecs_grecs_output, grecs_grecs_type, grecs_grecs_valuep, grecs_grecs_locationp);
849 YYFPRINTF (grecs_grecs_output, ")");
850 }
851
852 /*------------------------------------------------------------------.
853 | grecs_grecs__stack_print -- Print the state stack from its BOTTOM up to its |
854 | TOP (included). |
855 `------------------------------------------------------------------*/
856
857 #if (defined __STDC__ || defined __C99__FUNC__ \
858 || defined __cplusplus || defined _MSC_VER)
859 static void
grecs_grecs__stack_print(grecs_grecs_type_int16 * grecs_grecs_bottom,grecs_grecs_type_int16 * grecs_grecs_top)860 grecs_grecs__stack_print (grecs_grecs_type_int16 *grecs_grecs_bottom, grecs_grecs_type_int16 *grecs_grecs_top)
861 #else
862 static void
863 grecs_grecs__stack_print (grecs_grecs_bottom, grecs_grecs_top)
864 grecs_grecs_type_int16 *grecs_grecs_bottom;
865 grecs_grecs_type_int16 *grecs_grecs_top;
866 #endif
867 {
868 YYFPRINTF (stderr, "Stack now");
869 for (; grecs_grecs_bottom <= grecs_grecs_top; grecs_grecs_bottom++)
870 {
871 int grecs_grecs_bot = *grecs_grecs_bottom;
872 YYFPRINTF (stderr, " %d", grecs_grecs_bot);
873 }
874 YYFPRINTF (stderr, "\n");
875 }
876
877 # define YY_STACK_PRINT(Bottom, Top) \
878 do { \
879 if (grecs_grecs_debug) \
880 grecs_grecs__stack_print ((Bottom), (Top)); \
881 } while (YYID (0))
882
883
884 /*------------------------------------------------.
885 | Report that the YYRULE is going to be reduced. |
886 `------------------------------------------------*/
887
888 #if (defined __STDC__ || defined __C99__FUNC__ \
889 || defined __cplusplus || defined _MSC_VER)
890 static void
grecs_grecs__reduce_print(YYSTYPE * grecs_grecs_vsp,YYLTYPE * grecs_grecs_lsp,int grecs_grecs_rule)891 grecs_grecs__reduce_print (YYSTYPE *grecs_grecs_vsp, YYLTYPE *grecs_grecs_lsp, int grecs_grecs_rule)
892 #else
893 static void
894 grecs_grecs__reduce_print (grecs_grecs_vsp, grecs_grecs_lsp, grecs_grecs_rule)
895 YYSTYPE *grecs_grecs_vsp;
896 YYLTYPE *grecs_grecs_lsp;
897 int grecs_grecs_rule;
898 #endif
899 {
900 int grecs_grecs_nrhs = grecs_grecs_r2[grecs_grecs_rule];
901 int grecs_grecs_i;
902 unsigned long int grecs_grecs_lno = grecs_grecs_rline[grecs_grecs_rule];
903 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
904 grecs_grecs_rule - 1, grecs_grecs_lno);
905 /* The symbols being reduced. */
906 for (grecs_grecs_i = 0; grecs_grecs_i < grecs_grecs_nrhs; grecs_grecs_i++)
907 {
908 YYFPRINTF (stderr, " $%d = ", grecs_grecs_i + 1);
909 grecs_grecs__symbol_print (stderr, grecs_grecs_rhs[grecs_grecs_prhs[grecs_grecs_rule] + grecs_grecs_i],
910 &(grecs_grecs_vsp[(grecs_grecs_i + 1) - (grecs_grecs_nrhs)])
911 , &(grecs_grecs_lsp[(grecs_grecs_i + 1) - (grecs_grecs_nrhs)]) );
912 YYFPRINTF (stderr, "\n");
913 }
914 }
915
916 # define YY_REDUCE_PRINT(Rule) \
917 do { \
918 if (grecs_grecs_debug) \
919 grecs_grecs__reduce_print (grecs_grecs_vsp, grecs_grecs_lsp, Rule); \
920 } while (YYID (0))
921
922 /* Nonzero means print parse trace. It is left uninitialized so that
923 multiple parsers can coexist. */
924 int grecs_grecs_debug;
925 #else /* !YYDEBUG */
926 # define YYDPRINTF(Args)
927 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
928 # define YY_STACK_PRINT(Bottom, Top)
929 # define YY_REDUCE_PRINT(Rule)
930 #endif /* !YYDEBUG */
931
932
933 /* YYINITDEPTH -- initial size of the parser's stacks. */
934 #ifndef YYINITDEPTH
935 # define YYINITDEPTH 200
936 #endif
937
938 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
939 if the built-in stack extension method is used).
940
941 Do not make this value too large; the results are undefined if
942 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
943 evaluated with infinite-precision integer arithmetic. */
944
945 #ifndef YYMAXDEPTH
946 # define YYMAXDEPTH 10000
947 #endif
948
949
950 #if YYERROR_VERBOSE
951
952 # ifndef grecs_grecs_strlen
953 # if defined __GLIBC__ && defined _STRING_H
954 # define grecs_grecs_strlen strlen
955 # else
956 /* Return the length of YYSTR. */
957 #if (defined __STDC__ || defined __C99__FUNC__ \
958 || defined __cplusplus || defined _MSC_VER)
959 static YYSIZE_T
grecs_grecs_strlen(const char * grecs_grecs_str)960 grecs_grecs_strlen (const char *grecs_grecs_str)
961 #else
962 static YYSIZE_T
963 grecs_grecs_strlen (grecs_grecs_str)
964 const char *grecs_grecs_str;
965 #endif
966 {
967 YYSIZE_T grecs_grecs_len;
968 for (grecs_grecs_len = 0; grecs_grecs_str[grecs_grecs_len]; grecs_grecs_len++)
969 continue;
970 return grecs_grecs_len;
971 }
972 # endif
973 # endif
974
975 # ifndef grecs_grecs_stpcpy
976 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
977 # define grecs_grecs_stpcpy stpcpy
978 # else
979 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
980 YYDEST. */
981 #if (defined __STDC__ || defined __C99__FUNC__ \
982 || defined __cplusplus || defined _MSC_VER)
983 static char *
grecs_grecs_stpcpy(char * grecs_grecs_dest,const char * grecs_grecs_src)984 grecs_grecs_stpcpy (char *grecs_grecs_dest, const char *grecs_grecs_src)
985 #else
986 static char *
987 grecs_grecs_stpcpy (grecs_grecs_dest, grecs_grecs_src)
988 char *grecs_grecs_dest;
989 const char *grecs_grecs_src;
990 #endif
991 {
992 char *grecs_grecs_d = grecs_grecs_dest;
993 const char *grecs_grecs_s = grecs_grecs_src;
994
995 while ((*grecs_grecs_d++ = *grecs_grecs_s++) != '\0')
996 continue;
997
998 return grecs_grecs_d - 1;
999 }
1000 # endif
1001 # endif
1002
1003 # ifndef grecs_grecs_tnamerr
1004 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1005 quotes and backslashes, so that it's suitable for grecs_grecs_error. The
1006 heuristic is that double-quoting is unnecessary unless the string
1007 contains an apostrophe, a comma, or backslash (other than
1008 backslash-backslash). YYSTR is taken from grecs_grecs_tname. If YYRES is
1009 null, do not copy; instead, return the length of what the result
1010 would have been. */
1011 static YYSIZE_T
grecs_grecs_tnamerr(char * grecs_grecs_res,const char * grecs_grecs_str)1012 grecs_grecs_tnamerr (char *grecs_grecs_res, const char *grecs_grecs_str)
1013 {
1014 if (*grecs_grecs_str == '"')
1015 {
1016 YYSIZE_T grecs_grecs_n = 0;
1017 char const *grecs_grecs_p = grecs_grecs_str;
1018
1019 for (;;)
1020 switch (*++grecs_grecs_p)
1021 {
1022 case '\'':
1023 case ',':
1024 goto do_not_strip_quotes;
1025
1026 case '\\':
1027 if (*++grecs_grecs_p != '\\')
1028 goto do_not_strip_quotes;
1029 /* Fall through. */
1030 default:
1031 if (grecs_grecs_res)
1032 grecs_grecs_res[grecs_grecs_n] = *grecs_grecs_p;
1033 grecs_grecs_n++;
1034 break;
1035
1036 case '"':
1037 if (grecs_grecs_res)
1038 grecs_grecs_res[grecs_grecs_n] = '\0';
1039 return grecs_grecs_n;
1040 }
1041 do_not_strip_quotes: ;
1042 }
1043
1044 if (! grecs_grecs_res)
1045 return grecs_grecs_strlen (grecs_grecs_str);
1046
1047 return grecs_grecs_stpcpy (grecs_grecs_res, grecs_grecs_str) - grecs_grecs_res;
1048 }
1049 # endif
1050
1051 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1052 about the unexpected token YYTOKEN for the state stack whose top is
1053 YYSSP.
1054
1055 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1056 not large enough to hold the message. In that case, also set
1057 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1058 required number of bytes is too large to store. */
1059 static int
grecs_grecs_syntax_error(YYSIZE_T * grecs_grecs_msg_alloc,char ** grecs_grecs_msg,grecs_grecs_type_int16 * grecs_grecs_ssp,int grecs_grecs_token)1060 grecs_grecs_syntax_error (YYSIZE_T *grecs_grecs_msg_alloc, char **grecs_grecs_msg,
1061 grecs_grecs_type_int16 *grecs_grecs_ssp, int grecs_grecs_token)
1062 {
1063 YYSIZE_T grecs_grecs_size0 = grecs_grecs_tnamerr (YY_NULL, grecs_grecs_tname[grecs_grecs_token]);
1064 YYSIZE_T grecs_grecs_size = grecs_grecs_size0;
1065 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1066 /* Internationalized format string. */
1067 const char *grecs_grecs_format = YY_NULL;
1068 /* Arguments of grecs_grecs_format. */
1069 char const *grecs_grecs_arg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1070 /* Number of reported tokens (one for the "unexpected", one per
1071 "expected"). */
1072 int grecs_grecs_count = 0;
1073
1074 /* There are many possibilities here to consider:
1075 - Assume YYFAIL is not used. It's too flawed to consider. See
1076 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1077 for details. YYERROR is fine as it does not invoke this
1078 function.
1079 - If this state is a consistent state with a default action, then
1080 the only way this function was invoked is if the default action
1081 is an error action. In that case, don't check for expected
1082 tokens because there are none.
1083 - The only way there can be no lookahead present (in grecs_grecs_char) is if
1084 this state is a consistent state with a default action. Thus,
1085 detecting the absence of a lookahead is sufficient to determine
1086 that there is no unexpected or expected token to report. In that
1087 case, just report a simple "syntax error".
1088 - Don't assume there isn't a lookahead just because this state is a
1089 consistent state with a default action. There might have been a
1090 previous inconsistent state, consistent state with a non-default
1091 action, or user semantic action that manipulated grecs_grecs_char.
1092 - Of course, the expected token list depends on states to have
1093 correct lookahead information, and it depends on the parser not
1094 to perform extra reductions after fetching a lookahead from the
1095 scanner and before detecting a syntax error. Thus, state merging
1096 (from LALR or IELR) and default reductions corrupt the expected
1097 token list. However, the list is correct for canonical LR with
1098 one exception: it will still contain any token that will not be
1099 accepted due to an error action in a later state.
1100 */
1101 if (grecs_grecs_token != YYEMPTY)
1102 {
1103 int grecs_grecs_n = grecs_grecs_pact[*grecs_grecs_ssp];
1104 grecs_grecs_arg[grecs_grecs_count++] = grecs_grecs_tname[grecs_grecs_token];
1105 if (!grecs_grecs_pact_value_is_default (grecs_grecs_n))
1106 {
1107 /* Start YYX at -YYN if negative to avoid negative indexes in
1108 YYCHECK. In other words, skip the first -YYN actions for
1109 this state because they are default actions. */
1110 int grecs_grecs_xbegin = grecs_grecs_n < 0 ? -grecs_grecs_n : 0;
1111 /* Stay within bounds of both grecs_grecs_check and grecs_grecs_tname. */
1112 int grecs_grecs_checklim = YYLAST - grecs_grecs_n + 1;
1113 int grecs_grecs_xend = grecs_grecs_checklim < YYNTOKENS ? grecs_grecs_checklim : YYNTOKENS;
1114 int grecs_grecs_x;
1115
1116 for (grecs_grecs_x = grecs_grecs_xbegin; grecs_grecs_x < grecs_grecs_xend; ++grecs_grecs_x)
1117 if (grecs_grecs_check[grecs_grecs_x + grecs_grecs_n] == grecs_grecs_x && grecs_grecs_x != YYTERROR
1118 && !grecs_grecs_table_value_is_error (grecs_grecs_table[grecs_grecs_x + grecs_grecs_n]))
1119 {
1120 if (grecs_grecs_count == YYERROR_VERBOSE_ARGS_MAXIMUM)
1121 {
1122 grecs_grecs_count = 1;
1123 grecs_grecs_size = grecs_grecs_size0;
1124 break;
1125 }
1126 grecs_grecs_arg[grecs_grecs_count++] = grecs_grecs_tname[grecs_grecs_x];
1127 {
1128 YYSIZE_T grecs_grecs_size1 = grecs_grecs_size + grecs_grecs_tnamerr (YY_NULL, grecs_grecs_tname[grecs_grecs_x]);
1129 if (! (grecs_grecs_size <= grecs_grecs_size1
1130 && grecs_grecs_size1 <= YYSTACK_ALLOC_MAXIMUM))
1131 return 2;
1132 grecs_grecs_size = grecs_grecs_size1;
1133 }
1134 }
1135 }
1136 }
1137
1138 switch (grecs_grecs_count)
1139 {
1140 # define YYCASE_(N, S) \
1141 case N: \
1142 grecs_grecs_format = S; \
1143 break
1144 YYCASE_(0, YY_("syntax error"));
1145 YYCASE_(1, YY_("syntax error, unexpected %s"));
1146 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1147 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1148 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1149 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1150 # undef YYCASE_
1151 }
1152
1153 {
1154 YYSIZE_T grecs_grecs_size1 = grecs_grecs_size + grecs_grecs_strlen (grecs_grecs_format);
1155 if (! (grecs_grecs_size <= grecs_grecs_size1 && grecs_grecs_size1 <= YYSTACK_ALLOC_MAXIMUM))
1156 return 2;
1157 grecs_grecs_size = grecs_grecs_size1;
1158 }
1159
1160 if (*grecs_grecs_msg_alloc < grecs_grecs_size)
1161 {
1162 *grecs_grecs_msg_alloc = 2 * grecs_grecs_size;
1163 if (! (grecs_grecs_size <= *grecs_grecs_msg_alloc
1164 && *grecs_grecs_msg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1165 *grecs_grecs_msg_alloc = YYSTACK_ALLOC_MAXIMUM;
1166 return 1;
1167 }
1168
1169 /* Avoid sprintf, as that infringes on the user's name space.
1170 Don't have undefined behavior even if the translation
1171 produced a string with the wrong number of "%s"s. */
1172 {
1173 char *grecs_grecs_p = *grecs_grecs_msg;
1174 int grecs_grecs_i = 0;
1175 while ((*grecs_grecs_p = *grecs_grecs_format) != '\0')
1176 if (*grecs_grecs_p == '%' && grecs_grecs_format[1] == 's' && grecs_grecs_i < grecs_grecs_count)
1177 {
1178 grecs_grecs_p += grecs_grecs_tnamerr (grecs_grecs_p, grecs_grecs_arg[grecs_grecs_i++]);
1179 grecs_grecs_format += 2;
1180 }
1181 else
1182 {
1183 grecs_grecs_p++;
1184 grecs_grecs_format++;
1185 }
1186 }
1187 return 0;
1188 }
1189 #endif /* YYERROR_VERBOSE */
1190
1191 /*-----------------------------------------------.
1192 | Release the memory associated to this symbol. |
1193 `-----------------------------------------------*/
1194
1195 /*ARGSUSED*/
1196 #if (defined __STDC__ || defined __C99__FUNC__ \
1197 || defined __cplusplus || defined _MSC_VER)
1198 static void
grecs_grecs_destruct(const char * grecs_grecs_msg,int grecs_grecs_type,YYSTYPE * grecs_grecs_valuep,YYLTYPE * grecs_grecs_locationp)1199 grecs_grecs_destruct (const char *grecs_grecs_msg, int grecs_grecs_type, YYSTYPE *grecs_grecs_valuep, YYLTYPE *grecs_grecs_locationp)
1200 #else
1201 static void
1202 grecs_grecs_destruct (grecs_grecs_msg, grecs_grecs_type, grecs_grecs_valuep, grecs_grecs_locationp)
1203 const char *grecs_grecs_msg;
1204 int grecs_grecs_type;
1205 YYSTYPE *grecs_grecs_valuep;
1206 YYLTYPE *grecs_grecs_locationp;
1207 #endif
1208 {
1209 YYUSE (grecs_grecs_valuep);
1210 YYUSE (grecs_grecs_locationp);
1211
1212 if (!grecs_grecs_msg)
1213 grecs_grecs_msg = "Deleting";
1214 YY_SYMBOL_PRINT (grecs_grecs_msg, grecs_grecs_type, grecs_grecs_valuep, grecs_grecs_locationp);
1215
1216 switch (grecs_grecs_type)
1217 {
1218
1219 default:
1220 break;
1221 }
1222 }
1223
1224
1225
1226
1227 /* The lookahead symbol. */
1228 int grecs_grecs_char;
1229
1230
1231 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1232 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1233 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1234 #endif
1235 #ifndef YY_INITIAL_VALUE
1236 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1237 #endif
1238
1239 /* The semantic value of the lookahead symbol. */
1240 YYSTYPE grecs_grecs_lval YY_INITIAL_VALUE(grecs_grecs_val_default);
1241
1242 /* Location data for the lookahead symbol. */
1243 YYLTYPE grecs_grecs_lloc
1244 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1245 = { 1, 1, 1, 1 }
1246 # endif
1247 ;
1248
1249
1250 /* Number of syntax errors so far. */
1251 int grecs_grecs_nerrs;
1252
1253
1254 /*----------.
1255 | grecs_grecs_parse. |
1256 `----------*/
1257
1258 #ifdef YYPARSE_PARAM
1259 #if (defined __STDC__ || defined __C99__FUNC__ \
1260 || defined __cplusplus || defined _MSC_VER)
1261 int
grecs_grecs_parse(void * YYPARSE_PARAM)1262 grecs_grecs_parse (void *YYPARSE_PARAM)
1263 #else
1264 int
1265 grecs_grecs_parse (YYPARSE_PARAM)
1266 void *YYPARSE_PARAM;
1267 #endif
1268 #else /* ! YYPARSE_PARAM */
1269 #if (defined __STDC__ || defined __C99__FUNC__ \
1270 || defined __cplusplus || defined _MSC_VER)
1271 int
1272 grecs_grecs_parse (void)
1273 #else
1274 int
1275 grecs_grecs_parse ()
1276
1277 #endif
1278 #endif
1279 {
1280 int grecs_grecs_state;
1281 /* Number of tokens to shift before error messages enabled. */
1282 int grecs_grecs_errstatus;
1283
1284 /* The stacks and their tools:
1285 `grecs_grecs_ss': related to states.
1286 `grecs_grecs_vs': related to semantic values.
1287 `grecs_grecs_ls': related to locations.
1288
1289 Refer to the stacks through separate pointers, to allow grecs_grecs_overflow
1290 to reallocate them elsewhere. */
1291
1292 /* The state stack. */
1293 grecs_grecs_type_int16 grecs_grecs_ssa[YYINITDEPTH];
1294 grecs_grecs_type_int16 *grecs_grecs_ss;
1295 grecs_grecs_type_int16 *grecs_grecs_ssp;
1296
1297 /* The semantic value stack. */
1298 YYSTYPE grecs_grecs_vsa[YYINITDEPTH];
1299 YYSTYPE *grecs_grecs_vs;
1300 YYSTYPE *grecs_grecs_vsp;
1301
1302 /* The location stack. */
1303 YYLTYPE grecs_grecs_lsa[YYINITDEPTH];
1304 YYLTYPE *grecs_grecs_ls;
1305 YYLTYPE *grecs_grecs_lsp;
1306
1307 /* The locations where the error started and ended. */
1308 YYLTYPE grecs_grecs_error_range[3];
1309
1310 YYSIZE_T grecs_grecs_stacksize;
1311
1312 int grecs_grecs_n;
1313 int grecs_grecs_result;
1314 /* Lookahead token as an internal (translated) token number. */
1315 int grecs_grecs_token = 0;
1316 /* The variables used to return semantic value and location from the
1317 action routines. */
1318 YYSTYPE grecs_grecs_val;
1319 YYLTYPE grecs_grecs_loc;
1320
1321 #if YYERROR_VERBOSE
1322 /* Buffer for error messages, and its allocated size. */
1323 char grecs_grecs_msgbuf[128];
1324 char *grecs_grecs_msg = grecs_grecs_msgbuf;
1325 YYSIZE_T grecs_grecs_msg_alloc = sizeof grecs_grecs_msgbuf;
1326 #endif
1327
1328 #define YYPOPSTACK(N) (grecs_grecs_vsp -= (N), grecs_grecs_ssp -= (N), grecs_grecs_lsp -= (N))
1329
1330 /* The number of symbols on the RHS of the reduced rule.
1331 Keep to zero when no symbol should be popped. */
1332 int grecs_grecs_len = 0;
1333
1334 grecs_grecs_ssp = grecs_grecs_ss = grecs_grecs_ssa;
1335 grecs_grecs_vsp = grecs_grecs_vs = grecs_grecs_vsa;
1336 grecs_grecs_lsp = grecs_grecs_ls = grecs_grecs_lsa;
1337 grecs_grecs_stacksize = YYINITDEPTH;
1338
1339 YYDPRINTF ((stderr, "Starting parse\n"));
1340
1341 grecs_grecs_state = 0;
1342 grecs_grecs_errstatus = 0;
1343 grecs_grecs_nerrs = 0;
1344 grecs_grecs_char = YYEMPTY; /* Cause a token to be read. */
1345 grecs_grecs_lsp[0] = grecs_grecs_lloc;
1346 goto grecs_grecs_setstate;
1347
1348 /*------------------------------------------------------------.
1349 | grecs_grecs_newstate -- Push a new state, which is found in grecs_grecs_state. |
1350 `------------------------------------------------------------*/
1351 grecs_grecs_newstate:
1352 /* In all cases, when you get here, the value and location stacks
1353 have just been pushed. So pushing a state here evens the stacks. */
1354 grecs_grecs_ssp++;
1355
1356 grecs_grecs_setstate:
1357 *grecs_grecs_ssp = grecs_grecs_state;
1358
1359 if (grecs_grecs_ss + grecs_grecs_stacksize - 1 <= grecs_grecs_ssp)
1360 {
1361 /* Get the current used size of the three stacks, in elements. */
1362 YYSIZE_T grecs_grecs_size = grecs_grecs_ssp - grecs_grecs_ss + 1;
1363
1364 #ifdef grecs_grecs_overflow
1365 {
1366 /* Give user a chance to reallocate the stack. Use copies of
1367 these so that the &'s don't force the real ones into
1368 memory. */
1369 YYSTYPE *grecs_grecs_vs1 = grecs_grecs_vs;
1370 grecs_grecs_type_int16 *grecs_grecs_ss1 = grecs_grecs_ss;
1371 YYLTYPE *grecs_grecs_ls1 = grecs_grecs_ls;
1372
1373 /* Each stack pointer address is followed by the size of the
1374 data in use in that stack, in bytes. This used to be a
1375 conditional around just the two extra args, but that might
1376 be undefined if grecs_grecs_overflow is a macro. */
1377 grecs_grecs_overflow (YY_("memory exhausted"),
1378 &grecs_grecs_ss1, grecs_grecs_size * sizeof (*grecs_grecs_ssp),
1379 &grecs_grecs_vs1, grecs_grecs_size * sizeof (*grecs_grecs_vsp),
1380 &grecs_grecs_ls1, grecs_grecs_size * sizeof (*grecs_grecs_lsp),
1381 &grecs_grecs_stacksize);
1382
1383 grecs_grecs_ls = grecs_grecs_ls1;
1384 grecs_grecs_ss = grecs_grecs_ss1;
1385 grecs_grecs_vs = grecs_grecs_vs1;
1386 }
1387 #else /* no grecs_grecs_overflow */
1388 # ifndef YYSTACK_RELOCATE
1389 goto grecs_grecs_exhaustedlab;
1390 # else
1391 /* Extend the stack our own way. */
1392 if (YYMAXDEPTH <= grecs_grecs_stacksize)
1393 goto grecs_grecs_exhaustedlab;
1394 grecs_grecs_stacksize *= 2;
1395 if (YYMAXDEPTH < grecs_grecs_stacksize)
1396 grecs_grecs_stacksize = YYMAXDEPTH;
1397
1398 {
1399 grecs_grecs_type_int16 *grecs_grecs_ss1 = grecs_grecs_ss;
1400 union grecs_grecs_alloc *grecs_grecs_ptr =
1401 (union grecs_grecs_alloc *) YYSTACK_ALLOC (YYSTACK_BYTES (grecs_grecs_stacksize));
1402 if (! grecs_grecs_ptr)
1403 goto grecs_grecs_exhaustedlab;
1404 YYSTACK_RELOCATE (grecs_grecs_ss_alloc, grecs_grecs_ss);
1405 YYSTACK_RELOCATE (grecs_grecs_vs_alloc, grecs_grecs_vs);
1406 YYSTACK_RELOCATE (grecs_grecs_ls_alloc, grecs_grecs_ls);
1407 # undef YYSTACK_RELOCATE
1408 if (grecs_grecs_ss1 != grecs_grecs_ssa)
1409 YYSTACK_FREE (grecs_grecs_ss1);
1410 }
1411 # endif
1412 #endif /* no grecs_grecs_overflow */
1413
1414 grecs_grecs_ssp = grecs_grecs_ss + grecs_grecs_size - 1;
1415 grecs_grecs_vsp = grecs_grecs_vs + grecs_grecs_size - 1;
1416 grecs_grecs_lsp = grecs_grecs_ls + grecs_grecs_size - 1;
1417
1418 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1419 (unsigned long int) grecs_grecs_stacksize));
1420
1421 if (grecs_grecs_ss + grecs_grecs_stacksize - 1 <= grecs_grecs_ssp)
1422 YYABORT;
1423 }
1424
1425 YYDPRINTF ((stderr, "Entering state %d\n", grecs_grecs_state));
1426
1427 if (grecs_grecs_state == YYFINAL)
1428 YYACCEPT;
1429
1430 goto grecs_grecs_backup;
1431
1432 /*-----------.
1433 | grecs_grecs_backup. |
1434 `-----------*/
1435 grecs_grecs_backup:
1436
1437 /* Do appropriate processing given the current state. Read a
1438 lookahead token if we need one and don't already have one. */
1439
1440 /* First try to decide what to do without reference to lookahead token. */
1441 grecs_grecs_n = grecs_grecs_pact[grecs_grecs_state];
1442 if (grecs_grecs_pact_value_is_default (grecs_grecs_n))
1443 goto grecs_grecs_default;
1444
1445 /* Not known => get a lookahead token if don't already have one. */
1446
1447 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1448 if (grecs_grecs_char == YYEMPTY)
1449 {
1450 YYDPRINTF ((stderr, "Reading a token: "));
1451 grecs_grecs_char = YYLEX;
1452 }
1453
1454 if (grecs_grecs_char <= YYEOF)
1455 {
1456 grecs_grecs_char = grecs_grecs_token = YYEOF;
1457 YYDPRINTF ((stderr, "Now at end of input.\n"));
1458 }
1459 else
1460 {
1461 grecs_grecs_token = YYTRANSLATE (grecs_grecs_char);
1462 YY_SYMBOL_PRINT ("Next token is", grecs_grecs_token, &grecs_grecs_lval, &grecs_grecs_lloc);
1463 }
1464
1465 /* If the proper action on seeing token YYTOKEN is to reduce or to
1466 detect an error, take that action. */
1467 grecs_grecs_n += grecs_grecs_token;
1468 if (grecs_grecs_n < 0 || YYLAST < grecs_grecs_n || grecs_grecs_check[grecs_grecs_n] != grecs_grecs_token)
1469 goto grecs_grecs_default;
1470 grecs_grecs_n = grecs_grecs_table[grecs_grecs_n];
1471 if (grecs_grecs_n <= 0)
1472 {
1473 if (grecs_grecs_table_value_is_error (grecs_grecs_n))
1474 goto grecs_grecs_errlab;
1475 grecs_grecs_n = -grecs_grecs_n;
1476 goto grecs_grecs_reduce;
1477 }
1478
1479 /* Count tokens shifted since error; after three, turn off error
1480 status. */
1481 if (grecs_grecs_errstatus)
1482 grecs_grecs_errstatus--;
1483
1484 /* Shift the lookahead token. */
1485 YY_SYMBOL_PRINT ("Shifting", grecs_grecs_token, &grecs_grecs_lval, &grecs_grecs_lloc);
1486
1487 /* Discard the shifted token. */
1488 grecs_grecs_char = YYEMPTY;
1489
1490 grecs_grecs_state = grecs_grecs_n;
1491 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1492 *++grecs_grecs_vsp = grecs_grecs_lval;
1493 YY_IGNORE_MAYBE_UNINITIALIZED_END
1494 *++grecs_grecs_lsp = grecs_grecs_lloc;
1495 goto grecs_grecs_newstate;
1496
1497
1498 /*-----------------------------------------------------------.
1499 | grecs_grecs_default -- do the default action for the current state. |
1500 `-----------------------------------------------------------*/
1501 grecs_grecs_default:
1502 grecs_grecs_n = grecs_grecs_defact[grecs_grecs_state];
1503 if (grecs_grecs_n == 0)
1504 goto grecs_grecs_errlab;
1505 goto grecs_grecs_reduce;
1506
1507
1508 /*-----------------------------.
1509 | grecs_grecs_reduce -- Do a reduction. |
1510 `-----------------------------*/
1511 grecs_grecs_reduce:
1512 /* grecs_grecs_n is the number of a rule to reduce with. */
1513 grecs_grecs_len = grecs_grecs_r2[grecs_grecs_n];
1514
1515 /* If YYLEN is nonzero, implement the default value of the action:
1516 `$$ = $1'.
1517
1518 Otherwise, the following line sets YYVAL to garbage.
1519 This behavior is undocumented and Bison
1520 users should not rely upon it. Assigning to YYVAL
1521 unconditionally makes the parser a bit smaller, and it avoids a
1522 GCC warning that YYVAL may be used uninitialized. */
1523 grecs_grecs_val = grecs_grecs_vsp[1-grecs_grecs_len];
1524
1525 /* Default location. */
1526 YYLLOC_DEFAULT (grecs_grecs_loc, (grecs_grecs_lsp - grecs_grecs_len), grecs_grecs_len);
1527 YY_REDUCE_PRINT (grecs_grecs_n);
1528 switch (grecs_grecs_n)
1529 {
1530 case 2:
1531 /* Line 1792 of yacc.c */
1532 #line 58 "grecs-gram.y"
1533 {
1534 parse_tree = grecs_node_create(grecs_node_root, &(grecs_grecs_lsp[(1) - (1)]));
1535 parse_tree->v.texttab = grecs_text_table();
1536 grecs_node_bind(parse_tree, (grecs_grecs_vsp[(1) - (1)].node), 1);
1537 }
1538 break;
1539
1540 case 3:
1541 /* Line 1792 of yacc.c */
1542 #line 67 "grecs-gram.y"
1543 {
1544 (grecs_grecs_val.node) = NULL;
1545 }
1546 break;
1547
1548 case 4:
1549 /* Line 1792 of yacc.c */
1550 #line 71 "grecs-gram.y"
1551 {
1552 (grecs_grecs_val.node) = (grecs_grecs_vsp[(1) - (1)].node_list).head;
1553 }
1554 break;
1555
1556 case 5:
1557 /* Line 1792 of yacc.c */
1558 #line 77 "grecs-gram.y"
1559 {
1560 (grecs_grecs_val.node_list).head = (grecs_grecs_val.node_list).tail = (grecs_grecs_vsp[(1) - (1)].node);
1561 }
1562 break;
1563
1564 case 6:
1565 /* Line 1792 of yacc.c */
1566 #line 81 "grecs-gram.y"
1567 {
1568 grecs_node_bind((grecs_grecs_vsp[(1) - (2)].node_list).tail, (grecs_grecs_vsp[(2) - (2)].node), 0);
1569 }
1570 break;
1571
1572 case 9:
1573 /* Line 1792 of yacc.c */
1574 #line 91 "grecs-gram.y"
1575 {
1576 (grecs_grecs_val.node) = grecs_node_create_points(grecs_node_stmt,
1577 (grecs_grecs_lsp[(1) - (3)]).beg, (grecs_grecs_lsp[(2) - (3)]).end);
1578 (grecs_grecs_val.node)->ident = (grecs_grecs_vsp[(1) - (3)].string);
1579 (grecs_grecs_val.node)->idloc = (grecs_grecs_lsp[(1) - (3)]);
1580 (grecs_grecs_val.node)->v.value = (grecs_grecs_vsp[(2) - (3)].pvalue);
1581 }
1582 break;
1583
1584 case 10:
1585 /* Line 1792 of yacc.c */
1586 #line 99 "grecs-gram.y"
1587 {
1588 (grecs_grecs_val.node) = grecs_node_create(grecs_node_stmt, &(grecs_grecs_lsp[(1) - (2)]));
1589 (grecs_grecs_val.node)->ident = (grecs_grecs_vsp[(1) - (2)].string);
1590 (grecs_grecs_val.node)->idloc = (grecs_grecs_lsp[(1) - (2)]);
1591 (grecs_grecs_val.node)->v.value = NULL;
1592 }
1593 break;
1594
1595 case 11:
1596 /* Line 1792 of yacc.c */
1597 #line 108 "grecs-gram.y"
1598 {
1599 (grecs_grecs_val.node) = grecs_node_create_points(grecs_node_block,
1600 (grecs_grecs_lsp[(1) - (6)]).beg, (grecs_grecs_lsp[(5) - (6)]).end);
1601 (grecs_grecs_val.node)->ident = (grecs_grecs_vsp[(1) - (6)].string);
1602 (grecs_grecs_val.node)->idloc = (grecs_grecs_lsp[(1) - (6)]);
1603 (grecs_grecs_val.node)->v.value = (grecs_grecs_vsp[(2) - (6)].pvalue);
1604 grecs_node_bind((grecs_grecs_val.node), (grecs_grecs_vsp[(4) - (6)].node_list).head, 1);
1605 }
1606 break;
1607
1608 case 12:
1609 /* Line 1792 of yacc.c */
1610 #line 119 "grecs-gram.y"
1611 {
1612 (grecs_grecs_val.pvalue) = NULL;
1613 }
1614 break;
1615
1616 case 14:
1617 /* Line 1792 of yacc.c */
1618 #line 126 "grecs-gram.y"
1619 {
1620 size_t n;
1621
1622 if ((n = grecs_list_size((grecs_grecs_vsp[(1) - (1)].list))) == 1) {
1623 (grecs_grecs_val.pvalue) = grecs_list_index((grecs_grecs_vsp[(1) - (1)].list), 0);
1624 } else {
1625 size_t i;
1626 struct grecs_list_entry *ep;
1627
1628 (grecs_grecs_val.pvalue) = grecs_malloc(sizeof((grecs_grecs_val.pvalue)[0]));
1629 (grecs_grecs_val.pvalue)->type = GRECS_TYPE_ARRAY;
1630 (grecs_grecs_val.pvalue)->locus = (grecs_grecs_lsp[(1) - (1)]);
1631 (grecs_grecs_val.pvalue)->v.arg.c = n;
1632 (grecs_grecs_val.pvalue)->v.arg.v = grecs_calloc(n,
1633 sizeof((grecs_grecs_val.pvalue)->v.arg.v[0]));
1634 for (i = 0, ep = (grecs_grecs_vsp[(1) - (1)].list)->head; ep; i++, ep = ep->next)
1635 (grecs_grecs_val.pvalue)->v.arg.v[i] = ep->data;
1636 }
1637 (grecs_grecs_vsp[(1) - (1)].list)->free_entry = NULL;
1638 grecs_list_free((grecs_grecs_vsp[(1) - (1)].list));
1639 }
1640 break;
1641
1642 case 15:
1643 /* Line 1792 of yacc.c */
1644 #line 150 "grecs-gram.y"
1645 {
1646 (grecs_grecs_val.list) = grecs_value_list_create();
1647 grecs_list_append((grecs_grecs_val.list), grecs_value_ptr_from_static(&(grecs_grecs_vsp[(1) - (1)].svalue)));
1648 }
1649 break;
1650
1651 case 16:
1652 /* Line 1792 of yacc.c */
1653 #line 155 "grecs-gram.y"
1654 {
1655 grecs_list_append((grecs_grecs_vsp[(1) - (2)].list), grecs_value_ptr_from_static(&(grecs_grecs_vsp[(2) - (2)].svalue)));
1656 }
1657 break;
1658
1659 case 17:
1660 /* Line 1792 of yacc.c */
1661 #line 161 "grecs-gram.y"
1662 {
1663 (grecs_grecs_val.svalue).type = GRECS_TYPE_STRING;
1664 (grecs_grecs_val.svalue).locus = (grecs_grecs_lsp[(1) - (1)]);
1665 (grecs_grecs_val.svalue).v.string = (grecs_grecs_vsp[(1) - (1)].string);
1666 }
1667 break;
1668
1669 case 18:
1670 /* Line 1792 of yacc.c */
1671 #line 167 "grecs-gram.y"
1672 {
1673 (grecs_grecs_val.svalue).type = GRECS_TYPE_LIST;
1674 (grecs_grecs_val.svalue).locus = (grecs_grecs_lsp[(1) - (1)]);
1675 (grecs_grecs_val.svalue).v.list = (grecs_grecs_vsp[(1) - (1)].list);
1676 }
1677 break;
1678
1679 case 19:
1680 /* Line 1792 of yacc.c */
1681 #line 173 "grecs-gram.y"
1682 {
1683 (grecs_grecs_val.svalue).type = GRECS_TYPE_STRING;
1684 (grecs_grecs_val.svalue).locus = (grecs_grecs_lsp[(1) - (1)]);
1685 (grecs_grecs_val.svalue).v.string = (grecs_grecs_vsp[(1) - (1)].string);
1686 }
1687 break;
1688
1689 case 23:
1690 /* Line 1792 of yacc.c */
1691 #line 186 "grecs-gram.y"
1692 {
1693 struct grecs_list_entry *ep;
1694
1695 grecs_line_begin();
1696 for (ep = (grecs_grecs_vsp[(1) - (1)].list)->head; ep; ep = ep->next) {
1697 grecs_line_add(ep->data, strlen(ep->data));
1698 free(ep->data);
1699 ep->data = NULL;
1700 }
1701 (grecs_grecs_val.string) = grecs_line_finish();
1702 grecs_list_free((grecs_grecs_vsp[(1) - (1)].list));
1703 }
1704 break;
1705
1706 case 24:
1707 /* Line 1792 of yacc.c */
1708 #line 201 "grecs-gram.y"
1709 {
1710 (grecs_grecs_val.list) = grecs_list_create();
1711 grecs_list_append((grecs_grecs_val.list), (grecs_grecs_vsp[(1) - (1)].string));
1712 }
1713 break;
1714
1715 case 25:
1716 /* Line 1792 of yacc.c */
1717 #line 206 "grecs-gram.y"
1718 {
1719 grecs_list_append((grecs_grecs_vsp[(1) - (2)].list), (grecs_grecs_vsp[(2) - (2)].string));
1720 (grecs_grecs_val.list) = (grecs_grecs_vsp[(1) - (2)].list);
1721 }
1722 break;
1723
1724 case 26:
1725 /* Line 1792 of yacc.c */
1726 #line 213 "grecs-gram.y"
1727 {
1728 (grecs_grecs_val.list) = NULL;
1729 }
1730 break;
1731
1732 case 27:
1733 /* Line 1792 of yacc.c */
1734 #line 217 "grecs-gram.y"
1735 {
1736 (grecs_grecs_val.list) = (grecs_grecs_vsp[(2) - (3)].list);
1737 }
1738 break;
1739
1740 case 28:
1741 /* Line 1792 of yacc.c */
1742 #line 221 "grecs-gram.y"
1743 {
1744 (grecs_grecs_val.list) = (grecs_grecs_vsp[(2) - (4)].list);
1745 }
1746 break;
1747
1748 case 29:
1749 /* Line 1792 of yacc.c */
1750 #line 227 "grecs-gram.y"
1751 {
1752 (grecs_grecs_val.list) = grecs_value_list_create();
1753 grecs_list_append((grecs_grecs_val.list), grecs_value_ptr_from_static(&(grecs_grecs_vsp[(1) - (1)].svalue)));
1754 }
1755 break;
1756
1757 case 30:
1758 /* Line 1792 of yacc.c */
1759 #line 232 "grecs-gram.y"
1760 {
1761 grecs_list_append((grecs_grecs_vsp[(1) - (3)].list), grecs_value_ptr_from_static(&(grecs_grecs_vsp[(3) - (3)].svalue)));
1762 (grecs_grecs_val.list) = (grecs_grecs_vsp[(1) - (3)].list);
1763 }
1764 break;
1765
1766
1767 /* Line 1792 of yacc.c */
1768 #line 1769 "grecs-gram.c"
1769 default: break;
1770 }
1771 /* User semantic actions sometimes alter grecs_grecs_char, and that requires
1772 that grecs_grecs_token be updated with the new translation. We take the
1773 approach of translating immediately before every use of grecs_grecs_token.
1774 One alternative is translating here after every semantic action,
1775 but that translation would be missed if the semantic action invokes
1776 YYABORT, YYACCEPT, or YYERROR immediately after altering grecs_grecs_char or
1777 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1778 incorrect destructor might then be invoked immediately. In the
1779 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1780 to an incorrect destructor call or verbose syntax error message
1781 before the lookahead is translated. */
1782 YY_SYMBOL_PRINT ("-> $$ =", grecs_grecs_r1[grecs_grecs_n], &grecs_grecs_val, &grecs_grecs_loc);
1783
1784 YYPOPSTACK (grecs_grecs_len);
1785 grecs_grecs_len = 0;
1786 YY_STACK_PRINT (grecs_grecs_ss, grecs_grecs_ssp);
1787
1788 *++grecs_grecs_vsp = grecs_grecs_val;
1789 *++grecs_grecs_lsp = grecs_grecs_loc;
1790
1791 /* Now `shift' the result of the reduction. Determine what state
1792 that goes to, based on the state we popped back to and the rule
1793 number reduced by. */
1794
1795 grecs_grecs_n = grecs_grecs_r1[grecs_grecs_n];
1796
1797 grecs_grecs_state = grecs_grecs_pgoto[grecs_grecs_n - YYNTOKENS] + *grecs_grecs_ssp;
1798 if (0 <= grecs_grecs_state && grecs_grecs_state <= YYLAST && grecs_grecs_check[grecs_grecs_state] == *grecs_grecs_ssp)
1799 grecs_grecs_state = grecs_grecs_table[grecs_grecs_state];
1800 else
1801 grecs_grecs_state = grecs_grecs_defgoto[grecs_grecs_n - YYNTOKENS];
1802
1803 goto grecs_grecs_newstate;
1804
1805
1806 /*------------------------------------.
1807 | grecs_grecs_errlab -- here on detecting error |
1808 `------------------------------------*/
1809 grecs_grecs_errlab:
1810 /* Make sure we have latest lookahead translation. See comments at
1811 user semantic actions for why this is necessary. */
1812 grecs_grecs_token = grecs_grecs_char == YYEMPTY ? YYEMPTY : YYTRANSLATE (grecs_grecs_char);
1813
1814 /* If not already recovering from an error, report this error. */
1815 if (!grecs_grecs_errstatus)
1816 {
1817 ++grecs_grecs_nerrs;
1818 #if ! YYERROR_VERBOSE
1819 grecs_grecs_error (YY_("syntax error"));
1820 #else
1821 # define YYSYNTAX_ERROR grecs_grecs_syntax_error (&grecs_grecs_msg_alloc, &grecs_grecs_msg, \
1822 grecs_grecs_ssp, grecs_grecs_token)
1823 {
1824 char const *grecs_grecs_msgp = YY_("syntax error");
1825 int grecs_grecs_syntax_error_status;
1826 grecs_grecs_syntax_error_status = YYSYNTAX_ERROR;
1827 if (grecs_grecs_syntax_error_status == 0)
1828 grecs_grecs_msgp = grecs_grecs_msg;
1829 else if (grecs_grecs_syntax_error_status == 1)
1830 {
1831 if (grecs_grecs_msg != grecs_grecs_msgbuf)
1832 YYSTACK_FREE (grecs_grecs_msg);
1833 grecs_grecs_msg = (char *) YYSTACK_ALLOC (grecs_grecs_msg_alloc);
1834 if (!grecs_grecs_msg)
1835 {
1836 grecs_grecs_msg = grecs_grecs_msgbuf;
1837 grecs_grecs_msg_alloc = sizeof grecs_grecs_msgbuf;
1838 grecs_grecs_syntax_error_status = 2;
1839 }
1840 else
1841 {
1842 grecs_grecs_syntax_error_status = YYSYNTAX_ERROR;
1843 grecs_grecs_msgp = grecs_grecs_msg;
1844 }
1845 }
1846 grecs_grecs_error (grecs_grecs_msgp);
1847 if (grecs_grecs_syntax_error_status == 2)
1848 goto grecs_grecs_exhaustedlab;
1849 }
1850 # undef YYSYNTAX_ERROR
1851 #endif
1852 }
1853
1854 grecs_grecs_error_range[1] = grecs_grecs_lloc;
1855
1856 if (grecs_grecs_errstatus == 3)
1857 {
1858 /* If just tried and failed to reuse lookahead token after an
1859 error, discard it. */
1860
1861 if (grecs_grecs_char <= YYEOF)
1862 {
1863 /* Return failure if at end of input. */
1864 if (grecs_grecs_char == YYEOF)
1865 YYABORT;
1866 }
1867 else
1868 {
1869 grecs_grecs_destruct ("Error: discarding",
1870 grecs_grecs_token, &grecs_grecs_lval, &grecs_grecs_lloc);
1871 grecs_grecs_char = YYEMPTY;
1872 }
1873 }
1874
1875 /* Else will try to reuse lookahead token after shifting the error
1876 token. */
1877 goto grecs_grecs_errlab1;
1878
1879
1880 /*---------------------------------------------------.
1881 | grecs_grecs_errorlab -- error raised explicitly by YYERROR. |
1882 `---------------------------------------------------*/
1883 grecs_grecs_errorlab:
1884
1885 /* Pacify compilers like GCC when the user code never invokes
1886 YYERROR and the label grecs_grecs_errorlab therefore never appears in user
1887 code. */
1888 if (/*CONSTCOND*/ 0)
1889 goto grecs_grecs_errorlab;
1890
1891 grecs_grecs_error_range[1] = grecs_grecs_lsp[1-grecs_grecs_len];
1892 /* Do not reclaim the symbols of the rule which action triggered
1893 this YYERROR. */
1894 YYPOPSTACK (grecs_grecs_len);
1895 grecs_grecs_len = 0;
1896 YY_STACK_PRINT (grecs_grecs_ss, grecs_grecs_ssp);
1897 grecs_grecs_state = *grecs_grecs_ssp;
1898 goto grecs_grecs_errlab1;
1899
1900
1901 /*-------------------------------------------------------------.
1902 | grecs_grecs_errlab1 -- common code for both syntax error and YYERROR. |
1903 `-------------------------------------------------------------*/
1904 grecs_grecs_errlab1:
1905 grecs_grecs_errstatus = 3; /* Each real token shifted decrements this. */
1906
1907 for (;;)
1908 {
1909 grecs_grecs_n = grecs_grecs_pact[grecs_grecs_state];
1910 if (!grecs_grecs_pact_value_is_default (grecs_grecs_n))
1911 {
1912 grecs_grecs_n += YYTERROR;
1913 if (0 <= grecs_grecs_n && grecs_grecs_n <= YYLAST && grecs_grecs_check[grecs_grecs_n] == YYTERROR)
1914 {
1915 grecs_grecs_n = grecs_grecs_table[grecs_grecs_n];
1916 if (0 < grecs_grecs_n)
1917 break;
1918 }
1919 }
1920
1921 /* Pop the current state because it cannot handle the error token. */
1922 if (grecs_grecs_ssp == grecs_grecs_ss)
1923 YYABORT;
1924
1925 grecs_grecs_error_range[1] = *grecs_grecs_lsp;
1926 grecs_grecs_destruct ("Error: popping",
1927 grecs_grecs_stos[grecs_grecs_state], grecs_grecs_vsp, grecs_grecs_lsp);
1928 YYPOPSTACK (1);
1929 grecs_grecs_state = *grecs_grecs_ssp;
1930 YY_STACK_PRINT (grecs_grecs_ss, grecs_grecs_ssp);
1931 }
1932
1933 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1934 *++grecs_grecs_vsp = grecs_grecs_lval;
1935 YY_IGNORE_MAYBE_UNINITIALIZED_END
1936
1937 grecs_grecs_error_range[2] = grecs_grecs_lloc;
1938 /* Using YYLLOC is tempting, but would change the location of
1939 the lookahead. YYLOC is available though. */
1940 YYLLOC_DEFAULT (grecs_grecs_loc, grecs_grecs_error_range, 2);
1941 *++grecs_grecs_lsp = grecs_grecs_loc;
1942
1943 /* Shift the error token. */
1944 YY_SYMBOL_PRINT ("Shifting", grecs_grecs_stos[grecs_grecs_n], grecs_grecs_vsp, grecs_grecs_lsp);
1945
1946 grecs_grecs_state = grecs_grecs_n;
1947 goto grecs_grecs_newstate;
1948
1949
1950 /*-------------------------------------.
1951 | grecs_grecs_acceptlab -- YYACCEPT comes here. |
1952 `-------------------------------------*/
1953 grecs_grecs_acceptlab:
1954 grecs_grecs_result = 0;
1955 goto grecs_grecs_return;
1956
1957 /*-----------------------------------.
1958 | grecs_grecs_abortlab -- YYABORT comes here. |
1959 `-----------------------------------*/
1960 grecs_grecs_abortlab:
1961 grecs_grecs_result = 1;
1962 goto grecs_grecs_return;
1963
1964 #if !defined grecs_grecs_overflow || YYERROR_VERBOSE
1965 /*-------------------------------------------------.
1966 | grecs_grecs_exhaustedlab -- memory exhaustion comes here. |
1967 `-------------------------------------------------*/
1968 grecs_grecs_exhaustedlab:
1969 grecs_grecs_error (YY_("memory exhausted"));
1970 grecs_grecs_result = 2;
1971 /* Fall through. */
1972 #endif
1973
1974 grecs_grecs_return:
1975 if (grecs_grecs_char != YYEMPTY)
1976 {
1977 /* Make sure we have latest lookahead translation. See comments at
1978 user semantic actions for why this is necessary. */
1979 grecs_grecs_token = YYTRANSLATE (grecs_grecs_char);
1980 grecs_grecs_destruct ("Cleanup: discarding lookahead",
1981 grecs_grecs_token, &grecs_grecs_lval, &grecs_grecs_lloc);
1982 }
1983 /* Do not reclaim the symbols of the rule which action triggered
1984 this YYABORT or YYACCEPT. */
1985 YYPOPSTACK (grecs_grecs_len);
1986 YY_STACK_PRINT (grecs_grecs_ss, grecs_grecs_ssp);
1987 while (grecs_grecs_ssp != grecs_grecs_ss)
1988 {
1989 grecs_grecs_destruct ("Cleanup: popping",
1990 grecs_grecs_stos[*grecs_grecs_ssp], grecs_grecs_vsp, grecs_grecs_lsp);
1991 YYPOPSTACK (1);
1992 }
1993 #ifndef grecs_grecs_overflow
1994 if (grecs_grecs_ss != grecs_grecs_ssa)
1995 YYSTACK_FREE (grecs_grecs_ss);
1996 #endif
1997 #if YYERROR_VERBOSE
1998 if (grecs_grecs_msg != grecs_grecs_msgbuf)
1999 YYSTACK_FREE (grecs_grecs_msg);
2000 #endif
2001 /* Make sure YYID is used. */
2002 return YYID (grecs_grecs_result);
2003 }
2004
2005
2006 /* Line 2055 of yacc.c */
2007 #line 242 "grecs-gram.y"
2008
2009
2010 int
grecs_grecs_error(char const * s)2011 grecs_grecs_error(char const *s)
2012 {
2013 grecs_error(&grecs_grecs_lloc, 0, "%s", s);
2014 return 0;
2015 }
2016
2017 struct grecs_node *
grecs_grecs_parser(const char * name,int traceflags)2018 grecs_grecs_parser(const char *name, int traceflags)
2019 {
2020 int rc;
2021 if (grecs_lex_begin(name, traceflags & GRECS_TRACE_LEX))
2022 return NULL;
2023 grecs_grecs_debug = traceflags & GRECS_TRACE_GRAM;
2024 parse_tree = NULL;
2025 rc = grecs_grecs_parse();
2026 if (grecs_error_count)
2027 rc = 1;
2028 grecs_lex_end(rc);
2029 if (rc) {
2030 grecs_tree_free(parse_tree);
2031 parse_tree = NULL;
2032 }
2033 return parse_tree;
2034 }
2035
2036
2037
2038
2039
2040
2041