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 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, 5, 7, 9, 12, 15, 16, 19,
440 22, 23, 24, 30, 31, 39, 44
443 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
444 static const yytype_int8 yyrhs[] =
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
453 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
454 static const yytype_uint8 yyrline[] =
456 0, 34, 34, 36, 36, 38, 38, 38, 40, 40,
457 40, 42, 42, 52, 52, 64, 67
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. */
464 static const char *const yytname[] =
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
475 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
477 static const yytype_uint16 yytoknum[] =
479 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
480 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
485 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
486 static const yytype_uint8 yyr1[] =
488 0, 23, 24, 25, 25, 26, 26, 26, 27, 27,
489 27, 29, 28, 31, 30, 32, 33
492 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
493 static const yytype_uint8 yyr2[] =
495 0, 2, 1, 1, 1, 2, 2, 0, 2, 2,
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. */
502 static const yytype_uint8 yydefact[] =
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
509 /* YYDEFGOTO[NTERM-NUM]. */
510 static const yytype_int8 yydefgoto[] =
512 -1, 3, 4, 12, 20, 5, 10, 6, 18, 25,
516 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
518 #define YYPACT_NINF -13
519 static const yytype_int8 yypact[] =
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
526 /* YYPGOTO[NTERM-NUM]. */
527 static const yytype_int8 yypgoto[] =
529 -13, -13, -12, -13, -13, -13, -13, -13, -13, -13,
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
538 static const yytype_uint8 yytable[] =
540 16, 1, 2, 14, 1, 2, 7, 15, 24, 22,
541 23, 1, 2, 8, 9, 11, 13, 19, 27, 21,
545 static const yytype_int8 yycheck[] =
547 12, 3, 4, 5, 3, 4, 12, 9, 20, 8,
548 9, 3, 4, 7, 0, 22, 6, 12, 22, 10,
552 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
553 symbol of state STATE-NUM. */
554 static const yytype_uint8 yystos[] =
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
561 #define yyerrok (yyerrstatus = 0)
562 #define yyclearin (yychar = YYEMPTY)
566 #define YYACCEPT goto yyacceptlab
567 #define YYABORT goto yyabortlab
568 #define YYERROR goto yyerrorlab
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. */
575 #define YYFAIL goto yyerrlab
577 #define YYRECOVERING() (!!yyerrstatus)
579 #define YYBACKUP(Token, Value) \
581 if (yychar == YYEMPTY && yylen == 1) \
585 yytoken = YYTRANSLATE (yychar); \
591 yyerror (YY_("syntax error: cannot back up")); \
598 #define YYERRCODE 256
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). */
605 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
606 #ifndef YYLLOC_DEFAULT
607 # define YYLLOC_DEFAULT(Current, Rhs, N) \
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; \
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; \
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. */
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)
638 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
643 /* YYLEX -- calling `yylex' with the right arguments. */
646 # define YYLEX yylex (YYLEX_PARAM)
648 # define YYLEX yylex ()
651 /* Enable debugging if requested. */
655 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
656 # define YYFPRINTF fprintf
659 # define YYDPRINTF(Args) \
665 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
669 YYFPRINTF (stderr, "%s ", Title); \
670 yy_symbol_print (stderr, \
672 YYFPRINTF (stderr, "\n"); \
677 /*--------------------------------.
678 | Print this symbol on YYOUTPUT. |
679 `--------------------------------*/
682 #if (defined __STDC__ || defined __C99__FUNC__ \
683 || defined __cplusplus || defined _MSC_VER)
685 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
688 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
691 YYSTYPE const * const yyvaluep;
697 if (yytype < YYNTOKENS)
698 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
710 /*--------------------------------.
711 | Print this symbol on YYOUTPUT. |
712 `--------------------------------*/
714 #if (defined __STDC__ || defined __C99__FUNC__ \
715 || defined __cplusplus || defined _MSC_VER)
717 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
720 yy_symbol_print (yyoutput, yytype, yyvaluep)
723 YYSTYPE const * const yyvaluep;
726 if (yytype < YYNTOKENS)
727 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
729 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
731 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
732 YYFPRINTF (yyoutput, ")");
735 /*------------------------------------------------------------------.
736 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
738 `------------------------------------------------------------------*/
740 #if (defined __STDC__ || defined __C99__FUNC__ \
741 || defined __cplusplus || defined _MSC_VER)
743 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
746 yy_stack_print (yybottom, yytop)
747 yytype_int16 *yybottom;
751 YYFPRINTF (stderr, "Stack now");
752 for (; yybottom <= yytop; yybottom++)
754 int yybot = *yybottom;
755 YYFPRINTF (stderr, " %d", yybot);
757 YYFPRINTF (stderr, "\n");
760 # define YY_STACK_PRINT(Bottom, Top) \
763 yy_stack_print ((Bottom), (Top)); \
767 /*------------------------------------------------.
768 | Report that the YYRULE is going to be reduced. |
769 `------------------------------------------------*/
771 #if (defined __STDC__ || defined __C99__FUNC__ \
772 || defined __cplusplus || defined _MSC_VER)
774 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
777 yy_reduce_print (yyvsp, yyrule)
782 int yynrhs = yyr2[yyrule];
784 unsigned long int yylno = yyrline[yyrule];
785 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
787 /* The symbols being reduced. */
788 for (yyi = 0; yyi < yynrhs; yyi++)
790 YYFPRINTF (stderr, " $%d = ", yyi + 1);
791 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
792 &(yyvsp[(yyi + 1) - (yynrhs)])
794 YYFPRINTF (stderr, "\n");
798 # define YY_REDUCE_PRINT(Rule) \
801 yy_reduce_print (yyvsp, Rule); \
804 /* Nonzero means print parse trace. It is left uninitialized so that
805 multiple parsers can coexist. */
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 */
815 /* YYINITDEPTH -- initial size of the parser's stacks. */
817 # define YYINITDEPTH 200
820 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
821 if the built-in stack extension method is used).
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. */
828 # define YYMAXDEPTH 10000
836 # if defined __GLIBC__ && defined _STRING_H
837 # define yystrlen strlen
839 /* Return the length of YYSTR. */
840 #if (defined __STDC__ || defined __C99__FUNC__ \
841 || defined __cplusplus || defined _MSC_VER)
843 yystrlen (const char *yystr)
851 for (yylen = 0; yystr[yylen]; yylen++)
859 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
860 # define yystpcpy stpcpy
862 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
864 #if (defined __STDC__ || defined __C99__FUNC__ \
865 || defined __cplusplus || defined _MSC_VER)
867 yystpcpy (char *yydest, const char *yysrc)
870 yystpcpy (yydest, yysrc)
876 const char *yys = yysrc;
878 while ((*yyd++ = *yys++) != '\0')
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
895 yytnamerr (char *yyres, const char *yystr)
900 char const *yyp = yystr;
907 goto do_not_strip_quotes;
911 goto do_not_strip_quotes;
924 do_not_strip_quotes: ;
928 return yystrlen (yystr);
930 return yystpcpy (yyres, yystr) - yyres;
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
942 yysyntax_error (char *yyresult, int yystate, int yychar)
944 int yyn = yypact[yystate];
946 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
950 int yytype = YYTRANSLATE (yychar);
951 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
952 YYSIZE_T yysize = yysize0;
954 int yysize_overflow = 0;
955 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
956 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
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");
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;
979 /* Start YYX at -YYN if negative to avoid negative indexes in
981 int yyxbegin = yyn < 0 ? -yyn : 0;
983 /* Stay within bounds of both yycheck and yytname. */
984 int yychecklim = YYLAST - yyn + 1;
985 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
988 yyarg[0] = yytname[yytype];
989 yyfmt = yystpcpy (yyformat, yyunexpected);
991 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
992 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
994 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
998 yyformat[sizeof yyunexpected - 1] = '\0';
1001 yyarg[yycount++] = yytname[yyx];
1002 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1003 yysize_overflow |= (yysize1 < yysize);
1005 yyfmt = yystpcpy (yyfmt, yyprefix);
1009 yyf = YY_(yyformat);
1010 yysize1 = yysize + yystrlen (yyf);
1011 yysize_overflow |= (yysize1 < yysize);
1014 if (yysize_overflow)
1015 return YYSIZE_MAXIMUM;
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;
1024 while ((*yyp = *yyf) != '\0')
1026 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1028 yyp += yytnamerr (yyp, yyarg[yyi++]);
1041 #endif /* YYERROR_VERBOSE */
1044 /*-----------------------------------------------.
1045 | Release the memory associated to this symbol. |
1046 `-----------------------------------------------*/
1049 #if (defined __STDC__ || defined __C99__FUNC__ \
1050 || defined __cplusplus || defined _MSC_VER)
1052 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1055 yydestruct (yymsg, yytype, yyvaluep)
1065 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1075 /* Prevent warnings from -Wmissing-prototypes. */
1076 #ifdef YYPARSE_PARAM
1077 #if defined __STDC__ || defined __cplusplus
1078 int yyparse (void *YYPARSE_PARAM);
1082 #else /* ! YYPARSE_PARAM */
1083 #if defined __STDC__ || defined __cplusplus
1088 #endif /* ! YYPARSE_PARAM */
1091 /* The lookahead symbol. */
1094 /* The semantic value of the lookahead symbol. */
1097 /* Number of syntax errors so far. */
1102 /*-------------------------.
1103 | yyparse or yypush_parse. |
1104 `-------------------------*/
1106 #ifdef YYPARSE_PARAM
1107 #if (defined __STDC__ || defined __C99__FUNC__ \
1108 || defined __cplusplus || defined _MSC_VER)
1110 yyparse (void *YYPARSE_PARAM)
1113 yyparse (YYPARSE_PARAM)
1114 void *YYPARSE_PARAM;
1116 #else /* ! YYPARSE_PARAM */
1117 #if (defined __STDC__ || defined __C99__FUNC__ \
1118 || defined __cplusplus || defined _MSC_VER)
1131 /* Number of tokens to shift before error messages enabled. */
1134 /* The stacks and their tools:
1135 `yyss': related to states.
1136 `yyvs': related to semantic values.
1138 Refer to the stacks thru separate pointers, to allow yyoverflow
1139 to reallocate them elsewhere. */
1141 /* The state stack. */
1142 yytype_int16 yyssa[YYINITDEPTH];
1144 yytype_int16 *yyssp;
1146 /* The semantic value stack. */
1147 YYSTYPE yyvsa[YYINITDEPTH];
1151 YYSIZE_T yystacksize;
1155 /* Lookahead token as an internal (translated) token number. */
1157 /* The variables used to return semantic value and location from the
1162 /* Buffer for error messages, and its allocated size. */
1164 char *yymsg = yymsgbuf;
1165 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1168 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1170 /* The number of symbols on the RHS of the reduced rule.
1171 Keep to zero when no symbol should be popped. */
1177 yystacksize = YYINITDEPTH;
1179 YYDPRINTF ((stderr, "Starting parse\n"));
1184 yychar = YYEMPTY; /* Cause a token to be read. */
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. */
1195 /*------------------------------------------------------------.
1196 | yynewstate -- Push a new state, which is found in yystate. |
1197 `------------------------------------------------------------*/
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. */
1206 if (yyss + yystacksize - 1 <= yyssp)
1208 /* Get the current used size of the three stacks, in elements. */
1209 YYSIZE_T yysize = yyssp - yyss + 1;
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
1216 YYSTYPE *yyvs1 = yyvs;
1217 yytype_int16 *yyss1 = yyss;
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),
1231 #else /* no yyoverflow */
1232 # ifndef YYSTACK_RELOCATE
1233 goto yyexhaustedlab;
1235 /* Extend the stack our own way. */
1236 if (YYMAXDEPTH <= yystacksize)
1237 goto yyexhaustedlab;
1239 if (YYMAXDEPTH < yystacksize)
1240 yystacksize = YYMAXDEPTH;
1243 yytype_int16 *yyss1 = yyss;
1244 union yyalloc *yyptr =
1245 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1247 goto yyexhaustedlab;
1248 YYSTACK_RELOCATE (yyss_alloc, yyss);
1249 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1250 # undef YYSTACK_RELOCATE
1252 YYSTACK_FREE (yyss1);
1255 #endif /* no yyoverflow */
1257 yyssp = yyss + yysize - 1;
1258 yyvsp = yyvs + yysize - 1;
1260 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1261 (unsigned long int) yystacksize));
1263 if (yyss + yystacksize - 1 <= yyssp)
1267 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1269 if (yystate == YYFINAL)
1279 /* Do appropriate processing given the current state. Read a
1280 lookahead token if we need one and don't already have one. */
1282 /* First try to decide what to do without reference to lookahead token. */
1283 yyn = yypact[yystate];
1284 if (yyn == YYPACT_NINF)
1287 /* Not known => get a lookahead token if don't already have one. */
1289 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1290 if (yychar == YYEMPTY)
1292 YYDPRINTF ((stderr, "Reading a token: "));
1296 if (yychar <= YYEOF)
1298 yychar = yytoken = YYEOF;
1299 YYDPRINTF ((stderr, "Now at end of input.\n"));
1303 yytoken = YYTRANSLATE (yychar);
1304 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1307 /* If the proper action on seeing token YYTOKEN is to reduce or to
1308 detect an error, take that action. */
1310 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1315 if (yyn == 0 || yyn == YYTABLE_NINF)
1321 /* Count tokens shifted since error; after three, turn off error
1326 /* Shift the lookahead token. */
1327 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1329 /* Discard the shifted token. */
1338 /*-----------------------------------------------------------.
1339 | yydefault -- do the default action for the current state. |
1340 `-----------------------------------------------------------*/
1342 yyn = yydefact[yystate];
1348 /*-----------------------------.
1349 | yyreduce -- Do a reduction. |
1350 `-----------------------------*/
1352 /* yyn is the number of a rule to reduce with. */
1355 /* If YYLEN is nonzero, implement the default value of the action:
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];
1366 YY_REDUCE_PRINT (yyn);
1371 { postprocess_devtree(); ;}
1377 (yyval.device) = new_chip((yyvsp[(2) - (2)].string));
1378 cur_parent = (yyval.device);
1385 cur_parent = (yyvsp[(3) - (5)].device)->parent;
1386 fold_in((yyvsp[(3) - (5)].device));
1387 add_header((yyvsp[(3) - (5)].device));
1394 (yyval.device) = new_device((yyvsp[(2) - (4)].number), (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].number));
1395 cur_parent = (yyval.device);
1396 cur_bus = (yyval.device);
1403 cur_parent = (yyvsp[(5) - (7)].device)->parent;
1404 cur_bus = (yyvsp[(5) - (7)].device)->bus;
1405 fold_in((yyvsp[(5) - (7)].device));
1406 alias_siblings((yyvsp[(5) - (7)].device)->children);
1412 { add_resource((yyvsp[(1) - (4)].number), strtol((yyvsp[(2) - (4)].string), NULL, 0), strtol((yyvsp[(4) - (4)].string), NULL, 0)); ;}
1417 { add_register((yyvsp[(2) - (4)].string), (yyvsp[(4) - (4)].string)); ;}
1424 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1428 YY_STACK_PRINT (yyss, yyssp);
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. */
1438 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1439 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1440 yystate = yytable[yystate];
1442 yystate = yydefgoto[yyn - YYNTOKENS];
1447 /*------------------------------------.
1448 | yyerrlab -- here on detecting error |
1449 `------------------------------------*/
1451 /* If not already recovering from an error, report this error. */
1455 #if ! YYERROR_VERBOSE
1456 yyerror (YY_("syntax error"));
1459 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1460 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
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);
1469 yymsg_alloc = yyalloc;
1473 yymsg_alloc = sizeof yymsgbuf;
1477 if (0 < yysize && yysize <= yymsg_alloc)
1479 (void) yysyntax_error (yymsg, yystate, yychar);
1484 yyerror (YY_("syntax error"));
1486 goto yyexhaustedlab;
1494 if (yyerrstatus == 3)
1496 /* If just tried and failed to reuse lookahead token after an
1497 error, discard it. */
1499 if (yychar <= YYEOF)
1501 /* Return failure if at end of input. */
1502 if (yychar == YYEOF)
1507 yydestruct ("Error: discarding",
1513 /* Else will try to reuse lookahead token after shifting the error
1518 /*---------------------------------------------------.
1519 | yyerrorlab -- error raised explicitly by YYERROR. |
1520 `---------------------------------------------------*/
1523 /* Pacify compilers like GCC when the user code never invokes
1524 YYERROR and the label yyerrorlab therefore never appears in user
1526 if (/*CONSTCOND*/ 0)
1529 /* Do not reclaim the symbols of the rule which action triggered
1533 YY_STACK_PRINT (yyss, yyssp);
1538 /*-------------------------------------------------------------.
1539 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1540 `-------------------------------------------------------------*/
1542 yyerrstatus = 3; /* Each real token shifted decrements this. */
1546 yyn = yypact[yystate];
1547 if (yyn != YYPACT_NINF)
1550 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1558 /* Pop the current state because it cannot handle the error token. */
1563 yydestruct ("Error: popping",
1564 yystos[yystate], yyvsp);
1567 YY_STACK_PRINT (yyss, yyssp);
1573 /* Shift the error token. */
1574 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1580 /*-------------------------------------.
1581 | yyacceptlab -- YYACCEPT comes here. |
1582 `-------------------------------------*/
1587 /*-----------------------------------.
1588 | yyabortlab -- YYABORT comes here. |
1589 `-----------------------------------*/
1594 #if !defined(yyoverflow) || YYERROR_VERBOSE
1595 /*-------------------------------------------------.
1596 | yyexhaustedlab -- memory exhaustion comes here. |
1597 `-------------------------------------------------*/
1599 yyerror (YY_("memory exhausted"));
1605 if (yychar != YYEMPTY)
1606 yydestruct ("Cleanup: discarding lookahead",
1608 /* Do not reclaim the symbols of the rule which action triggered
1609 this YYABORT or YYACCEPT. */
1611 YY_STACK_PRINT (yyss, yyssp);
1612 while (yyssp != yyss)
1614 yydestruct ("Cleanup: popping",
1615 yystos[*yyssp], yyvsp);
1620 YYSTACK_FREE (yyss);
1623 if (yymsg != yymsgbuf)
1624 YYSTACK_FREE (yymsg);
1626 /* Make sure YYID is used. */
1627 return YYID (yyresult);