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
148 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
149 typedef union YYSTYPE
153 struct device *device;
160 # define YYSTYPE_IS_TRIVIAL 1
161 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
162 # define YYSTYPE_IS_DECLARED 1
166 /* Copy the second part of user declarations. */
175 typedef YYTYPE_UINT8 yytype_uint8;
177 typedef unsigned char yytype_uint8;
181 typedef YYTYPE_INT8 yytype_int8;
182 #elif (defined __STDC__ || defined __C99__FUNC__ \
183 || defined __cplusplus || defined _MSC_VER)
184 typedef signed char yytype_int8;
186 typedef short int yytype_int8;
190 typedef YYTYPE_UINT16 yytype_uint16;
192 typedef unsigned short int yytype_uint16;
196 typedef YYTYPE_INT16 yytype_int16;
198 typedef short int yytype_int16;
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
211 # define YYSIZE_T unsigned int
215 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
220 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
221 # define YY_(msgid) dgettext ("bison-runtime", msgid)
225 # define YY_(msgid) msgid
229 /* Suppress unused-variable warnings by "using" E. */
230 #if ! defined lint || defined __GNUC__
231 # define YYUSE(e) ((void) (e))
233 # define YYUSE(e) /* empty */
236 /* Identity function, used to suppress warnings about constant conditions. */
240 #if (defined __STDC__ || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
254 #if ! defined yyoverflow || YYERROR_VERBOSE
256 /* The parser invokes alloca or malloc; define the necessary symbols. */
258 # ifdef YYSTACK_USE_ALLOCA
259 # if YYSTACK_USE_ALLOCA
261 # define YYSTACK_ALLOC __builtin_alloca
262 # elif defined __BUILTIN_VA_ARG_INCR
263 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
265 # define YYSTACK_ALLOC __alloca
266 # elif defined _MSC_VER
267 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
268 # define alloca _alloca
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 */
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 */
293 # define YYSTACK_ALLOC YYMALLOC
294 # define YYSTACK_FREE YYFREE
295 # ifndef YYSTACK_ALLOC_MAXIMUM
296 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
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 */
307 # define YYMALLOC malloc
308 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309 || defined __cplusplus || defined _MSC_VER)
310 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
315 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317 void free (void *); /* INFRINGES ON USER NAME SPACE */
321 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
324 #if (! defined yyoverflow \
325 && (! defined __cplusplus \
326 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
328 /* A type that is properly aligned for any stack member. */
331 yytype_int16 yyss_alloc;
335 /* The size of the maximum gap between one aligned stack and the next. */
336 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
338 /* The size of an array large to enough to hold all stacks, each with
340 # define YYSTACK_BYTES(N) \
341 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
342 + YYSTACK_GAP_MAXIMUM)
344 /* Copy COUNT objects from FROM to TO. The source and destination do
347 # if defined __GNUC__ && 1 < __GNUC__
348 # define YYCOPY(To, From, Count) \
349 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
351 # define YYCOPY(To, From, Count) \
355 for (yyi = 0; yyi < (Count); yyi++) \
356 (To)[yyi] = (From)[yyi]; \
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
367 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
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); \
380 /* YYFINAL -- State number of the termination state. */
382 /* YYLAST -- Last index in YYTABLE. */
385 /* YYNTOKENS -- Number of terminals. */
387 /* YYNNTS -- Number of nonterminals. */
389 /* YYNRULES -- Number of rules. */
391 /* YYNRULES -- Number of states. */
394 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
396 #define YYMAXUTOK 277
398 #define YYTRANSLATE(YYX) \
399 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
401 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
402 static const yytype_uint8 yytranslate[] =
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
435 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
437 static const yytype_uint8 yyprhs[] =
439 0, 0, 3, 4, 7, 10, 13, 16, 17, 20,
440 23, 26, 27, 28, 34, 35, 43, 48
443 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
444 static const yytype_int8 yyrhs[] =
446 24, 0, -1, -1, 25, 28, -1, 26, 30, -1,
447 26, 28, -1, 26, 33, -1, -1, 27, 30, -1,
448 27, 28, -1, 27, 32, -1, -1, -1, 3, 12,
449 29, 26, 9, -1, -1, 4, 7, 22, 6, 31,
450 27, 9, -1, 8, 22, 10, 22, -1, 5, 12,
454 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
455 static const yytype_uint8 yyrline[] =
457 0, 34, 34, 34, 36, 36, 36, 36, 38, 38,
458 38, 38, 40, 40, 50, 50, 62, 65
462 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
463 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
464 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
465 static const char *const yytname[] =
467 "$end", "error", "$undefined", "CHIP", "DEVICE", "REGISTER", "BOOL",
468 "BUS", "RESOURCE", "END", "EQUALS", "HEX", "STRING", "PCI", "PNP", "I2C",
469 "APIC", "APIC_CLUSTER", "PCI_DOMAIN", "IRQ", "DRQ", "IO", "NUMBER",
470 "$accept", "devtree", "$@1", "chipchildren", "devicechildren", "chip",
471 "@2", "device", "@3", "resource", "registers", 0
476 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
478 static const yytype_uint16 yytoknum[] =
480 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
481 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
486 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
487 static const yytype_uint8 yyr1[] =
489 0, 23, 25, 24, 26, 26, 26, 26, 27, 27,
490 27, 27, 29, 28, 31, 30, 32, 33
493 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
494 static const yytype_uint8 yyr2[] =
496 0, 2, 0, 2, 2, 2, 2, 0, 2, 2,
497 2, 0, 0, 5, 0, 7, 4, 4
500 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
501 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
502 means the default is an error. */
503 static const yytype_uint8 yydefact[] =
505 2, 0, 0, 1, 0, 3, 12, 7, 0, 0,
506 0, 13, 5, 4, 6, 0, 0, 0, 0, 14,
507 17, 11, 0, 0, 15, 9, 8, 10, 0, 0,
511 /* YYDEFGOTO[NTERM-NUM]. */
512 static const yytype_int8 yydefgoto[] =
514 -1, 1, 2, 8, 22, 5, 7, 13, 21, 27,
518 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
520 #define YYPACT_NINF -10
521 static const yytype_int8 yypact[] =
523 -10, 6, 5, -10, -1, -10, -10, -10, -2, 8,
524 0, -10, -10, -10, -10, -9, 7, 10, 9, -10,
525 -10, -10, 1, -4, -10, -10, -10, -10, 12, -3,
529 /* YYPGOTO[NTERM-NUM]. */
530 static const yytype_int8 yypgoto[] =
532 -10, -10, -10, -10, -10, -8, -10, 2, -10, -10,
536 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
537 positive, shift that token. If negative, reduce the rule which
538 number is the opposite. If zero, do what YYDEFACT says.
539 If YYTABLE_NINF, syntax error. */
540 #define YYTABLE_NINF -1
541 static const yytype_uint8 yytable[] =
543 12, 4, 9, 10, 4, 9, 3, 11, 4, 23,
544 24, 6, 16, 17, 25, 15, 19, 18, 28, 30,
548 static const yytype_int8 yycheck[] =
550 8, 3, 4, 5, 3, 4, 0, 9, 3, 8,
551 9, 12, 12, 22, 22, 7, 6, 10, 22, 22,
555 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
556 symbol of state STATE-NUM. */
557 static const yytype_uint8 yystos[] =
559 0, 24, 25, 0, 3, 28, 12, 29, 26, 4,
560 5, 9, 28, 30, 33, 7, 12, 22, 10, 6,
561 12, 31, 27, 8, 9, 28, 30, 32, 22, 10,
565 #define yyerrok (yyerrstatus = 0)
566 #define yyclearin (yychar = YYEMPTY)
570 #define YYACCEPT goto yyacceptlab
571 #define YYABORT goto yyabortlab
572 #define YYERROR goto yyerrorlab
575 /* Like YYERROR except do call yyerror. This remains here temporarily
576 to ease the transition to the new meaning of YYERROR, for GCC.
577 Once GCC version 2 has supplanted version 1, this can go. */
579 #define YYFAIL goto yyerrlab
581 #define YYRECOVERING() (!!yyerrstatus)
583 #define YYBACKUP(Token, Value) \
585 if (yychar == YYEMPTY && yylen == 1) \
589 yytoken = YYTRANSLATE (yychar); \
595 yyerror (YY_("syntax error: cannot back up")); \
602 #define YYERRCODE 256
605 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
606 If N is 0, then set CURRENT to the empty location which ends
607 the previous symbol: RHS[0] (always defined). */
609 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
610 #ifndef YYLLOC_DEFAULT
611 # define YYLLOC_DEFAULT(Current, Rhs, N) \
615 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
616 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
617 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
618 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
622 (Current).first_line = (Current).last_line = \
623 YYRHSLOC (Rhs, 0).last_line; \
624 (Current).first_column = (Current).last_column = \
625 YYRHSLOC (Rhs, 0).last_column; \
631 /* YY_LOCATION_PRINT -- Print the location on the stream.
632 This macro was not mandated originally: define only if we know
633 we won't break user code: when these are the locations we know. */
635 #ifndef YY_LOCATION_PRINT
636 # if YYLTYPE_IS_TRIVIAL
637 # define YY_LOCATION_PRINT(File, Loc) \
638 fprintf (File, "%d.%d-%d.%d", \
639 (Loc).first_line, (Loc).first_column, \
640 (Loc).last_line, (Loc).last_column)
642 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
647 /* YYLEX -- calling `yylex' with the right arguments. */
650 # define YYLEX yylex (YYLEX_PARAM)
652 # define YYLEX yylex ()
655 /* Enable debugging if requested. */
659 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
660 # define YYFPRINTF fprintf
663 # define YYDPRINTF(Args) \
669 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
673 YYFPRINTF (stderr, "%s ", Title); \
674 yy_symbol_print (stderr, \
676 YYFPRINTF (stderr, "\n"); \
681 /*--------------------------------.
682 | Print this symbol on YYOUTPUT. |
683 `--------------------------------*/
686 #if (defined __STDC__ || defined __C99__FUNC__ \
687 || defined __cplusplus || defined _MSC_VER)
689 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
692 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
695 YYSTYPE const * const yyvaluep;
701 if (yytype < YYNTOKENS)
702 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
714 /*--------------------------------.
715 | Print this symbol on YYOUTPUT. |
716 `--------------------------------*/
718 #if (defined __STDC__ || defined __C99__FUNC__ \
719 || defined __cplusplus || defined _MSC_VER)
721 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
724 yy_symbol_print (yyoutput, yytype, yyvaluep)
727 YYSTYPE const * const yyvaluep;
730 if (yytype < YYNTOKENS)
731 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
733 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
735 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
736 YYFPRINTF (yyoutput, ")");
739 /*------------------------------------------------------------------.
740 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
742 `------------------------------------------------------------------*/
744 #if (defined __STDC__ || defined __C99__FUNC__ \
745 || defined __cplusplus || defined _MSC_VER)
747 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
750 yy_stack_print (yybottom, yytop)
751 yytype_int16 *yybottom;
755 YYFPRINTF (stderr, "Stack now");
756 for (; yybottom <= yytop; yybottom++)
758 int yybot = *yybottom;
759 YYFPRINTF (stderr, " %d", yybot);
761 YYFPRINTF (stderr, "\n");
764 # define YY_STACK_PRINT(Bottom, Top) \
767 yy_stack_print ((Bottom), (Top)); \
771 /*------------------------------------------------.
772 | Report that the YYRULE is going to be reduced. |
773 `------------------------------------------------*/
775 #if (defined __STDC__ || defined __C99__FUNC__ \
776 || defined __cplusplus || defined _MSC_VER)
778 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
781 yy_reduce_print (yyvsp, yyrule)
786 int yynrhs = yyr2[yyrule];
788 unsigned long int yylno = yyrline[yyrule];
789 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
791 /* The symbols being reduced. */
792 for (yyi = 0; yyi < yynrhs; yyi++)
794 YYFPRINTF (stderr, " $%d = ", yyi + 1);
795 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
796 &(yyvsp[(yyi + 1) - (yynrhs)])
798 YYFPRINTF (stderr, "\n");
802 # define YY_REDUCE_PRINT(Rule) \
805 yy_reduce_print (yyvsp, Rule); \
808 /* Nonzero means print parse trace. It is left uninitialized so that
809 multiple parsers can coexist. */
812 # define YYDPRINTF(Args)
813 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
814 # define YY_STACK_PRINT(Bottom, Top)
815 # define YY_REDUCE_PRINT(Rule)
816 #endif /* !YYDEBUG */
819 /* YYINITDEPTH -- initial size of the parser's stacks. */
821 # define YYINITDEPTH 200
824 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
825 if the built-in stack extension method is used).
827 Do not make this value too large; the results are undefined if
828 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
829 evaluated with infinite-precision integer arithmetic. */
832 # define YYMAXDEPTH 10000
840 # if defined __GLIBC__ && defined _STRING_H
841 # define yystrlen strlen
843 /* Return the length of YYSTR. */
844 #if (defined __STDC__ || defined __C99__FUNC__ \
845 || defined __cplusplus || defined _MSC_VER)
847 yystrlen (const char *yystr)
855 for (yylen = 0; yystr[yylen]; yylen++)
863 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
864 # define yystpcpy stpcpy
866 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
868 #if (defined __STDC__ || defined __C99__FUNC__ \
869 || defined __cplusplus || defined _MSC_VER)
871 yystpcpy (char *yydest, const char *yysrc)
874 yystpcpy (yydest, yysrc)
880 const char *yys = yysrc;
882 while ((*yyd++ = *yys++) != '\0')
891 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
892 quotes and backslashes, so that it's suitable for yyerror. The
893 heuristic is that double-quoting is unnecessary unless the string
894 contains an apostrophe, a comma, or backslash (other than
895 backslash-backslash). YYSTR is taken from yytname. If YYRES is
896 null, do not copy; instead, return the length of what the result
899 yytnamerr (char *yyres, const char *yystr)
904 char const *yyp = yystr;
911 goto do_not_strip_quotes;
915 goto do_not_strip_quotes;
928 do_not_strip_quotes: ;
932 return yystrlen (yystr);
934 return yystpcpy (yyres, yystr) - yyres;
938 /* Copy into YYRESULT an error message about the unexpected token
939 YYCHAR while in state YYSTATE. Return the number of bytes copied,
940 including the terminating null byte. If YYRESULT is null, do not
941 copy anything; just return the number of bytes that would be
942 copied. As a special case, return 0 if an ordinary "syntax error"
943 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
946 yysyntax_error (char *yyresult, int yystate, int yychar)
948 int yyn = yypact[yystate];
950 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
954 int yytype = YYTRANSLATE (yychar);
955 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
956 YYSIZE_T yysize = yysize0;
958 int yysize_overflow = 0;
959 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
960 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
964 /* This is so xgettext sees the translatable formats that are
965 constructed on the fly. */
966 YY_("syntax error, unexpected %s");
967 YY_("syntax error, unexpected %s, expecting %s");
968 YY_("syntax error, unexpected %s, expecting %s or %s");
969 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
970 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
974 static char const yyunexpected[] = "syntax error, unexpected %s";
975 static char const yyexpecting[] = ", expecting %s";
976 static char const yyor[] = " or %s";
977 char yyformat[sizeof yyunexpected
978 + sizeof yyexpecting - 1
979 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
980 * (sizeof yyor - 1))];
981 char const *yyprefix = yyexpecting;
983 /* Start YYX at -YYN if negative to avoid negative indexes in
985 int yyxbegin = yyn < 0 ? -yyn : 0;
987 /* Stay within bounds of both yycheck and yytname. */
988 int yychecklim = YYLAST - yyn + 1;
989 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
992 yyarg[0] = yytname[yytype];
993 yyfmt = yystpcpy (yyformat, yyunexpected);
995 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
996 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
998 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1002 yyformat[sizeof yyunexpected - 1] = '\0';
1005 yyarg[yycount++] = yytname[yyx];
1006 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1007 yysize_overflow |= (yysize1 < yysize);
1009 yyfmt = yystpcpy (yyfmt, yyprefix);
1013 yyf = YY_(yyformat);
1014 yysize1 = yysize + yystrlen (yyf);
1015 yysize_overflow |= (yysize1 < yysize);
1018 if (yysize_overflow)
1019 return YYSIZE_MAXIMUM;
1023 /* Avoid sprintf, as that infringes on the user's name space.
1024 Don't have undefined behavior even if the translation
1025 produced a string with the wrong number of "%s"s. */
1026 char *yyp = yyresult;
1028 while ((*yyp = *yyf) != '\0')
1030 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1032 yyp += yytnamerr (yyp, yyarg[yyi++]);
1045 #endif /* YYERROR_VERBOSE */
1048 /*-----------------------------------------------.
1049 | Release the memory associated to this symbol. |
1050 `-----------------------------------------------*/
1053 #if (defined __STDC__ || defined __C99__FUNC__ \
1054 || defined __cplusplus || defined _MSC_VER)
1056 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1059 yydestruct (yymsg, yytype, yyvaluep)
1069 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1079 /* Prevent warnings from -Wmissing-prototypes. */
1080 #ifdef YYPARSE_PARAM
1081 #if defined __STDC__ || defined __cplusplus
1082 int yyparse (void *YYPARSE_PARAM);
1086 #else /* ! YYPARSE_PARAM */
1087 #if defined __STDC__ || defined __cplusplus
1092 #endif /* ! YYPARSE_PARAM */
1095 /* The lookahead symbol. */
1098 /* The semantic value of the lookahead symbol. */
1101 /* Number of syntax errors so far. */
1106 /*-------------------------.
1107 | yyparse or yypush_parse. |
1108 `-------------------------*/
1110 #ifdef YYPARSE_PARAM
1111 #if (defined __STDC__ || defined __C99__FUNC__ \
1112 || defined __cplusplus || defined _MSC_VER)
1114 yyparse (void *YYPARSE_PARAM)
1117 yyparse (YYPARSE_PARAM)
1118 void *YYPARSE_PARAM;
1120 #else /* ! YYPARSE_PARAM */
1121 #if (defined __STDC__ || defined __C99__FUNC__ \
1122 || defined __cplusplus || defined _MSC_VER)
1135 /* Number of tokens to shift before error messages enabled. */
1138 /* The stacks and their tools:
1139 `yyss': related to states.
1140 `yyvs': related to semantic values.
1142 Refer to the stacks thru separate pointers, to allow yyoverflow
1143 to reallocate them elsewhere. */
1145 /* The state stack. */
1146 yytype_int16 yyssa[YYINITDEPTH];
1148 yytype_int16 *yyssp;
1150 /* The semantic value stack. */
1151 YYSTYPE yyvsa[YYINITDEPTH];
1155 YYSIZE_T yystacksize;
1159 /* Lookahead token as an internal (translated) token number. */
1161 /* The variables used to return semantic value and location from the
1166 /* Buffer for error messages, and its allocated size. */
1168 char *yymsg = yymsgbuf;
1169 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1172 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1174 /* The number of symbols on the RHS of the reduced rule.
1175 Keep to zero when no symbol should be popped. */
1181 yystacksize = YYINITDEPTH;
1183 YYDPRINTF ((stderr, "Starting parse\n"));
1188 yychar = YYEMPTY; /* Cause a token to be read. */
1190 /* Initialize stack pointers.
1191 Waste one element of value and location stack
1192 so that they stay on the same level as the state stack.
1193 The wasted elements are never initialized. */
1199 /*------------------------------------------------------------.
1200 | yynewstate -- Push a new state, which is found in yystate. |
1201 `------------------------------------------------------------*/
1203 /* In all cases, when you get here, the value and location stacks
1204 have just been pushed. So pushing a state here evens the stacks. */
1210 if (yyss + yystacksize - 1 <= yyssp)
1212 /* Get the current used size of the three stacks, in elements. */
1213 YYSIZE_T yysize = yyssp - yyss + 1;
1217 /* Give user a chance to reallocate the stack. Use copies of
1218 these so that the &'s don't force the real ones into
1220 YYSTYPE *yyvs1 = yyvs;
1221 yytype_int16 *yyss1 = yyss;
1223 /* Each stack pointer address is followed by the size of the
1224 data in use in that stack, in bytes. This used to be a
1225 conditional around just the two extra args, but that might
1226 be undefined if yyoverflow is a macro. */
1227 yyoverflow (YY_("memory exhausted"),
1228 &yyss1, yysize * sizeof (*yyssp),
1229 &yyvs1, yysize * sizeof (*yyvsp),
1235 #else /* no yyoverflow */
1236 # ifndef YYSTACK_RELOCATE
1237 goto yyexhaustedlab;
1239 /* Extend the stack our own way. */
1240 if (YYMAXDEPTH <= yystacksize)
1241 goto yyexhaustedlab;
1243 if (YYMAXDEPTH < yystacksize)
1244 yystacksize = YYMAXDEPTH;
1247 yytype_int16 *yyss1 = yyss;
1248 union yyalloc *yyptr =
1249 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1251 goto yyexhaustedlab;
1252 YYSTACK_RELOCATE (yyss_alloc, yyss);
1253 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1254 # undef YYSTACK_RELOCATE
1256 YYSTACK_FREE (yyss1);
1259 #endif /* no yyoverflow */
1261 yyssp = yyss + yysize - 1;
1262 yyvsp = yyvs + yysize - 1;
1264 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1265 (unsigned long int) yystacksize));
1267 if (yyss + yystacksize - 1 <= yyssp)
1271 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1273 if (yystate == YYFINAL)
1283 /* Do appropriate processing given the current state. Read a
1284 lookahead token if we need one and don't already have one. */
1286 /* First try to decide what to do without reference to lookahead token. */
1287 yyn = yypact[yystate];
1288 if (yyn == YYPACT_NINF)
1291 /* Not known => get a lookahead token if don't already have one. */
1293 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1294 if (yychar == YYEMPTY)
1296 YYDPRINTF ((stderr, "Reading a token: "));
1300 if (yychar <= YYEOF)
1302 yychar = yytoken = YYEOF;
1303 YYDPRINTF ((stderr, "Now at end of input.\n"));
1307 yytoken = YYTRANSLATE (yychar);
1308 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1311 /* If the proper action on seeing token YYTOKEN is to reduce or to
1312 detect an error, take that action. */
1314 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1319 if (yyn == 0 || yyn == YYTABLE_NINF)
1325 /* Count tokens shifted since error; after three, turn off error
1330 /* Shift the lookahead token. */
1331 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1333 /* Discard the shifted token. */
1342 /*-----------------------------------------------------------.
1343 | yydefault -- do the default action for the current state. |
1344 `-----------------------------------------------------------*/
1346 yyn = yydefact[yystate];
1352 /*-----------------------------.
1353 | yyreduce -- Do a reduction. |
1354 `-----------------------------*/
1356 /* yyn is the number of a rule to reduce with. */
1359 /* If YYLEN is nonzero, implement the default value of the action:
1362 Otherwise, the following line sets YYVAL to garbage.
1363 This behavior is undocumented and Bison
1364 users should not rely upon it. Assigning to YYVAL
1365 unconditionally makes the parser a bit smaller, and it avoids a
1366 GCC warning that YYVAL may be used uninitialized. */
1367 yyval = yyvsp[1-yylen];
1370 YY_REDUCE_PRINT (yyn);
1375 { cur_parent = cur_bus = head; ;}
1380 { postprocess_devtree(); ;}
1386 (yyval.device) = new_chip(cur_parent, cur_bus, (yyvsp[(2) - (2)].string));
1387 cur_parent = (yyval.device);
1394 cur_parent = (yyvsp[(3) - (5)].device)->parent;
1395 fold_in((yyvsp[(3) - (5)].device));
1396 add_header((yyvsp[(3) - (5)].device));
1403 (yyval.device) = new_device(cur_parent, cur_bus, (yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].number));
1404 cur_parent = (yyval.device);
1405 cur_bus = (yyval.device);
1412 cur_parent = (yyvsp[(5) - (7)].device)->parent;
1413 cur_bus = (yyvsp[(5) - (7)].device)->bus;
1414 fold_in((yyvsp[(5) - (7)].device));
1415 alias_siblings((yyvsp[(5) - (7)].device)->children);
1421 { add_resource(cur_parent, (yyvsp[(1) - (4)].number), strtol((yyvsp[(2) - (4)].string), NULL, 0), strtol((yyvsp[(4) - (4)].string), NULL, 0)); ;}
1426 { add_register(cur_parent, (yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].string)); ;}
1433 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1437 YY_STACK_PRINT (yyss, yyssp);
1441 /* Now `shift' the result of the reduction. Determine what state
1442 that goes to, based on the state we popped back to and the rule
1443 number reduced by. */
1447 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1448 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1449 yystate = yytable[yystate];
1451 yystate = yydefgoto[yyn - YYNTOKENS];
1456 /*------------------------------------.
1457 | yyerrlab -- here on detecting error |
1458 `------------------------------------*/
1460 /* If not already recovering from an error, report this error. */
1464 #if ! YYERROR_VERBOSE
1465 yyerror (YY_("syntax error"));
1468 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1469 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1471 YYSIZE_T yyalloc = 2 * yysize;
1472 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1473 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1474 if (yymsg != yymsgbuf)
1475 YYSTACK_FREE (yymsg);
1476 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1478 yymsg_alloc = yyalloc;
1482 yymsg_alloc = sizeof yymsgbuf;
1486 if (0 < yysize && yysize <= yymsg_alloc)
1488 (void) yysyntax_error (yymsg, yystate, yychar);
1493 yyerror (YY_("syntax error"));
1495 goto yyexhaustedlab;
1503 if (yyerrstatus == 3)
1505 /* If just tried and failed to reuse lookahead token after an
1506 error, discard it. */
1508 if (yychar <= YYEOF)
1510 /* Return failure if at end of input. */
1511 if (yychar == YYEOF)
1516 yydestruct ("Error: discarding",
1522 /* Else will try to reuse lookahead token after shifting the error
1527 /*---------------------------------------------------.
1528 | yyerrorlab -- error raised explicitly by YYERROR. |
1529 `---------------------------------------------------*/
1532 /* Pacify compilers like GCC when the user code never invokes
1533 YYERROR and the label yyerrorlab therefore never appears in user
1535 if (/*CONSTCOND*/ 0)
1538 /* Do not reclaim the symbols of the rule which action triggered
1542 YY_STACK_PRINT (yyss, yyssp);
1547 /*-------------------------------------------------------------.
1548 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1549 `-------------------------------------------------------------*/
1551 yyerrstatus = 3; /* Each real token shifted decrements this. */
1555 yyn = yypact[yystate];
1556 if (yyn != YYPACT_NINF)
1559 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1567 /* Pop the current state because it cannot handle the error token. */
1572 yydestruct ("Error: popping",
1573 yystos[yystate], yyvsp);
1576 YY_STACK_PRINT (yyss, yyssp);
1582 /* Shift the error token. */
1583 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1589 /*-------------------------------------.
1590 | yyacceptlab -- YYACCEPT comes here. |
1591 `-------------------------------------*/
1596 /*-----------------------------------.
1597 | yyabortlab -- YYABORT comes here. |
1598 `-----------------------------------*/
1603 #if !defined(yyoverflow) || YYERROR_VERBOSE
1604 /*-------------------------------------------------.
1605 | yyexhaustedlab -- memory exhaustion comes here. |
1606 `-------------------------------------------------*/
1608 yyerror (YY_("memory exhausted"));
1614 if (yychar != YYEMPTY)
1615 yydestruct ("Cleanup: discarding lookahead",
1617 /* Do not reclaim the symbols of the rule which action triggered
1618 this YYABORT or YYACCEPT. */
1620 YY_STACK_PRINT (yyss, yyssp);
1621 while (yyssp != yyss)
1623 yydestruct ("Cleanup: popping",
1624 yystos[*yyssp], yyvsp);
1629 YYSTACK_FREE (yyss);
1632 if (yymsg != yymsgbuf)
1633 YYSTACK_FREE (yymsg);
1635 /* Make sure YYID is used. */
1636 return YYID (yyresult);