2 /* A Bison parser, made by GNU Bison 2.4.1. */
4 /* Skeleton implementation for Bison's Yacc-like parsers in C
6 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
9 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.
14 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.
19 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/>. */
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.
32 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
35 /* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
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. */
45 /* Identify Bison output. */
49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
63 /* Using locations. */
64 #define YYLSP_NEEDED 0
68 /* Copy the first part of user declarations. */
72 * sconfig, coreboot device tree compiler
74 * Copyright (C) 2010 coresystems GmbH
75 * written by Patrick Georgi <patrick.georgi@coresystems.de>
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.
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.
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
93 static struct device *cur_parent, *cur_bus;
98 /* Enabling traces. */
103 /* Enabling verbose error messages. */
104 #ifdef YYERROR_VERBOSE
105 # undef YYERROR_VERBOSE
106 # define YYERROR_VERBOSE 1
108 # define YYERROR_VERBOSE 0
111 /* Enabling the token table. */
112 #ifndef YYTOKEN_TABLE
113 # define YYTOKEN_TABLE 0
120 /* Put the tokens into the symbol table, so that GDB and other debuggers
150 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
151 typedef union YYSTYPE
155 struct device *device;
162 # define YYSTYPE_IS_TRIVIAL 1
163 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
164 # define YYSTYPE_IS_DECLARED 1
168 /* Copy the second part of user declarations. */
177 typedef YYTYPE_UINT8 yytype_uint8;
179 typedef unsigned char yytype_uint8;
183 typedef YYTYPE_INT8 yytype_int8;
184 #elif (defined __STDC__ || defined __C99__FUNC__ \
185 || defined __cplusplus || defined _MSC_VER)
186 typedef signed char yytype_int8;
188 typedef short int yytype_int8;
192 typedef YYTYPE_UINT16 yytype_uint16;
194 typedef unsigned short int yytype_uint16;
198 typedef YYTYPE_INT16 yytype_int16;
200 typedef short int yytype_int16;
204 # ifdef __SIZE_TYPE__
205 # define YYSIZE_T __SIZE_TYPE__
206 # elif defined size_t
207 # define YYSIZE_T size_t
208 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
209 || defined __cplusplus || defined _MSC_VER)
210 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
211 # define YYSIZE_T size_t
213 # define YYSIZE_T unsigned int
217 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
222 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
223 # define YY_(msgid) dgettext ("bison-runtime", msgid)
227 # define YY_(msgid) msgid
231 /* Suppress unused-variable warnings by "using" E. */
232 #if ! defined lint || defined __GNUC__
233 # define YYUSE(e) ((void) (e))
235 # define YYUSE(e) /* empty */
238 /* Identity function, used to suppress warnings about constant conditions. */
242 #if (defined __STDC__ || defined __C99__FUNC__ \
243 || defined __cplusplus || defined _MSC_VER)
256 #if ! defined yyoverflow || YYERROR_VERBOSE
258 /* The parser invokes alloca or malloc; define the necessary symbols. */
260 # ifdef YYSTACK_USE_ALLOCA
261 # if YYSTACK_USE_ALLOCA
263 # define YYSTACK_ALLOC __builtin_alloca
264 # elif defined __BUILTIN_VA_ARG_INCR
265 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
267 # define YYSTACK_ALLOC __alloca
268 # elif defined _MSC_VER
269 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
270 # define alloca _alloca
272 # define YYSTACK_ALLOC alloca
273 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
274 || defined __cplusplus || defined _MSC_VER)
275 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
284 # ifdef YYSTACK_ALLOC
285 /* Pacify GCC's `empty if-body' warning. */
286 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
287 # ifndef YYSTACK_ALLOC_MAXIMUM
288 /* The OS might guarantee only one guard page at the bottom of the stack,
289 and a page size can be as small as 4096 bytes. So we cannot safely
290 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
291 to allow for a few compiler-allocated temporary stack slots. */
292 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
295 # define YYSTACK_ALLOC YYMALLOC
296 # define YYSTACK_FREE YYFREE
297 # ifndef YYSTACK_ALLOC_MAXIMUM
298 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
300 # if (defined __cplusplus && ! defined _STDLIB_H \
301 && ! ((defined YYMALLOC || defined malloc) \
302 && (defined YYFREE || defined free)))
303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
309 # define YYMALLOC malloc
310 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
311 || defined __cplusplus || defined _MSC_VER)
312 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
317 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
318 || defined __cplusplus || defined _MSC_VER)
319 void free (void *); /* INFRINGES ON USER NAME SPACE */
323 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
326 #if (! defined yyoverflow \
327 && (! defined __cplusplus \
328 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
330 /* A type that is properly aligned for any stack member. */
333 yytype_int16 yyss_alloc;
337 /* The size of the maximum gap between one aligned stack and the next. */
338 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
340 /* The size of an array large to enough to hold all stacks, each with
342 # define YYSTACK_BYTES(N) \
343 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
344 + YYSTACK_GAP_MAXIMUM)
346 /* Copy COUNT objects from FROM to TO. The source and destination do
349 # if defined __GNUC__ && 1 < __GNUC__
350 # define YYCOPY(To, From, Count) \
351 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
353 # define YYCOPY(To, From, Count) \
357 for (yyi = 0; yyi < (Count); yyi++) \
358 (To)[yyi] = (From)[yyi]; \
364 /* Relocate STACK from its old location to the new one. The
365 local variables YYSIZE and YYSTACKSIZE give the old and new number of
366 elements in the stack, and YYPTR gives the new location of the
367 stack. Advance YYPTR to a properly aligned location for the next
369 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
372 YYSIZE_T yynewbytes; \
373 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
374 Stack = &yyptr->Stack_alloc; \
375 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
376 yyptr += yynewbytes / sizeof (*yyptr); \
382 /* YYFINAL -- State number of the termination state. */
384 /* YYLAST -- Last index in YYTABLE. */
387 /* YYNTOKENS -- Number of terminals. */
389 /* YYNNTS -- Number of nonterminals. */
391 /* YYNRULES -- Number of rules. */
393 /* YYNRULES -- Number of states. */
396 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
398 #define YYMAXUTOK 279
400 #define YYTRANSLATE(YYX) \
401 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
403 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
404 static const yytype_uint8 yytranslate[] =
406 0, 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, 2, 2, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
432 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
433 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
437 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
439 static const yytype_uint8 yyprhs[] =
441 0, 0, 3, 4, 7, 10, 13, 16, 17, 20,
442 23, 26, 29, 30, 31, 37, 38, 46, 51, 56,
446 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
447 static const yytype_int8 yyrhs[] =
449 26, 0, -1, -1, 27, 30, -1, 28, 32, -1,
450 28, 30, -1, 28, 35, -1, -1, 29, 32, -1,
451 29, 30, -1, 29, 34, -1, 29, 36, -1, -1,
452 -1, 3, 12, 31, 28, 9, -1, -1, 4, 7,
453 22, 6, 33, 29, 9, -1, 8, 22, 10, 22,
454 -1, 5, 12, 10, 12, -1, 23, 22, 22, -1,
458 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
459 static const yytype_uint8 yyrline[] =
461 0, 35, 35, 35, 37, 37, 37, 37, 39, 39,
462 39, 39, 39, 41, 41, 51, 51, 63, 66, 69,
467 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
468 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
469 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
470 static const char *const yytname[] =
472 "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
473 "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C",
474 "APIC", "APIC_CLUSTER", "PCI_DOMAIN", "IRQ", "DRQ", "IO", "NUMBER",
475 "SUBSYSTEMID", "INHERIT", "$accept", "devtree", "$@1", "chipchildren",
476 "devicechildren", "chip", "@2", "device", "@3", "resource", "registers",
482 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
484 static const yytype_uint16 yytoknum[] =
486 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
487 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
488 275, 276, 277, 278, 279
492 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
493 static const yytype_uint8 yyr1[] =
495 0, 25, 27, 26, 28, 28, 28, 28, 29, 29,
496 29, 29, 29, 31, 30, 33, 32, 34, 35, 36,
500 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
501 static const yytype_uint8 yyr2[] =
503 0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
504 2, 2, 0, 0, 5, 0, 7, 4, 4, 3,
508 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
509 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
510 means the default is an error. */
511 static const yytype_uint8 yydefact[] =
513 2, 0, 0, 1, 0, 3, 13, 7, 0, 0,
514 0, 14, 5, 4, 6, 0, 0, 0, 0, 15,
515 18, 12, 0, 0, 16, 0, 9, 8, 10, 11,
519 /* YYDEFGOTO[NTERM-NUM]. */
520 static const yytype_int8 yydefgoto[] =
522 -1, 1, 2, 8, 22, 5, 7, 13, 21, 28,
526 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
528 #define YYPACT_NINF -9
529 static const yytype_int8 yypact[] =
531 -9, 3, 1, -9, -2, -9, -9, -9, 4, 5,
532 -1, -9, -9, -9, -9, -8, 7, 9, 6, -9,
533 -9, -9, -3, 0, -9, 2, -9, -9, -9, -9,
534 11, 8, 10, -5, -9, -9
537 /* YYPGOTO[NTERM-NUM]. */
538 static const yytype_int8 yypgoto[] =
540 -9, -9, -9, -9, -9, -6, -9, 12, -9, -9,
544 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
545 positive, shift that token. If negative, reduce the rule which
546 number is the opposite. If zero, do what YYDEFACT says.
547 If YYTABLE_NINF, syntax error. */
548 #define YYTABLE_NINF -1
549 static const yytype_uint8 yytable[] =
551 4, 9, 12, 3, 4, 23, 24, 4, 9, 10,
552 6, 16, 15, 11, 17, 19, 26, 18, 20, 35,
553 25, 32, 30, 0, 31, 0, 0, 0, 0, 0,
557 static const yytype_int8 yycheck[] =
559 3, 4, 8, 0, 3, 8, 9, 3, 4, 5,
560 12, 12, 7, 9, 22, 6, 22, 10, 12, 24,
561 23, 10, 22, -1, 22, -1, -1, -1, -1, -1,
565 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
566 symbol of state STATE-NUM. */
567 static const yytype_uint8 yystos[] =
569 0, 26, 27, 0, 3, 30, 12, 31, 28, 4,
570 5, 9, 30, 32, 35, 7, 12, 22, 10, 6,
571 12, 33, 29, 8, 9, 23, 30, 32, 34, 36,
572 22, 22, 10, 22, 22, 24
575 #define yyerrok (yyerrstatus = 0)
576 #define yyclearin (yychar = YYEMPTY)
580 #define YYACCEPT goto yyacceptlab
581 #define YYABORT goto yyabortlab
582 #define YYERROR goto yyerrorlab
585 /* Like YYERROR except do call yyerror. This remains here temporarily
586 to ease the transition to the new meaning of YYERROR, for GCC.
587 Once GCC version 2 has supplanted version 1, this can go. */
589 #define YYFAIL goto yyerrlab
591 #define YYRECOVERING() (!!yyerrstatus)
593 #define YYBACKUP(Token, Value) \
595 if (yychar == YYEMPTY && yylen == 1) \
599 yytoken = YYTRANSLATE (yychar); \
605 yyerror (YY_("syntax error: cannot back up")); \
612 #define YYERRCODE 256
615 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
616 If N is 0, then set CURRENT to the empty location which ends
617 the previous symbol: RHS[0] (always defined). */
619 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
620 #ifndef YYLLOC_DEFAULT
621 # define YYLLOC_DEFAULT(Current, Rhs, N) \
625 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
626 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
627 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
628 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
632 (Current).first_line = (Current).last_line = \
633 YYRHSLOC (Rhs, 0).last_line; \
634 (Current).first_column = (Current).last_column = \
635 YYRHSLOC (Rhs, 0).last_column; \
641 /* YY_LOCATION_PRINT -- Print the location on the stream.
642 This macro was not mandated originally: define only if we know
643 we won't break user code: when these are the locations we know. */
645 #ifndef YY_LOCATION_PRINT
646 # if YYLTYPE_IS_TRIVIAL
647 # define YY_LOCATION_PRINT(File, Loc) \
648 fprintf (File, "%d.%d-%d.%d", \
649 (Loc).first_line, (Loc).first_column, \
650 (Loc).last_line, (Loc).last_column)
652 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
657 /* YYLEX -- calling `yylex' with the right arguments. */
660 # define YYLEX yylex (YYLEX_PARAM)
662 # define YYLEX yylex ()
665 /* Enable debugging if requested. */
669 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
670 # define YYFPRINTF fprintf
673 # define YYDPRINTF(Args) \
679 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
683 YYFPRINTF (stderr, "%s ", Title); \
684 yy_symbol_print (stderr, \
686 YYFPRINTF (stderr, "\n"); \
691 /*--------------------------------.
692 | Print this symbol on YYOUTPUT. |
693 `--------------------------------*/
696 #if (defined __STDC__ || defined __C99__FUNC__ \
697 || defined __cplusplus || defined _MSC_VER)
699 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
702 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
705 YYSTYPE const * const yyvaluep;
711 if (yytype < YYNTOKENS)
712 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
724 /*--------------------------------.
725 | Print this symbol on YYOUTPUT. |
726 `--------------------------------*/
728 #if (defined __STDC__ || defined __C99__FUNC__ \
729 || defined __cplusplus || defined _MSC_VER)
731 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
734 yy_symbol_print (yyoutput, yytype, yyvaluep)
737 YYSTYPE const * const yyvaluep;
740 if (yytype < YYNTOKENS)
741 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
743 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
745 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
746 YYFPRINTF (yyoutput, ")");
749 /*------------------------------------------------------------------.
750 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
752 `------------------------------------------------------------------*/
754 #if (defined __STDC__ || defined __C99__FUNC__ \
755 || defined __cplusplus || defined _MSC_VER)
757 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
760 yy_stack_print (yybottom, yytop)
761 yytype_int16 *yybottom;
765 YYFPRINTF (stderr, "Stack now");
766 for (; yybottom <= yytop; yybottom++)
768 int yybot = *yybottom;
769 YYFPRINTF (stderr, " %d", yybot);
771 YYFPRINTF (stderr, "\n");
774 # define YY_STACK_PRINT(Bottom, Top) \
777 yy_stack_print ((Bottom), (Top)); \
781 /*------------------------------------------------.
782 | Report that the YYRULE is going to be reduced. |
783 `------------------------------------------------*/
785 #if (defined __STDC__ || defined __C99__FUNC__ \
786 || defined __cplusplus || defined _MSC_VER)
788 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
791 yy_reduce_print (yyvsp, yyrule)
796 int yynrhs = yyr2[yyrule];
798 unsigned long int yylno = yyrline[yyrule];
799 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
801 /* The symbols being reduced. */
802 for (yyi = 0; yyi < yynrhs; yyi++)
804 YYFPRINTF (stderr, " $%d = ", yyi + 1);
805 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
806 &(yyvsp[(yyi + 1) - (yynrhs)])
808 YYFPRINTF (stderr, "\n");
812 # define YY_REDUCE_PRINT(Rule) \
815 yy_reduce_print (yyvsp, Rule); \
818 /* Nonzero means print parse trace. It is left uninitialized so that
819 multiple parsers can coexist. */
822 # define YYDPRINTF(Args)
823 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
824 # define YY_STACK_PRINT(Bottom, Top)
825 # define YY_REDUCE_PRINT(Rule)
826 #endif /* !YYDEBUG */
829 /* YYINITDEPTH -- initial size of the parser's stacks. */
831 # define YYINITDEPTH 200
834 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
835 if the built-in stack extension method is used).
837 Do not make this value too large; the results are undefined if
838 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
839 evaluated with infinite-precision integer arithmetic. */
842 # define YYMAXDEPTH 10000
850 # if defined __GLIBC__ && defined _STRING_H
851 # define yystrlen strlen
853 /* Return the length of YYSTR. */
854 #if (defined __STDC__ || defined __C99__FUNC__ \
855 || defined __cplusplus || defined _MSC_VER)
857 yystrlen (const char *yystr)
865 for (yylen = 0; yystr[yylen]; yylen++)
873 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
874 # define yystpcpy stpcpy
876 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
878 #if (defined __STDC__ || defined __C99__FUNC__ \
879 || defined __cplusplus || defined _MSC_VER)
881 yystpcpy (char *yydest, const char *yysrc)
884 yystpcpy (yydest, yysrc)
890 const char *yys = yysrc;
892 while ((*yyd++ = *yys++) != '\0')
901 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
902 quotes and backslashes, so that it's suitable for yyerror. The
903 heuristic is that double-quoting is unnecessary unless the string
904 contains an apostrophe, a comma, or backslash (other than
905 backslash-backslash). YYSTR is taken from yytname. If YYRES is
906 null, do not copy; instead, return the length of what the result
909 yytnamerr (char *yyres, const char *yystr)
914 char const *yyp = yystr;
921 goto do_not_strip_quotes;
925 goto do_not_strip_quotes;
938 do_not_strip_quotes: ;
942 return yystrlen (yystr);
944 return yystpcpy (yyres, yystr) - yyres;
948 /* Copy into YYRESULT an error message about the unexpected token
949 YYCHAR while in state YYSTATE. Return the number of bytes copied,
950 including the terminating null byte. If YYRESULT is null, do not
951 copy anything; just return the number of bytes that would be
952 copied. As a special case, return 0 if an ordinary "syntax error"
953 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
956 yysyntax_error (char *yyresult, int yystate, int yychar)
958 int yyn = yypact[yystate];
960 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
964 int yytype = YYTRANSLATE (yychar);
965 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
966 YYSIZE_T yysize = yysize0;
968 int yysize_overflow = 0;
969 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
970 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
974 /* This is so xgettext sees the translatable formats that are
975 constructed on the fly. */
976 YY_("syntax error, unexpected %s");
977 YY_("syntax error, unexpected %s, expecting %s");
978 YY_("syntax error, unexpected %s, expecting %s or %s");
979 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
980 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
984 static char const yyunexpected[] = "syntax error, unexpected %s";
985 static char const yyexpecting[] = ", expecting %s";
986 static char const yyor[] = " or %s";
987 char yyformat[sizeof yyunexpected
988 + sizeof yyexpecting - 1
989 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
990 * (sizeof yyor - 1))];
991 char const *yyprefix = yyexpecting;
993 /* Start YYX at -YYN if negative to avoid negative indexes in
995 int yyxbegin = yyn < 0 ? -yyn : 0;
997 /* Stay within bounds of both yycheck and yytname. */
998 int yychecklim = YYLAST - yyn + 1;
999 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1002 yyarg[0] = yytname[yytype];
1003 yyfmt = yystpcpy (yyformat, yyunexpected);
1005 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1006 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1008 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1012 yyformat[sizeof yyunexpected - 1] = '\0';
1015 yyarg[yycount++] = yytname[yyx];
1016 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1017 yysize_overflow |= (yysize1 < yysize);
1019 yyfmt = yystpcpy (yyfmt, yyprefix);
1023 yyf = YY_(yyformat);
1024 yysize1 = yysize + yystrlen (yyf);
1025 yysize_overflow |= (yysize1 < yysize);
1028 if (yysize_overflow)
1029 return YYSIZE_MAXIMUM;
1033 /* Avoid sprintf, as that infringes on the user's name space.
1034 Don't have undefined behavior even if the translation
1035 produced a string with the wrong number of "%s"s. */
1036 char *yyp = yyresult;
1038 while ((*yyp = *yyf) != '\0')
1040 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1042 yyp += yytnamerr (yyp, yyarg[yyi++]);
1055 #endif /* YYERROR_VERBOSE */
1058 /*-----------------------------------------------.
1059 | Release the memory associated to this symbol. |
1060 `-----------------------------------------------*/
1063 #if (defined __STDC__ || defined __C99__FUNC__ \
1064 || defined __cplusplus || defined _MSC_VER)
1066 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1069 yydestruct (yymsg, yytype, yyvaluep)
1079 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1089 /* Prevent warnings from -Wmissing-prototypes. */
1090 #ifdef YYPARSE_PARAM
1091 #if defined __STDC__ || defined __cplusplus
1092 int yyparse (void *YYPARSE_PARAM);
1096 #else /* ! YYPARSE_PARAM */
1097 #if defined __STDC__ || defined __cplusplus
1102 #endif /* ! YYPARSE_PARAM */
1105 /* The lookahead symbol. */
1108 /* The semantic value of the lookahead symbol. */
1111 /* Number of syntax errors so far. */
1116 /*-------------------------.
1117 | yyparse or yypush_parse. |
1118 `-------------------------*/
1120 #ifdef YYPARSE_PARAM
1121 #if (defined __STDC__ || defined __C99__FUNC__ \
1122 || defined __cplusplus || defined _MSC_VER)
1124 yyparse (void *YYPARSE_PARAM)
1127 yyparse (YYPARSE_PARAM)
1128 void *YYPARSE_PARAM;
1130 #else /* ! YYPARSE_PARAM */
1131 #if (defined __STDC__ || defined __C99__FUNC__ \
1132 || defined __cplusplus || defined _MSC_VER)
1145 /* Number of tokens to shift before error messages enabled. */
1148 /* The stacks and their tools:
1149 `yyss': related to states.
1150 `yyvs': related to semantic values.
1152 Refer to the stacks thru separate pointers, to allow yyoverflow
1153 to reallocate them elsewhere. */
1155 /* The state stack. */
1156 yytype_int16 yyssa[YYINITDEPTH];
1158 yytype_int16 *yyssp;
1160 /* The semantic value stack. */
1161 YYSTYPE yyvsa[YYINITDEPTH];
1165 YYSIZE_T yystacksize;
1169 /* Lookahead token as an internal (translated) token number. */
1171 /* The variables used to return semantic value and location from the
1176 /* Buffer for error messages, and its allocated size. */
1178 char *yymsg = yymsgbuf;
1179 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1182 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1184 /* The number of symbols on the RHS of the reduced rule.
1185 Keep to zero when no symbol should be popped. */
1191 yystacksize = YYINITDEPTH;
1193 YYDPRINTF ((stderr, "Starting parse\n"));
1198 yychar = YYEMPTY; /* Cause a token to be read. */
1200 /* Initialize stack pointers.
1201 Waste one element of value and location stack
1202 so that they stay on the same level as the state stack.
1203 The wasted elements are never initialized. */
1209 /*------------------------------------------------------------.
1210 | yynewstate -- Push a new state, which is found in yystate. |
1211 `------------------------------------------------------------*/
1213 /* In all cases, when you get here, the value and location stacks
1214 have just been pushed. So pushing a state here evens the stacks. */
1220 if (yyss + yystacksize - 1 <= yyssp)
1222 /* Get the current used size of the three stacks, in elements. */
1223 YYSIZE_T yysize = yyssp - yyss + 1;
1227 /* Give user a chance to reallocate the stack. Use copies of
1228 these so that the &'s don't force the real ones into
1230 YYSTYPE *yyvs1 = yyvs;
1231 yytype_int16 *yyss1 = yyss;
1233 /* Each stack pointer address is followed by the size of the
1234 data in use in that stack, in bytes. This used to be a
1235 conditional around just the two extra args, but that might
1236 be undefined if yyoverflow is a macro. */
1237 yyoverflow (YY_("memory exhausted"),
1238 &yyss1, yysize * sizeof (*yyssp),
1239 &yyvs1, yysize * sizeof (*yyvsp),
1245 #else /* no yyoverflow */
1246 # ifndef YYSTACK_RELOCATE
1247 goto yyexhaustedlab;
1249 /* Extend the stack our own way. */
1250 if (YYMAXDEPTH <= yystacksize)
1251 goto yyexhaustedlab;
1253 if (YYMAXDEPTH < yystacksize)
1254 yystacksize = YYMAXDEPTH;
1257 yytype_int16 *yyss1 = yyss;
1258 union yyalloc *yyptr =
1259 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1261 goto yyexhaustedlab;
1262 YYSTACK_RELOCATE (yyss_alloc, yyss);
1263 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1264 # undef YYSTACK_RELOCATE
1266 YYSTACK_FREE (yyss1);
1269 #endif /* no yyoverflow */
1271 yyssp = yyss + yysize - 1;
1272 yyvsp = yyvs + yysize - 1;
1274 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1275 (unsigned long int) yystacksize));
1277 if (yyss + yystacksize - 1 <= yyssp)
1281 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1283 if (yystate == YYFINAL)
1293 /* Do appropriate processing given the current state. Read a
1294 lookahead token if we need one and don't already have one. */
1296 /* First try to decide what to do without reference to lookahead token. */
1297 yyn = yypact[yystate];
1298 if (yyn == YYPACT_NINF)
1301 /* Not known => get a lookahead token if don't already have one. */
1303 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1304 if (yychar == YYEMPTY)
1306 YYDPRINTF ((stderr, "Reading a token: "));
1310 if (yychar <= YYEOF)
1312 yychar = yytoken = YYEOF;
1313 YYDPRINTF ((stderr, "Now at end of input.\n"));
1317 yytoken = YYTRANSLATE (yychar);
1318 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1321 /* If the proper action on seeing token YYTOKEN is to reduce or to
1322 detect an error, take that action. */
1324 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1329 if (yyn == 0 || yyn == YYTABLE_NINF)
1335 /* Count tokens shifted since error; after three, turn off error
1340 /* Shift the lookahead token. */
1341 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1343 /* Discard the shifted token. */
1352 /*-----------------------------------------------------------.
1353 | yydefault -- do the default action for the current state. |
1354 `-----------------------------------------------------------*/
1356 yyn = yydefact[yystate];
1362 /*-----------------------------.
1363 | yyreduce -- Do a reduction. |
1364 `-----------------------------*/
1366 /* yyn is the number of a rule to reduce with. */
1369 /* If YYLEN is nonzero, implement the default value of the action:
1372 Otherwise, the following line sets YYVAL to garbage.
1373 This behavior is undocumented and Bison
1374 users should not rely upon it. Assigning to YYVAL
1375 unconditionally makes the parser a bit smaller, and it avoids a
1376 GCC warning that YYVAL may be used uninitialized. */
1377 yyval = yyvsp[1-yylen];
1380 YY_REDUCE_PRINT (yyn);
1385 { cur_parent = cur_bus = head; ;}
1390 { postprocess_devtree(); ;}
1396 (yyval.device) = new_chip(cur_parent, cur_bus, (yyvsp[(2) - (2)].string));
1397 cur_parent = (yyval.device);
1404 cur_parent = (yyvsp[(3) - (5)].device)->parent;
1405 fold_in((yyvsp[(3) - (5)].device));
1406 add_header((yyvsp[(3) - (5)].device));
1413 (yyval.device) = new_device(cur_parent, cur_bus, (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].number));
1414 cur_parent = (yyval.device);
1415 cur_bus = (yyval.device);
1422 cur_parent = (yyvsp[(5) - (7)].device)->parent;
1423 cur_bus = (yyvsp[(5) - (7)].device)->bus;
1424 fold_in((yyvsp[(5) - (7)].device));
1425 alias_siblings((yyvsp[(5) - (7)].device)->children);
1431 { add_resource(cur_parent, (yyvsp[(1) - (4)].number), strtol((yyvsp[(2) - (4)].string), NULL, 0), strtol((yyvsp[(4) - (4)].string), NULL, 0)); ;}
1436 { add_register(cur_parent, (yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].string)); ;}
1441 { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[(2) - (3)].string), NULL, 16), strtol((yyvsp[(3) - (3)].string), NULL, 16), 0); ;}
1446 { add_pci_subsystem_ids(cur_parent, strtol((yyvsp[(2) - (4)].string), NULL, 16), strtol((yyvsp[(3) - (4)].string), NULL, 16), 1); ;}
1453 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1457 YY_STACK_PRINT (yyss, yyssp);
1461 /* Now `shift' the result of the reduction. Determine what state
1462 that goes to, based on the state we popped back to and the rule
1463 number reduced by. */
1467 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1468 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1469 yystate = yytable[yystate];
1471 yystate = yydefgoto[yyn - YYNTOKENS];
1476 /*------------------------------------.
1477 | yyerrlab -- here on detecting error |
1478 `------------------------------------*/
1480 /* If not already recovering from an error, report this error. */
1484 #if ! YYERROR_VERBOSE
1485 yyerror (YY_("syntax error"));
1488 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1489 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1491 YYSIZE_T yyalloc = 2 * yysize;
1492 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1493 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1494 if (yymsg != yymsgbuf)
1495 YYSTACK_FREE (yymsg);
1496 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1498 yymsg_alloc = yyalloc;
1502 yymsg_alloc = sizeof yymsgbuf;
1506 if (0 < yysize && yysize <= yymsg_alloc)
1508 (void) yysyntax_error (yymsg, yystate, yychar);
1513 yyerror (YY_("syntax error"));
1515 goto yyexhaustedlab;
1523 if (yyerrstatus == 3)
1525 /* If just tried and failed to reuse lookahead token after an
1526 error, discard it. */
1528 if (yychar <= YYEOF)
1530 /* Return failure if at end of input. */
1531 if (yychar == YYEOF)
1536 yydestruct ("Error: discarding",
1542 /* Else will try to reuse lookahead token after shifting the error
1547 /*---------------------------------------------------.
1548 | yyerrorlab -- error raised explicitly by YYERROR. |
1549 `---------------------------------------------------*/
1552 /* Pacify compilers like GCC when the user code never invokes
1553 YYERROR and the label yyerrorlab therefore never appears in user
1555 if (/*CONSTCOND*/ 0)
1558 /* Do not reclaim the symbols of the rule which action triggered
1562 YY_STACK_PRINT (yyss, yyssp);
1567 /*-------------------------------------------------------------.
1568 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1569 `-------------------------------------------------------------*/
1571 yyerrstatus = 3; /* Each real token shifted decrements this. */
1575 yyn = yypact[yystate];
1576 if (yyn != YYPACT_NINF)
1579 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1587 /* Pop the current state because it cannot handle the error token. */
1592 yydestruct ("Error: popping",
1593 yystos[yystate], yyvsp);
1596 YY_STACK_PRINT (yyss, yyssp);
1602 /* Shift the error token. */
1603 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1609 /*-------------------------------------.
1610 | yyacceptlab -- YYACCEPT comes here. |
1611 `-------------------------------------*/
1616 /*-----------------------------------.
1617 | yyabortlab -- YYABORT comes here. |
1618 `-----------------------------------*/
1623 #if !defined(yyoverflow) || YYERROR_VERBOSE
1624 /*-------------------------------------------------.
1625 | yyexhaustedlab -- memory exhaustion comes here. |
1626 `-------------------------------------------------*/
1628 yyerror (YY_("memory exhausted"));
1634 if (yychar != YYEMPTY)
1635 yydestruct ("Cleanup: discarding lookahead",
1637 /* Do not reclaim the symbols of the rule which action triggered
1638 this YYABORT or YYACCEPT. */
1640 YY_STACK_PRINT (yyss, yyssp);
1641 while (yyssp != yyss)
1643 yydestruct ("Cleanup: popping",
1644 yystos[*yyssp], yyvsp);
1649 YYSTACK_FREE (yyss);
1652 if (yymsg != yymsgbuf)
1653 YYSTACK_FREE (yymsg);
1655 /* Make sure YYID is used. */
1656 return YYID (yyresult);