1 /* A Bison parser, made by GNU Bison 2.3. */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46 /* Identify Bison output. */
47 #define YYBISON 1
48
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers. */
56 #define YYPURE 0
57
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names. */
62 #define yyparse pdcg_parse
63 #define yylex pdcg_lex
64 #define yyerror pdcg_error
65 #define yylval pdcg_lval
66 #define yychar pdcg_char
67 #define yydebug pdcg_debug
68 #define yynerrs pdcg_nerrs
69
70
71 /* Tokens. */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 identifier = 258,
78 string_literal = 259,
79 constructor = 260,
80 left_brace = 261,
81 right_brace = 262,
82 left_parenthesis = 263,
83 right_parenthesis = 264,
84 left_square = 265,
85 right_square = 266,
86 colon = 267,
87 comma = 268,
88 semicolon = 269,
89 equals = 270,
90 choice = 271,
91 grtr = 272,
92 question_mark = 273,
93 plus = 274,
94 minus = 275,
95 lex_error_token = 276
96 };
97 #endif
98 /* Tokens. */
99 #define identifier 258
100 #define string_literal 259
101 #define constructor 260
102 #define left_brace 261
103 #define right_brace 262
104 #define left_parenthesis 263
105 #define right_parenthesis 264
106 #define left_square 265
107 #define right_square 266
108 #define colon 267
109 #define comma 268
110 #define semicolon 269
111 #define equals 270
112 #define choice 271
113 #define grtr 272
114 #define question_mark 273
115 #define plus 274
116 #define minus 275
117 #define lex_error_token 276
118
119
120
121
122 /* Copy the first part of user declarations. */
123 #line 24 "dcg_parser.y"
124
125 /* Global includes */
126 #include <stdio.h>
127 #include <stdlib.h>
128 #include <string.h>
129
130 /* libdcg includes */
131 #include <dcg.h>
132 #include <dcg_error.h>
133
134 /* local includes */
135 #include "dcg_lex.h"
136 #include "dcg_code.h"
137 #include "dcg_parser2.h"
138 #define YYERROR_VERBOSE 1
139
140 def_list all_defs;
141 stat_list all_stats;
142 type_list imp_types;
143
144
145 /* Enabling traces. */
146 #ifndef YYDEBUG
147 # define YYDEBUG 0
148 #endif
149
150 /* Enabling verbose error messages. */
151 #ifdef YYERROR_VERBOSE
152 # undef YYERROR_VERBOSE
153 # define YYERROR_VERBOSE 1
154 #else
155 # define YYERROR_VERBOSE 0
156 #endif
157
158 /* Enabling the token table. */
159 #ifndef YYTOKEN_TABLE
160 # define YYTOKEN_TABLE 0
161 #endif
162
163 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
164 typedef union YYSTYPE
165 #line 48 "dcg_parser.y"
166 {
167 int value; /* int is a reserved word in C */
168 string string;
169 string_list string_list;
170 def definition;
171 def_list definition_list;
172 stat statement;
173 stat_list statement_list;
174 field field;
175 field_list field_list;
176 vfield vfield;
177 vfield_list vfield_list;
178 type type;
179 type_list type_list;
180 }
181 /* Line 187 of yacc.c. */
182 #line 183 "dcg_parser.c"
183 YYSTYPE;
184 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
185 # define YYSTYPE_IS_DECLARED 1
186 # define YYSTYPE_IS_TRIVIAL 1
187 #endif
188
189
190
191 /* Copy the second part of user declarations. */
192
193
194 /* Line 216 of yacc.c. */
195 #line 196 "dcg_parser.c"
196
197 #ifdef short
198 # undef short
199 #endif
200
201 #ifdef YYTYPE_UINT8
202 typedef YYTYPE_UINT8 yytype_uint8;
203 #else
204 typedef unsigned char yytype_uint8;
205 #endif
206
207 #ifdef YYTYPE_INT8
208 typedef YYTYPE_INT8 yytype_int8;
209 #elif (defined __STDC__ || defined __C99__FUNC__ \
210 || defined __cplusplus || defined _MSC_VER)
211 typedef signed char yytype_int8;
212 #else
213 typedef short int yytype_int8;
214 #endif
215
216 #ifdef YYTYPE_UINT16
217 typedef YYTYPE_UINT16 yytype_uint16;
218 #else
219 typedef unsigned short int yytype_uint16;
220 #endif
221
222 #ifdef YYTYPE_INT16
223 typedef YYTYPE_INT16 yytype_int16;
224 #else
225 typedef short int yytype_int16;
226 #endif
227
228 #ifndef YYSIZE_T
229 # ifdef __SIZE_TYPE__
230 # define YYSIZE_T __SIZE_TYPE__
231 # elif defined size_t
232 # define YYSIZE_T size_t
233 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
234 || defined __cplusplus || defined _MSC_VER)
235 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
236 # define YYSIZE_T size_t
237 # else
238 # define YYSIZE_T unsigned int
239 # endif
240 #endif
241
242 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
243
244 #ifndef YY_
245 # if YYENABLE_NLS
246 # if ENABLE_NLS
247 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
248 # define YY_(msgid) dgettext ("bison-runtime", msgid)
249 # endif
250 # endif
251 # ifndef YY_
252 # define YY_(msgid) msgid
253 # endif
254 #endif
255
256 /* Suppress unused-variable warnings by "using" E. */
257 #if ! defined lint || defined __GNUC__
258 # define YYUSE(e) ((void) (e))
259 #else
260 # define YYUSE(e) /* empty */
261 #endif
262
263 /* Identity function, used to suppress warnings about constant conditions. */
264 #ifndef lint
265 # define YYID(n) (n)
266 #else
267 #if (defined __STDC__ || defined __C99__FUNC__ \
268 || defined __cplusplus || defined _MSC_VER)
269 static int
YYID(int i)270 YYID (int i)
271 #else
272 static int
273 YYID (i)
274 int i;
275 #endif
276 {
277 return i;
278 }
279 #endif
280
281 #if ! defined yyoverflow || YYERROR_VERBOSE
282
283 /* The parser invokes alloca or malloc; define the necessary symbols. */
284
285 # ifdef YYSTACK_USE_ALLOCA
286 # if YYSTACK_USE_ALLOCA
287 # ifdef __GNUC__
288 # define YYSTACK_ALLOC __builtin_alloca
289 # elif defined __BUILTIN_VA_ARG_INCR
290 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
291 # elif defined _AIX
292 # define YYSTACK_ALLOC __alloca
293 # elif defined _MSC_VER
294 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
295 # define alloca _alloca
296 # else
297 # define YYSTACK_ALLOC alloca
298 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
299 || defined __cplusplus || defined _MSC_VER)
300 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
301 # ifndef _STDLIB_H
302 # define _STDLIB_H 1
303 # endif
304 # endif
305 # endif
306 # endif
307 # endif
308
309 # ifdef YYSTACK_ALLOC
310 /* Pacify GCC's `empty if-body' warning. */
311 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
312 # ifndef YYSTACK_ALLOC_MAXIMUM
313 /* The OS might guarantee only one guard page at the bottom of the stack,
314 and a page size can be as small as 4096 bytes. So we cannot safely
315 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
316 to allow for a few compiler-allocated temporary stack slots. */
317 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
318 # endif
319 # else
320 # define YYSTACK_ALLOC YYMALLOC
321 # define YYSTACK_FREE YYFREE
322 # ifndef YYSTACK_ALLOC_MAXIMUM
323 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
324 # endif
325 # if (defined __cplusplus && ! defined _STDLIB_H \
326 && ! ((defined YYMALLOC || defined malloc) \
327 && (defined YYFREE || defined free)))
328 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
329 # ifndef _STDLIB_H
330 # define _STDLIB_H 1
331 # endif
332 # endif
333 # ifndef YYMALLOC
334 # define YYMALLOC malloc
335 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
336 || defined __cplusplus || defined _MSC_VER)
337 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
338 # endif
339 # endif
340 # ifndef YYFREE
341 # define YYFREE free
342 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
343 || defined __cplusplus || defined _MSC_VER)
344 void free (void *); /* INFRINGES ON USER NAME SPACE */
345 # endif
346 # endif
347 # endif
348 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
349
350
351 #if (! defined yyoverflow \
352 && (! defined __cplusplus \
353 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
354
355 /* A type that is properly aligned for any stack member. */
356 union yyalloc
357 {
358 yytype_int16 yyss;
359 YYSTYPE yyvs;
360 };
361
362 /* The size of the maximum gap between one aligned stack and the next. */
363 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
364
365 /* The size of an array large to enough to hold all stacks, each with
366 N elements. */
367 # define YYSTACK_BYTES(N) \
368 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
369 + YYSTACK_GAP_MAXIMUM)
370
371 /* Copy COUNT objects from FROM to TO. The source and destination do
372 not overlap. */
373 # ifndef YYCOPY
374 # if defined __GNUC__ && 1 < __GNUC__
375 # define YYCOPY(To, From, Count) \
376 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
377 # else
378 # define YYCOPY(To, From, Count) \
379 do \
380 { \
381 YYSIZE_T yyi; \
382 for (yyi = 0; yyi < (Count); yyi++) \
383 (To)[yyi] = (From)[yyi]; \
384 } \
385 while (YYID (0))
386 # endif
387 # endif
388
389 /* Relocate STACK from its old location to the new one. The
390 local variables YYSIZE and YYSTACKSIZE give the old and new number of
391 elements in the stack, and YYPTR gives the new location of the
392 stack. Advance YYPTR to a properly aligned location for the next
393 stack. */
394 # define YYSTACK_RELOCATE(Stack) \
395 do \
396 { \
397 YYSIZE_T yynewbytes; \
398 YYCOPY (&yyptr->Stack, Stack, yysize); \
399 Stack = &yyptr->Stack; \
400 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
401 yyptr += yynewbytes / sizeof (*yyptr); \
402 } \
403 while (YYID (0))
404
405 #endif
406
407 /* YYFINAL -- State number of the termination state. */
408 #define YYFINAL 2
409 /* YYLAST -- Last index in YYTABLE. */
410 #define YYLAST 51
411
412 /* YYNTOKENS -- Number of terminals. */
413 #define YYNTOKENS 22
414 /* YYNNTS -- Number of nonterminals. */
415 #define YYNNTS 20
416 /* YYNRULES -- Number of rules. */
417 #define YYNRULES 33
418 /* YYNRULES -- Number of states. */
419 #define YYNSTATES 59
420
421 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
422 #define YYUNDEFTOK 2
423 #define YYMAXUTOK 276
424
425 #define YYTRANSLATE(YYX) \
426 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
427
428 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
429 static const yytype_uint8 yytranslate[] =
430 {
431 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 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 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, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
457 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
458 15, 16, 17, 18, 19, 20, 21
459 };
460
461 #if YYDEBUG
462 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
463 YYRHS. */
464 static const yytype_uint8 yyprhs[] =
465 {
466 0, 0, 3, 6, 9, 10, 12, 14, 16, 23,
467 27, 35, 37, 39, 43, 47, 50, 51, 57, 60,
468 61, 65, 67, 70, 73, 74, 79, 83, 85, 87,
469 91, 95, 97, 99
470 };
471
472 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
473 static const yytype_int8 yyrhs[] =
474 {
475 23, 0, -1, 23, 24, -1, 23, 28, -1, -1,
476 26, -1, 25, -1, 27, -1, 3, 15, 6, 40,
477 7, 14, -1, 17, 39, 14, -1, 3, 15, 8,
478 31, 33, 9, 14, -1, 29, -1, 30, -1, 18,
479 38, 14, -1, 19, 4, 14, -1, 31, 32, -1,
480 -1, 41, 3, 12, 39, 14, -1, 34, 14, -1,
481 -1, 34, 16, 35, -1, 35, -1, 5, 36, -1,
482 36, 37, -1, -1, 41, 3, 12, 39, -1, 38,
483 13, 39, -1, 39, -1, 3, -1, 10, 39, 11,
484 -1, 40, 13, 3, -1, 3, -1, 20, -1, -1
485 };
486
487 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
488 static const yytype_uint8 yyrline[] =
489 {
490 0, 112, 112, 113, 114, 118, 119, 120, 124, 131,
491 138, 145, 146, 150, 155, 160, 161, 165, 170, 171,
492 175, 177, 182, 186, 187, 191, 196, 197, 201, 202,
493 206, 207, 211, 212
494 };
495 #endif
496
497 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
498 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
499 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
500 static const char *const yytname[] =
501 {
502 "$end", "error", "$undefined", "identifier", "string_literal",
503 "constructor", "left_brace", "right_brace", "left_parenthesis",
504 "right_parenthesis", "left_square", "right_square", "colon", "comma",
505 "semicolon", "equals", "choice", "grtr", "question_mark", "plus",
506 "minus", "lex_error_token", "$accept", "rules", "declaration",
507 "enumeration_declaration", "primitive_declaration", "record_declaration",
508 "statement", "use_statement", "import_statement", "field_sequence",
509 "field", "variant_fields_option", "variant_fields", "variant_field",
510 "field_parts", "field_part", "type_list", "type", "identifier_list",
511 "traversal_option", 0
512 };
513 #endif
514
515 # ifdef YYPRINT
516 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
517 token YYLEX-NUM. */
518 static const yytype_uint16 yytoknum[] =
519 {
520 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
521 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
522 275, 276
523 };
524 # endif
525
526 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
527 static const yytype_uint8 yyr1[] =
528 {
529 0, 22, 23, 23, 23, 24, 24, 24, 25, 26,
530 27, 28, 28, 29, 30, 31, 31, 32, 33, 33,
531 34, 34, 35, 36, 36, 37, 38, 38, 39, 39,
532 40, 40, 41, 41
533 };
534
535 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
536 static const yytype_uint8 yyr2[] =
537 {
538 0, 2, 2, 2, 0, 1, 1, 1, 6, 3,
539 7, 1, 1, 3, 3, 2, 0, 5, 2, 0,
540 3, 1, 2, 2, 0, 4, 3, 1, 1, 3,
541 3, 1, 1, 0
542 };
543
544 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
545 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
546 means the default is an error. */
547 static const yytype_uint8 yydefact[] =
548 {
549 4, 0, 1, 0, 0, 0, 0, 2, 6, 5,
550 7, 3, 11, 12, 0, 28, 0, 0, 0, 27,
551 0, 0, 16, 0, 9, 0, 13, 14, 31, 0,
552 19, 29, 26, 0, 0, 24, 32, 15, 0, 0,
553 21, 0, 8, 30, 22, 0, 18, 0, 0, 23,
554 0, 10, 20, 0, 0, 0, 0, 17, 25
555 };
556
557 /* YYDEFGOTO[NTERM-NUM]. */
558 static const yytype_int8 yydefgoto[] =
559 {
560 -1, 1, 7, 8, 9, 10, 11, 12, 13, 30,
561 37, 38, 39, 40, 44, 49, 18, 17, 29, 41
562 };
563
564 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
565 STATE-NUM. */
566 #define YYPACT_NINF -12
567 static const yytype_int8 yypact[] =
568 {
569 -12, 4, -12, -9, 2, 2, 12, -12, -12, -12,
570 -12, -12, -12, -12, 7, -12, 2, 3, -4, -12,
571 11, 24, -12, 17, -12, 2, -12, -12, -12, 1,
572 -2, -12, -12, 15, 27, -12, -12, -12, 22, 10,
573 -12, 29, -12, -12, -1, 19, -12, 30, 25, -12,
574 31, -12, -12, 2, 26, 28, 2, -12, -12
575 };
576
577 /* YYPGOTO[NTERM-NUM]. */
578 static const yytype_int8 yypgoto[] =
579 {
580 -12, -12, -12, -12, -12, -12, -12, -12, -12, -12,
581 -12, -12, -12, -11, -12, -12, -12, -5, -12, -3
582 };
583
584 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
585 positive, shift that token. If negative, reduce the rule which
586 number is the opposite. If zero, do what YYDEFACT says.
587 If YYTABLE_NINF, syntax error. */
588 #define YYTABLE_NINF -34
589 static const yytype_int8 yytable[] =
590 {
591 19, -33, -33, 35, 2, 15, 14, 3, 33, 25,
592 26, 23, 16, 21, 34, 22, 20, 24, 36, 36,
593 32, 4, 5, 6, 46, 27, 47, 28, 31, 42,
594 43, 45, 48, 51, 54, 35, 52, 53, 56, 0,
595 0, 50, 57, 0, 0, 0, 0, 0, 55, 0,
596 0, 58
597 };
598
599 static const yytype_int8 yycheck[] =
600 {
601 5, 3, 3, 5, 0, 3, 15, 3, 7, 13,
602 14, 16, 10, 6, 13, 8, 4, 14, 20, 20,
603 25, 17, 18, 19, 14, 14, 16, 3, 11, 14,
604 3, 9, 3, 14, 3, 5, 47, 12, 12, -1,
605 -1, 44, 14, -1, -1, -1, -1, -1, 53, -1,
606 -1, 56
607 };
608
609 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
610 symbol of state STATE-NUM. */
611 static const yytype_uint8 yystos[] =
612 {
613 0, 23, 0, 3, 17, 18, 19, 24, 25, 26,
614 27, 28, 29, 30, 15, 3, 10, 39, 38, 39,
615 4, 6, 8, 39, 14, 13, 14, 14, 3, 40,
616 31, 11, 39, 7, 13, 5, 20, 32, 33, 34,
617 35, 41, 14, 3, 36, 9, 14, 16, 3, 37,
618 41, 14, 35, 12, 3, 39, 12, 14, 39
619 };
620
621 #define yyerrok (yyerrstatus = 0)
622 #define yyclearin (yychar = YYEMPTY)
623 #define YYEMPTY (-2)
624 #define YYEOF 0
625
626 #define YYACCEPT goto yyacceptlab
627 #define YYABORT goto yyabortlab
628 #define YYERROR goto yyerrorlab
629
630
631 /* Like YYERROR except do call yyerror. This remains here temporarily
632 to ease the transition to the new meaning of YYERROR, for GCC.
633 Once GCC version 2 has supplanted version 1, this can go. */
634
635 #define YYFAIL goto yyerrlab
636
637 #define YYRECOVERING() (!!yyerrstatus)
638
639 #define YYBACKUP(Token, Value) \
640 do \
641 if (yychar == YYEMPTY && yylen == 1) \
642 { \
643 yychar = (Token); \
644 yylval = (Value); \
645 yytoken = YYTRANSLATE (yychar); \
646 YYPOPSTACK (1); \
647 goto yybackup; \
648 } \
649 else \
650 { \
651 yyerror (YY_("syntax error: cannot back up")); \
652 YYERROR; \
653 } \
654 while (YYID (0))
655
656
657 #define YYTERROR 1
658 #define YYERRCODE 256
659
660
661 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
662 If N is 0, then set CURRENT to the empty location which ends
663 the previous symbol: RHS[0] (always defined). */
664
665 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
666 #ifndef YYLLOC_DEFAULT
667 # define YYLLOC_DEFAULT(Current, Rhs, N) \
668 do \
669 if (YYID (N)) \
670 { \
671 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
672 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
673 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
674 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
675 } \
676 else \
677 { \
678 (Current).first_line = (Current).last_line = \
679 YYRHSLOC (Rhs, 0).last_line; \
680 (Current).first_column = (Current).last_column = \
681 YYRHSLOC (Rhs, 0).last_column; \
682 } \
683 while (YYID (0))
684 #endif
685
686
687 /* YY_LOCATION_PRINT -- Print the location on the stream.
688 This macro was not mandated originally: define only if we know
689 we won't break user code: when these are the locations we know. */
690
691 #ifndef YY_LOCATION_PRINT
692 # if YYLTYPE_IS_TRIVIAL
693 # define YY_LOCATION_PRINT(File, Loc) \
694 fprintf (File, "%d.%d-%d.%d", \
695 (Loc).first_line, (Loc).first_column, \
696 (Loc).last_line, (Loc).last_column)
697 # else
698 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
699 # endif
700 #endif
701
702
703 /* YYLEX -- calling `yylex' with the right arguments. */
704
705 #ifdef YYLEX_PARAM
706 # define YYLEX yylex (YYLEX_PARAM)
707 #else
708 # define YYLEX yylex ()
709 #endif
710
711 /* Enable debugging if requested. */
712 #if YYDEBUG
713
714 # ifndef YYFPRINTF
715 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
716 # define YYFPRINTF fprintf
717 # endif
718
719 # define YYDPRINTF(Args) \
720 do { \
721 if (yydebug) \
722 YYFPRINTF Args; \
723 } while (YYID (0))
724
725 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
726 do { \
727 if (yydebug) \
728 { \
729 YYFPRINTF (stderr, "%s ", Title); \
730 yy_symbol_print (stderr, \
731 Type, Value); \
732 YYFPRINTF (stderr, "\n"); \
733 } \
734 } while (YYID (0))
735
736
737 /*--------------------------------.
738 | Print this symbol on YYOUTPUT. |
739 `--------------------------------*/
740
741 /*ARGSUSED*/
742 #if (defined __STDC__ || defined __C99__FUNC__ \
743 || defined __cplusplus || defined _MSC_VER)
744 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)745 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
746 #else
747 static void
748 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
749 FILE *yyoutput;
750 int yytype;
751 YYSTYPE const * const yyvaluep;
752 #endif
753 {
754 if (!yyvaluep)
755 return;
756 # ifdef YYPRINT
757 if (yytype < YYNTOKENS)
758 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
759 # else
760 YYUSE (yyoutput);
761 # endif
762 switch (yytype)
763 {
764 default:
765 break;
766 }
767 }
768
769
770 /*--------------------------------.
771 | Print this symbol on YYOUTPUT. |
772 `--------------------------------*/
773
774 #if (defined __STDC__ || defined __C99__FUNC__ \
775 || defined __cplusplus || defined _MSC_VER)
776 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)777 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
778 #else
779 static void
780 yy_symbol_print (yyoutput, yytype, yyvaluep)
781 FILE *yyoutput;
782 int yytype;
783 YYSTYPE const * const yyvaluep;
784 #endif
785 {
786 if (yytype < YYNTOKENS)
787 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
788 else
789 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
790
791 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
792 YYFPRINTF (yyoutput, ")");
793 }
794
795 /*------------------------------------------------------------------.
796 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
797 | TOP (included). |
798 `------------------------------------------------------------------*/
799
800 #if (defined __STDC__ || defined __C99__FUNC__ \
801 || defined __cplusplus || defined _MSC_VER)
802 static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)803 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
804 #else
805 static void
806 yy_stack_print (bottom, top)
807 yytype_int16 *bottom;
808 yytype_int16 *top;
809 #endif
810 {
811 YYFPRINTF (stderr, "Stack now");
812 for (; bottom <= top; ++bottom)
813 YYFPRINTF (stderr, " %d", *bottom);
814 YYFPRINTF (stderr, "\n");
815 }
816
817 # define YY_STACK_PRINT(Bottom, Top) \
818 do { \
819 if (yydebug) \
820 yy_stack_print ((Bottom), (Top)); \
821 } while (YYID (0))
822
823
824 /*------------------------------------------------.
825 | Report that the YYRULE is going to be reduced. |
826 `------------------------------------------------*/
827
828 #if (defined __STDC__ || defined __C99__FUNC__ \
829 || defined __cplusplus || defined _MSC_VER)
830 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)831 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
832 #else
833 static void
834 yy_reduce_print (yyvsp, yyrule)
835 YYSTYPE *yyvsp;
836 int yyrule;
837 #endif
838 {
839 int yynrhs = yyr2[yyrule];
840 int yyi;
841 unsigned long int yylno = yyrline[yyrule];
842 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
843 yyrule - 1, yylno);
844 /* The symbols being reduced. */
845 for (yyi = 0; yyi < yynrhs; yyi++)
846 {
847 fprintf (stderr, " $%d = ", yyi + 1);
848 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
849 &(yyvsp[(yyi + 1) - (yynrhs)])
850 );
851 fprintf (stderr, "\n");
852 }
853 }
854
855 # define YY_REDUCE_PRINT(Rule) \
856 do { \
857 if (yydebug) \
858 yy_reduce_print (yyvsp, Rule); \
859 } while (YYID (0))
860
861 /* Nonzero means print parse trace. It is left uninitialized so that
862 multiple parsers can coexist. */
863 int yydebug;
864 #else /* !YYDEBUG */
865 # define YYDPRINTF(Args)
866 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
867 # define YY_STACK_PRINT(Bottom, Top)
868 # define YY_REDUCE_PRINT(Rule)
869 #endif /* !YYDEBUG */
870
871
872 /* YYINITDEPTH -- initial size of the parser's stacks. */
873 #ifndef YYINITDEPTH
874 # define YYINITDEPTH 200
875 #endif
876
877 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
878 if the built-in stack extension method is used).
879
880 Do not make this value too large; the results are undefined if
881 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
882 evaluated with infinite-precision integer arithmetic. */
883
884 #ifndef YYMAXDEPTH
885 # define YYMAXDEPTH 10000
886 #endif
887
888
889
890 #if YYERROR_VERBOSE
891
892 # ifndef yystrlen
893 # if defined __GLIBC__ && defined _STRING_H
894 # define yystrlen strlen
895 # else
896 /* Return the length of YYSTR. */
897 #if (defined __STDC__ || defined __C99__FUNC__ \
898 || defined __cplusplus || defined _MSC_VER)
899 static YYSIZE_T
yystrlen(const char * yystr)900 yystrlen (const char *yystr)
901 #else
902 static YYSIZE_T
903 yystrlen (yystr)
904 const char *yystr;
905 #endif
906 {
907 YYSIZE_T yylen;
908 for (yylen = 0; yystr[yylen]; yylen++)
909 continue;
910 return yylen;
911 }
912 # endif
913 # endif
914
915 # ifndef yystpcpy
916 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
917 # define yystpcpy stpcpy
918 # else
919 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
920 YYDEST. */
921 #if (defined __STDC__ || defined __C99__FUNC__ \
922 || defined __cplusplus || defined _MSC_VER)
923 static char *
yystpcpy(char * yydest,const char * yysrc)924 yystpcpy (char *yydest, const char *yysrc)
925 #else
926 static char *
927 yystpcpy (yydest, yysrc)
928 char *yydest;
929 const char *yysrc;
930 #endif
931 {
932 char *yyd = yydest;
933 const char *yys = yysrc;
934
935 while ((*yyd++ = *yys++) != '\0')
936 continue;
937
938 return yyd - 1;
939 }
940 # endif
941 # endif
942
943 # ifndef yytnamerr
944 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
945 quotes and backslashes, so that it's suitable for yyerror. The
946 heuristic is that double-quoting is unnecessary unless the string
947 contains an apostrophe, a comma, or backslash (other than
948 backslash-backslash). YYSTR is taken from yytname. If YYRES is
949 null, do not copy; instead, return the length of what the result
950 would have been. */
951 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)952 yytnamerr (char *yyres, const char *yystr)
953 {
954 if (*yystr == '"')
955 {
956 YYSIZE_T yyn = 0;
957 char const *yyp = yystr;
958
959 for (;;)
960 switch (*++yyp)
961 {
962 case '\'':
963 case ',':
964 goto do_not_strip_quotes;
965
966 case '\\':
967 if (*++yyp != '\\')
968 goto do_not_strip_quotes;
969 /* Fall through. */
970 default:
971 if (yyres)
972 yyres[yyn] = *yyp;
973 yyn++;
974 break;
975
976 case '"':
977 if (yyres)
978 yyres[yyn] = '\0';
979 return yyn;
980 }
981 do_not_strip_quotes: ;
982 }
983
984 if (! yyres)
985 return yystrlen (yystr);
986
987 return yystpcpy (yyres, yystr) - yyres;
988 }
989 # endif
990
991 /* Copy into YYRESULT an error message about the unexpected token
992 YYCHAR while in state YYSTATE. Return the number of bytes copied,
993 including the terminating null byte. If YYRESULT is null, do not
994 copy anything; just return the number of bytes that would be
995 copied. As a special case, return 0 if an ordinary "syntax error"
996 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
997 size calculation. */
998 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)999 yysyntax_error (char *yyresult, int yystate, int yychar)
1000 {
1001 int yyn = yypact[yystate];
1002
1003 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1004 return 0;
1005 else
1006 {
1007 int yytype = YYTRANSLATE (yychar);
1008 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1009 YYSIZE_T yysize = yysize0;
1010 YYSIZE_T yysize1;
1011 int yysize_overflow = 0;
1012 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1013 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1014 int yyx;
1015
1016 # if 0
1017 /* This is so xgettext sees the translatable formats that are
1018 constructed on the fly. */
1019 YY_("syntax error, unexpected %s");
1020 YY_("syntax error, unexpected %s, expecting %s");
1021 YY_("syntax error, unexpected %s, expecting %s or %s");
1022 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1023 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1024 # endif
1025 char *yyfmt;
1026 char const *yyf;
1027 static char const yyunexpected[] = "syntax error, unexpected %s";
1028 static char const yyexpecting[] = ", expecting %s";
1029 static char const yyor[] = " or %s";
1030 char yyformat[sizeof yyunexpected
1031 + sizeof yyexpecting - 1
1032 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1033 * (sizeof yyor - 1))];
1034 char const *yyprefix = yyexpecting;
1035
1036 /* Start YYX at -YYN if negative to avoid negative indexes in
1037 YYCHECK. */
1038 int yyxbegin = yyn < 0 ? -yyn : 0;
1039
1040 /* Stay within bounds of both yycheck and yytname. */
1041 int yychecklim = YYLAST - yyn + 1;
1042 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1043 int yycount = 1;
1044
1045 yyarg[0] = yytname[yytype];
1046 yyfmt = yystpcpy (yyformat, yyunexpected);
1047
1048 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1049 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1050 {
1051 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1052 {
1053 yycount = 1;
1054 yysize = yysize0;
1055 yyformat[sizeof yyunexpected - 1] = '\0';
1056 break;
1057 }
1058 yyarg[yycount++] = yytname[yyx];
1059 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1060 yysize_overflow |= (yysize1 < yysize);
1061 yysize = yysize1;
1062 yyfmt = yystpcpy (yyfmt, yyprefix);
1063 yyprefix = yyor;
1064 }
1065
1066 yyf = YY_(yyformat);
1067 yysize1 = yysize + yystrlen (yyf);
1068 yysize_overflow |= (yysize1 < yysize);
1069 yysize = yysize1;
1070
1071 if (yysize_overflow)
1072 return YYSIZE_MAXIMUM;
1073
1074 if (yyresult)
1075 {
1076 /* Avoid sprintf, as that infringes on the user's name space.
1077 Don't have undefined behavior even if the translation
1078 produced a string with the wrong number of "%s"s. */
1079 char *yyp = yyresult;
1080 int yyi = 0;
1081 while ((*yyp = *yyf) != '\0')
1082 {
1083 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1084 {
1085 yyp += yytnamerr (yyp, yyarg[yyi++]);
1086 yyf += 2;
1087 }
1088 else
1089 {
1090 yyp++;
1091 yyf++;
1092 }
1093 }
1094 }
1095 return yysize;
1096 }
1097 }
1098 #endif /* YYERROR_VERBOSE */
1099
1100
1101 /*-----------------------------------------------.
1102 | Release the memory associated to this symbol. |
1103 `-----------------------------------------------*/
1104
1105 /*ARGSUSED*/
1106 #if (defined __STDC__ || defined __C99__FUNC__ \
1107 || defined __cplusplus || defined _MSC_VER)
1108 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1109 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1110 #else
1111 static void
1112 yydestruct (yymsg, yytype, yyvaluep)
1113 const char *yymsg;
1114 int yytype;
1115 YYSTYPE *yyvaluep;
1116 #endif
1117 {
1118 YYUSE (yyvaluep);
1119
1120 if (!yymsg)
1121 yymsg = "Deleting";
1122 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1123
1124 switch (yytype)
1125 {
1126
1127 default:
1128 break;
1129 }
1130 }
1131
1132
1133 /* Prevent warnings from -Wmissing-prototypes. */
1134
1135 #ifdef YYPARSE_PARAM
1136 #if defined __STDC__ || defined __cplusplus
1137 int yyparse (void *YYPARSE_PARAM);
1138 #else
1139 int yyparse ();
1140 #endif
1141 #else /* ! YYPARSE_PARAM */
1142 #if defined __STDC__ || defined __cplusplus
1143 int yyparse (void);
1144 #else
1145 int yyparse ();
1146 #endif
1147 #endif /* ! YYPARSE_PARAM */
1148
1149
1150
1151 /* The look-ahead symbol. */
1152 int yychar;
1153
1154 /* The semantic value of the look-ahead symbol. */
1155 YYSTYPE yylval;
1156
1157 /* Number of syntax errors so far. */
1158 int yynerrs;
1159
1160
1161
1162 /*----------.
1163 | yyparse. |
1164 `----------*/
1165
1166 #ifdef YYPARSE_PARAM
1167 #if (defined __STDC__ || defined __C99__FUNC__ \
1168 || defined __cplusplus || defined _MSC_VER)
1169 int
yyparse(void * YYPARSE_PARAM)1170 yyparse (void *YYPARSE_PARAM)
1171 #else
1172 int
1173 yyparse (YYPARSE_PARAM)
1174 void *YYPARSE_PARAM;
1175 #endif
1176 #else /* ! YYPARSE_PARAM */
1177 #if (defined __STDC__ || defined __C99__FUNC__ \
1178 || defined __cplusplus || defined _MSC_VER)
1179 int
1180 yyparse (void)
1181 #else
1182 int
1183 yyparse ()
1184
1185 #endif
1186 #endif
1187 {
1188
1189 int yystate;
1190 int yyn;
1191 int yyresult;
1192 /* Number of tokens to shift before error messages enabled. */
1193 int yyerrstatus;
1194 /* Look-ahead token as an internal (translated) token number. */
1195 int yytoken = 0;
1196 #if YYERROR_VERBOSE
1197 /* Buffer for error messages, and its allocated size. */
1198 char yymsgbuf[128];
1199 char *yymsg = yymsgbuf;
1200 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1201 #endif
1202
1203 /* Three stacks and their tools:
1204 `yyss': related to states,
1205 `yyvs': related to semantic values,
1206 `yyls': related to locations.
1207
1208 Refer to the stacks thru separate pointers, to allow yyoverflow
1209 to reallocate them elsewhere. */
1210
1211 /* The state stack. */
1212 yytype_int16 yyssa[YYINITDEPTH];
1213 yytype_int16 *yyss = yyssa;
1214 yytype_int16 *yyssp;
1215
1216 /* The semantic value stack. */
1217 YYSTYPE yyvsa[YYINITDEPTH];
1218 YYSTYPE *yyvs = yyvsa;
1219 YYSTYPE *yyvsp;
1220
1221
1222
1223 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1224
1225 YYSIZE_T yystacksize = YYINITDEPTH;
1226
1227 /* The variables used to return semantic value and location from the
1228 action routines. */
1229 YYSTYPE yyval;
1230
1231
1232 /* The number of symbols on the RHS of the reduced rule.
1233 Keep to zero when no symbol should be popped. */
1234 int yylen = 0;
1235
1236 YYDPRINTF ((stderr, "Starting parse\n"));
1237
1238 yystate = 0;
1239 yyerrstatus = 0;
1240 yynerrs = 0;
1241 yychar = YYEMPTY; /* Cause a token to be read. */
1242
1243 /* Initialize stack pointers.
1244 Waste one element of value and location stack
1245 so that they stay on the same level as the state stack.
1246 The wasted elements are never initialized. */
1247
1248 yyssp = yyss;
1249 yyvsp = yyvs;
1250
1251 goto yysetstate;
1252
1253 /*------------------------------------------------------------.
1254 | yynewstate -- Push a new state, which is found in yystate. |
1255 `------------------------------------------------------------*/
1256 yynewstate:
1257 /* In all cases, when you get here, the value and location stacks
1258 have just been pushed. So pushing a state here evens the stacks. */
1259 yyssp++;
1260
1261 yysetstate:
1262 *yyssp = yystate;
1263
1264 if (yyss + yystacksize - 1 <= yyssp)
1265 {
1266 /* Get the current used size of the three stacks, in elements. */
1267 YYSIZE_T yysize = yyssp - yyss + 1;
1268
1269 #ifdef yyoverflow
1270 {
1271 /* Give user a chance to reallocate the stack. Use copies of
1272 these so that the &'s don't force the real ones into
1273 memory. */
1274 YYSTYPE *yyvs1 = yyvs;
1275 yytype_int16 *yyss1 = yyss;
1276
1277
1278 /* Each stack pointer address is followed by the size of the
1279 data in use in that stack, in bytes. This used to be a
1280 conditional around just the two extra args, but that might
1281 be undefined if yyoverflow is a macro. */
1282 yyoverflow (YY_("memory exhausted"),
1283 &yyss1, yysize * sizeof (*yyssp),
1284 &yyvs1, yysize * sizeof (*yyvsp),
1285
1286 &yystacksize);
1287
1288 yyss = yyss1;
1289 yyvs = yyvs1;
1290 }
1291 #else /* no yyoverflow */
1292 # ifndef YYSTACK_RELOCATE
1293 goto yyexhaustedlab;
1294 # else
1295 /* Extend the stack our own way. */
1296 if (YYMAXDEPTH <= yystacksize)
1297 goto yyexhaustedlab;
1298 yystacksize *= 2;
1299 if (YYMAXDEPTH < yystacksize)
1300 yystacksize = YYMAXDEPTH;
1301
1302 {
1303 yytype_int16 *yyss1 = yyss;
1304 union yyalloc *yyptr =
1305 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1306 if (! yyptr)
1307 goto yyexhaustedlab;
1308 YYSTACK_RELOCATE (yyss);
1309 YYSTACK_RELOCATE (yyvs);
1310
1311 # undef YYSTACK_RELOCATE
1312 if (yyss1 != yyssa)
1313 YYSTACK_FREE (yyss1);
1314 }
1315 # endif
1316 #endif /* no yyoverflow */
1317
1318 yyssp = yyss + yysize - 1;
1319 yyvsp = yyvs + yysize - 1;
1320
1321
1322 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1323 (unsigned long int) yystacksize));
1324
1325 if (yyss + yystacksize - 1 <= yyssp)
1326 YYABORT;
1327 }
1328
1329 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1330
1331 goto yybackup;
1332
1333 /*-----------.
1334 | yybackup. |
1335 `-----------*/
1336 yybackup:
1337
1338 /* Do appropriate processing given the current state. Read a
1339 look-ahead token if we need one and don't already have one. */
1340
1341 /* First try to decide what to do without reference to look-ahead token. */
1342 yyn = yypact[yystate];
1343 if (yyn == YYPACT_NINF)
1344 goto yydefault;
1345
1346 /* Not known => get a look-ahead token if don't already have one. */
1347
1348 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1349 if (yychar == YYEMPTY)
1350 {
1351 YYDPRINTF ((stderr, "Reading a token: "));
1352 yychar = YYLEX;
1353 }
1354
1355 if (yychar <= YYEOF)
1356 {
1357 yychar = yytoken = YYEOF;
1358 YYDPRINTF ((stderr, "Now at end of input.\n"));
1359 }
1360 else
1361 {
1362 yytoken = YYTRANSLATE (yychar);
1363 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1364 }
1365
1366 /* If the proper action on seeing token YYTOKEN is to reduce or to
1367 detect an error, take that action. */
1368 yyn += yytoken;
1369 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1370 goto yydefault;
1371 yyn = yytable[yyn];
1372 if (yyn <= 0)
1373 {
1374 if (yyn == 0 || yyn == YYTABLE_NINF)
1375 goto yyerrlab;
1376 yyn = -yyn;
1377 goto yyreduce;
1378 }
1379
1380 if (yyn == YYFINAL)
1381 YYACCEPT;
1382
1383 /* Count tokens shifted since error; after three, turn off error
1384 status. */
1385 if (yyerrstatus)
1386 yyerrstatus--;
1387
1388 /* Shift the look-ahead token. */
1389 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1390
1391 /* Discard the shifted token unless it is eof. */
1392 if (yychar != YYEOF)
1393 yychar = YYEMPTY;
1394
1395 yystate = yyn;
1396 *++yyvsp = yylval;
1397
1398 goto yynewstate;
1399
1400
1401 /*-----------------------------------------------------------.
1402 | yydefault -- do the default action for the current state. |
1403 `-----------------------------------------------------------*/
1404 yydefault:
1405 yyn = yydefact[yystate];
1406 if (yyn == 0)
1407 goto yyerrlab;
1408 goto yyreduce;
1409
1410
1411 /*-----------------------------.
1412 | yyreduce -- Do a reduction. |
1413 `-----------------------------*/
1414 yyreduce:
1415 /* yyn is the number of a rule to reduce with. */
1416 yylen = yyr2[yyn];
1417
1418 /* If YYLEN is nonzero, implement the default value of the action:
1419 `$$ = $1'.
1420
1421 Otherwise, the following line sets YYVAL to garbage.
1422 This behavior is undocumented and Bison
1423 users should not rely upon it. Assigning to YYVAL
1424 unconditionally makes the parser a bit smaller, and it avoids a
1425 GCC warning that YYVAL may be used uninitialized. */
1426 yyval = yyvsp[1-yylen];
1427
1428
1429 YY_REDUCE_PRINT (yyn);
1430 switch (yyn)
1431 {
1432 case 8:
1433 #line 127 "dcg_parser.y"
1434 { app_def_list (all_defs, new_Enum ((yyvsp[(1) - (6)].string),(yyvsp[(4) - (6)].string_list))) ;}
1435 break;
1436
1437 case 9:
1438 #line 132 "dcg_parser.y"
1439 { app_type_list (imp_types, (yyvsp[(2) - (3)].type));
1440 if ((yyvsp[(2) - (3)].type) -> tag == TAGTname)
1441 app_def_list (all_defs, new_Primitive ((yyvsp[(2) - (3)].type) -> Tname.tname)) ;}
1442 break;
1443
1444 case 10:
1445 #line 141 "dcg_parser.y"
1446 { app_def_list (all_defs, new_Record ((yyvsp[(1) - (7)].string),(yyvsp[(4) - (7)].field_list),(yyvsp[(5) - (7)].vfield_list))) ;}
1447 break;
1448
1449 case 13:
1450 #line 151 "dcg_parser.y"
1451 { app_stat_list (all_stats, new_Use ((yyvsp[(2) - (3)].type_list))) ;}
1452 break;
1453
1454 case 14:
1455 #line 156 "dcg_parser.y"
1456 { app_stat_list (all_stats, new_Import ((yyvsp[(2) - (3)].string))) ;}
1457 break;
1458
1459 case 15:
1460 #line 160 "dcg_parser.y"
1461 { (yyval.field_list) = append_field_list ((yyvsp[(1) - (2)].field_list),(yyvsp[(2) - (2)].field)) ;}
1462 break;
1463
1464 case 16:
1465 #line 161 "dcg_parser.y"
1466 { (yyval.field_list) = new_field_list () ;}
1467 break;
1468
1469 case 17:
1470 #line 166 "dcg_parser.y"
1471 { (yyval.field) = new_field ((yyvsp[(2) - (5)].string),(yyvsp[(4) - (5)].type),(yyvsp[(1) - (5)].value)) ;}
1472 break;
1473
1474 case 18:
1475 #line 170 "dcg_parser.y"
1476 { (yyval.vfield_list) = (yyvsp[(1) - (2)].vfield_list) ;}
1477 break;
1478
1479 case 19:
1480 #line 171 "dcg_parser.y"
1481 { (yyval.vfield_list) = new_vfield_list () ;}
1482 break;
1483
1484 case 20:
1485 #line 176 "dcg_parser.y"
1486 { (yyval.vfield_list) = append_vfield_list ((yyvsp[(1) - (3)].vfield_list),(yyvsp[(3) - (3)].vfield)) ;}
1487 break;
1488
1489 case 21:
1490 #line 178 "dcg_parser.y"
1491 { (yyval.vfield_list) = new_vfield_list (); app_vfield_list ((yyval.vfield_list),(yyvsp[(1) - (1)].vfield)) ;}
1492 break;
1493
1494 case 22:
1495 #line 182 "dcg_parser.y"
1496 { (yyval.vfield) = new_vfield ((yyvsp[(1) - (2)].string),(yyvsp[(2) - (2)].field_list)) ;}
1497 break;
1498
1499 case 23:
1500 #line 186 "dcg_parser.y"
1501 { (yyval.field_list) = append_field_list ((yyvsp[(1) - (2)].field_list),(yyvsp[(2) - (2)].field)) ;}
1502 break;
1503
1504 case 24:
1505 #line 187 "dcg_parser.y"
1506 { (yyval.field_list) = new_field_list () ;}
1507 break;
1508
1509 case 25:
1510 #line 192 "dcg_parser.y"
1511 { (yyval.field) = new_field ((yyvsp[(2) - (4)].string),(yyvsp[(4) - (4)].type),(yyvsp[(1) - (4)].value)) ;}
1512 break;
1513
1514 case 26:
1515 #line 196 "dcg_parser.y"
1516 { (yyval.type_list) = append_type_list ((yyvsp[(1) - (3)].type_list), (yyvsp[(3) - (3)].type)) ;}
1517 break;
1518
1519 case 27:
1520 #line 197 "dcg_parser.y"
1521 { (yyval.type_list) = new_type_list (); app_type_list ((yyval.type_list), (yyvsp[(1) - (1)].type)) ;}
1522 break;
1523
1524 case 28:
1525 #line 201 "dcg_parser.y"
1526 { (yyval.type) = new_Tname ((yyvsp[(1) - (1)].string)) ;}
1527 break;
1528
1529 case 29:
1530 #line 202 "dcg_parser.y"
1531 { (yyval.type) = new_Tlist ((yyvsp[(2) - (3)].type)) ;}
1532 break;
1533
1534 case 30:
1535 #line 206 "dcg_parser.y"
1536 { (yyval.string_list) = append_string_list ((yyvsp[(1) - (3)].string_list), (yyvsp[(3) - (3)].string)) ;}
1537 break;
1538
1539 case 31:
1540 #line 207 "dcg_parser.y"
1541 { (yyval.string_list) = new_string_list (); app_string_list ((yyval.string_list), (yyvsp[(1) - (1)].string)) ;}
1542 break;
1543
1544 case 32:
1545 #line 211 "dcg_parser.y"
1546 { (yyval.value) = 0 ;}
1547 break;
1548
1549 case 33:
1550 #line 212 "dcg_parser.y"
1551 { (yyval.value) = 1 ;}
1552 break;
1553
1554
1555 /* Line 1267 of yacc.c. */
1556 #line 1557 "dcg_parser.c"
1557 default: break;
1558 }
1559 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1560
1561 YYPOPSTACK (yylen);
1562 yylen = 0;
1563 YY_STACK_PRINT (yyss, yyssp);
1564
1565 *++yyvsp = yyval;
1566
1567
1568 /* Now `shift' the result of the reduction. Determine what state
1569 that goes to, based on the state we popped back to and the rule
1570 number reduced by. */
1571
1572 yyn = yyr1[yyn];
1573
1574 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1575 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1576 yystate = yytable[yystate];
1577 else
1578 yystate = yydefgoto[yyn - YYNTOKENS];
1579
1580 goto yynewstate;
1581
1582
1583 /*------------------------------------.
1584 | yyerrlab -- here on detecting error |
1585 `------------------------------------*/
1586 yyerrlab:
1587 /* If not already recovering from an error, report this error. */
1588 if (!yyerrstatus)
1589 {
1590 ++yynerrs;
1591 #if ! YYERROR_VERBOSE
1592 yyerror (YY_("syntax error"));
1593 #else
1594 {
1595 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1596 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1597 {
1598 YYSIZE_T yyalloc = 2 * yysize;
1599 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1600 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1601 if (yymsg != yymsgbuf)
1602 YYSTACK_FREE (yymsg);
1603 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1604 if (yymsg)
1605 yymsg_alloc = yyalloc;
1606 else
1607 {
1608 yymsg = yymsgbuf;
1609 yymsg_alloc = sizeof yymsgbuf;
1610 }
1611 }
1612
1613 if (0 < yysize && yysize <= yymsg_alloc)
1614 {
1615 (void) yysyntax_error (yymsg, yystate, yychar);
1616 yyerror (yymsg);
1617 }
1618 else
1619 {
1620 yyerror (YY_("syntax error"));
1621 if (yysize != 0)
1622 goto yyexhaustedlab;
1623 }
1624 }
1625 #endif
1626 }
1627
1628
1629
1630 if (yyerrstatus == 3)
1631 {
1632 /* If just tried and failed to reuse look-ahead token after an
1633 error, discard it. */
1634
1635 if (yychar <= YYEOF)
1636 {
1637 /* Return failure if at end of input. */
1638 if (yychar == YYEOF)
1639 YYABORT;
1640 }
1641 else
1642 {
1643 yydestruct ("Error: discarding",
1644 yytoken, &yylval);
1645 yychar = YYEMPTY;
1646 }
1647 }
1648
1649 /* Else will try to reuse look-ahead token after shifting the error
1650 token. */
1651 goto yyerrlab1;
1652
1653
1654 /*---------------------------------------------------.
1655 | yyerrorlab -- error raised explicitly by YYERROR. |
1656 `---------------------------------------------------*/
1657 yyerrorlab:
1658
1659 /* Pacify compilers like GCC when the user code never invokes
1660 YYERROR and the label yyerrorlab therefore never appears in user
1661 code. */
1662 if (/*CONSTCOND*/ 0)
1663 goto yyerrorlab;
1664
1665 /* Do not reclaim the symbols of the rule which action triggered
1666 this YYERROR. */
1667 YYPOPSTACK (yylen);
1668 yylen = 0;
1669 YY_STACK_PRINT (yyss, yyssp);
1670 yystate = *yyssp;
1671 goto yyerrlab1;
1672
1673
1674 /*-------------------------------------------------------------.
1675 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1676 `-------------------------------------------------------------*/
1677 yyerrlab1:
1678 yyerrstatus = 3; /* Each real token shifted decrements this. */
1679
1680 for (;;)
1681 {
1682 yyn = yypact[yystate];
1683 if (yyn != YYPACT_NINF)
1684 {
1685 yyn += YYTERROR;
1686 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1687 {
1688 yyn = yytable[yyn];
1689 if (0 < yyn)
1690 break;
1691 }
1692 }
1693
1694 /* Pop the current state because it cannot handle the error token. */
1695 if (yyssp == yyss)
1696 YYABORT;
1697
1698
1699 yydestruct ("Error: popping",
1700 yystos[yystate], yyvsp);
1701 YYPOPSTACK (1);
1702 yystate = *yyssp;
1703 YY_STACK_PRINT (yyss, yyssp);
1704 }
1705
1706 if (yyn == YYFINAL)
1707 YYACCEPT;
1708
1709 *++yyvsp = yylval;
1710
1711
1712 /* Shift the error token. */
1713 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1714
1715 yystate = yyn;
1716 goto yynewstate;
1717
1718
1719 /*-------------------------------------.
1720 | yyacceptlab -- YYACCEPT comes here. |
1721 `-------------------------------------*/
1722 yyacceptlab:
1723 yyresult = 0;
1724 goto yyreturn;
1725
1726 /*-----------------------------------.
1727 | yyabortlab -- YYABORT comes here. |
1728 `-----------------------------------*/
1729 yyabortlab:
1730 yyresult = 1;
1731 goto yyreturn;
1732
1733 #ifndef yyoverflow
1734 /*-------------------------------------------------.
1735 | yyexhaustedlab -- memory exhaustion comes here. |
1736 `-------------------------------------------------*/
1737 yyexhaustedlab:
1738 yyerror (YY_("memory exhausted"));
1739 yyresult = 2;
1740 /* Fall through. */
1741 #endif
1742
1743 yyreturn:
1744 if (yychar != YYEOF && yychar != YYEMPTY)
1745 yydestruct ("Cleanup: discarding lookahead",
1746 yytoken, &yylval);
1747 /* Do not reclaim the symbols of the rule which action triggered
1748 this YYABORT or YYACCEPT. */
1749 YYPOPSTACK (yylen);
1750 YY_STACK_PRINT (yyss, yyssp);
1751 while (yyssp != yyss)
1752 {
1753 yydestruct ("Cleanup: popping",
1754 yystos[*yyssp], yyvsp);
1755 YYPOPSTACK (1);
1756 }
1757 #ifndef yyoverflow
1758 if (yyss != yyssa)
1759 YYSTACK_FREE (yyss);
1760 #endif
1761 #if YYERROR_VERBOSE
1762 if (yymsg != yymsgbuf)
1763 YYSTACK_FREE (yymsg);
1764 #endif
1765 /* Make sure YYID is used. */
1766 return YYID (yyresult);
1767 }
1768
1769
1770
1771