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