blob: 27129377e5d217dce3ca2a4501f9c36a6b181071 [file] [log] [blame]
David Gibsona4da2e32007-12-18 15:06:42 +11001/* A Bison parser, made by GNU Bison 2.3. */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23/* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36/* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39/* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46/* Identify Bison output. */
47#define YYBISON 1
48
49/* Bison version. */
50#define YYBISON_VERSION "2.3"
51
52/* Skeleton name. */
53#define YYSKELETON_NAME "yacc.c"
54
55/* Pure parsers. */
56#define YYPURE 0
57
58/* Using locations. */
59#define YYLSP_NEEDED 1
60
61
62
63/* Tokens. */
64#ifndef YYTOKENTYPE
65# define YYTOKENTYPE
66 /* Put the tokens into the symbol table, so that GDB and other debuggers
67 know about them. */
68 enum yytokentype {
69 DT_V1 = 258,
70 DT_MEMRESERVE = 259,
71 DT_PROPNODENAME = 260,
72 DT_LITERAL = 261,
73 DT_LEGACYLITERAL = 262,
74 DT_BASE = 263,
75 DT_BYTE = 264,
76 DT_STRING = 265,
77 DT_LABEL = 266,
David Gibsoned95d742008-08-07 12:24:17 +100078 DT_REF = 267,
79 DT_INCBIN = 268
David Gibsona4da2e32007-12-18 15:06:42 +110080 };
81#endif
82/* Tokens. */
83#define DT_V1 258
84#define DT_MEMRESERVE 259
85#define DT_PROPNODENAME 260
86#define DT_LITERAL 261
87#define DT_LEGACYLITERAL 262
88#define DT_BASE 263
89#define DT_BYTE 264
90#define DT_STRING 265
91#define DT_LABEL 266
92#define DT_REF 267
David Gibsoned95d742008-08-07 12:24:17 +100093#define DT_INCBIN 268
David Gibsona4da2e32007-12-18 15:06:42 +110094
95
96
97
98/* Copy the first part of user declarations. */
99#line 23 "dtc-parser.y"
100
David Gibsoned95d742008-08-07 12:24:17 +1000101#include <stdio.h>
102
David Gibsona4da2e32007-12-18 15:06:42 +1100103#include "dtc.h"
104#include "srcpos.h"
105
David Gibsoned95d742008-08-07 12:24:17 +1000106extern int yylex(void);
David Gibsona4da2e32007-12-18 15:06:42 +1100107
108extern struct boot_info *the_boot_info;
David Gibsoned95d742008-08-07 12:24:17 +1000109extern int treesource_error;
David Gibsona4da2e32007-12-18 15:06:42 +1100110
David Gibsoned95d742008-08-07 12:24:17 +1000111static unsigned long long eval_literal(const char *s, int base, int bits);
David Gibsona4da2e32007-12-18 15:06:42 +1100112
113
114/* Enabling traces. */
115#ifndef YYDEBUG
116# define YYDEBUG 0
117#endif
118
119/* Enabling verbose error messages. */
120#ifdef YYERROR_VERBOSE
121# undef YYERROR_VERBOSE
122# define YYERROR_VERBOSE 1
123#else
124# define YYERROR_VERBOSE 0
125#endif
126
127/* Enabling the token table. */
128#ifndef YYTOKEN_TABLE
129# define YYTOKEN_TABLE 0
130#endif
131
132#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
133typedef union YYSTYPE
David Gibsoned95d742008-08-07 12:24:17 +1000134#line 37 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +1100135{
136 char *propnodename;
137 char *literal;
138 char *labelref;
139 unsigned int cbase;
David Gibsoned95d742008-08-07 12:24:17 +1000140 uint8_t byte;
David Gibsona4da2e32007-12-18 15:06:42 +1100141 struct data data;
142
David Gibsoned95d742008-08-07 12:24:17 +1000143 uint64_t addr;
David Gibsona4da2e32007-12-18 15:06:42 +1100144 cell_t cell;
145 struct property *prop;
146 struct property *proplist;
147 struct node *node;
148 struct node *nodelist;
149 struct reserve_info *re;
150}
151/* Line 187 of yacc.c. */
David Gibsoned95d742008-08-07 12:24:17 +1000152#line 153 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100153 YYSTYPE;
154# define yystype YYSTYPE /* obsolescent; will be withdrawn */
155# define YYSTYPE_IS_DECLARED 1
156# define YYSTYPE_IS_TRIVIAL 1
157#endif
158
159#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
160typedef struct YYLTYPE
161{
162 int first_line;
163 int first_column;
164 int last_line;
165 int last_column;
166} YYLTYPE;
167# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
168# define YYLTYPE_IS_DECLARED 1
169# define YYLTYPE_IS_TRIVIAL 1
170#endif
171
172
173/* Copy the second part of user declarations. */
174
175
176/* Line 216 of yacc.c. */
David Gibsoned95d742008-08-07 12:24:17 +1000177#line 178 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100178
179#ifdef short
180# undef short
181#endif
182
183#ifdef YYTYPE_UINT8
184typedef YYTYPE_UINT8 yytype_uint8;
185#else
186typedef unsigned char yytype_uint8;
187#endif
188
189#ifdef YYTYPE_INT8
190typedef YYTYPE_INT8 yytype_int8;
191#elif (defined __STDC__ || defined __C99__FUNC__ \
192 || defined __cplusplus || defined _MSC_VER)
193typedef signed char yytype_int8;
194#else
195typedef short int yytype_int8;
196#endif
197
198#ifdef YYTYPE_UINT16
199typedef YYTYPE_UINT16 yytype_uint16;
200#else
201typedef unsigned short int yytype_uint16;
202#endif
203
204#ifdef YYTYPE_INT16
205typedef YYTYPE_INT16 yytype_int16;
206#else
207typedef short int yytype_int16;
208#endif
209
210#ifndef YYSIZE_T
211# ifdef __SIZE_TYPE__
212# define YYSIZE_T __SIZE_TYPE__
213# elif defined size_t
214# define YYSIZE_T size_t
215# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
216 || defined __cplusplus || defined _MSC_VER)
217# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
218# define YYSIZE_T size_t
219# else
220# define YYSIZE_T unsigned int
221# endif
222#endif
223
224#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
225
226#ifndef YY_
227# if YYENABLE_NLS
228# if ENABLE_NLS
229# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
230# define YY_(msgid) dgettext ("bison-runtime", msgid)
231# endif
232# endif
233# ifndef YY_
234# define YY_(msgid) msgid
235# endif
236#endif
237
238/* Suppress unused-variable warnings by "using" E. */
239#if ! defined lint || defined __GNUC__
240# define YYUSE(e) ((void) (e))
241#else
242# define YYUSE(e) /* empty */
243#endif
244
245/* Identity function, used to suppress warnings about constant conditions. */
246#ifndef lint
247# define YYID(n) (n)
248#else
249#if (defined __STDC__ || defined __C99__FUNC__ \
250 || defined __cplusplus || defined _MSC_VER)
251static int
252YYID (int i)
253#else
254static int
255YYID (i)
256 int i;
257#endif
258{
259 return i;
260}
261#endif
262
263#if ! defined yyoverflow || YYERROR_VERBOSE
264
265/* The parser invokes alloca or malloc; define the necessary symbols. */
266
267# ifdef YYSTACK_USE_ALLOCA
268# if YYSTACK_USE_ALLOCA
269# ifdef __GNUC__
270# define YYSTACK_ALLOC __builtin_alloca
271# elif defined __BUILTIN_VA_ARG_INCR
272# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
273# elif defined _AIX
274# define YYSTACK_ALLOC __alloca
275# elif defined _MSC_VER
276# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
277# define alloca _alloca
278# else
279# define YYSTACK_ALLOC alloca
280# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
281 || defined __cplusplus || defined _MSC_VER)
282# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
283# ifndef _STDLIB_H
284# define _STDLIB_H 1
285# endif
286# endif
287# endif
288# endif
289# endif
290
291# ifdef YYSTACK_ALLOC
292 /* Pacify GCC's `empty if-body' warning. */
293# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
294# ifndef YYSTACK_ALLOC_MAXIMUM
295 /* The OS might guarantee only one guard page at the bottom of the stack,
296 and a page size can be as small as 4096 bytes. So we cannot safely
297 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
298 to allow for a few compiler-allocated temporary stack slots. */
299# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
300# endif
301# else
302# define YYSTACK_ALLOC YYMALLOC
303# define YYSTACK_FREE YYFREE
304# ifndef YYSTACK_ALLOC_MAXIMUM
305# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
306# endif
307# if (defined __cplusplus && ! defined _STDLIB_H \
308 && ! ((defined YYMALLOC || defined malloc) \
309 && (defined YYFREE || defined free)))
310# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
311# ifndef _STDLIB_H
312# define _STDLIB_H 1
313# endif
314# endif
315# ifndef YYMALLOC
316# define YYMALLOC malloc
317# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
318 || defined __cplusplus || defined _MSC_VER)
319void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
320# endif
321# endif
322# ifndef YYFREE
323# define YYFREE free
324# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
325 || defined __cplusplus || defined _MSC_VER)
326void free (void *); /* INFRINGES ON USER NAME SPACE */
327# endif
328# endif
329# endif
330#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
331
332
333#if (! defined yyoverflow \
334 && (! defined __cplusplus \
335 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
336 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
337
338/* A type that is properly aligned for any stack member. */
339union yyalloc
340{
341 yytype_int16 yyss;
342 YYSTYPE yyvs;
343 YYLTYPE yyls;
344};
345
346/* The size of the maximum gap between one aligned stack and the next. */
347# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
348
349/* The size of an array large to enough to hold all stacks, each with
350 N elements. */
351# define YYSTACK_BYTES(N) \
352 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
353 + 2 * YYSTACK_GAP_MAXIMUM)
354
355/* Copy COUNT objects from FROM to TO. The source and destination do
356 not overlap. */
357# ifndef YYCOPY
358# if defined __GNUC__ && 1 < __GNUC__
359# define YYCOPY(To, From, Count) \
360 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
361# else
362# define YYCOPY(To, From, Count) \
363 do \
364 { \
365 YYSIZE_T yyi; \
366 for (yyi = 0; yyi < (Count); yyi++) \
367 (To)[yyi] = (From)[yyi]; \
368 } \
369 while (YYID (0))
370# endif
371# endif
372
373/* Relocate STACK from its old location to the new one. The
374 local variables YYSIZE and YYSTACKSIZE give the old and new number of
375 elements in the stack, and YYPTR gives the new location of the
376 stack. Advance YYPTR to a properly aligned location for the next
377 stack. */
378# define YYSTACK_RELOCATE(Stack) \
379 do \
380 { \
381 YYSIZE_T yynewbytes; \
382 YYCOPY (&yyptr->Stack, Stack, yysize); \
383 Stack = &yyptr->Stack; \
384 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
385 yyptr += yynewbytes / sizeof (*yyptr); \
386 } \
387 while (YYID (0))
388
389#endif
390
391/* YYFINAL -- State number of the termination state. */
392#define YYFINAL 9
393/* YYLAST -- Last index in YYTABLE. */
David Gibsoned95d742008-08-07 12:24:17 +1000394#define YYLAST 73
David Gibsona4da2e32007-12-18 15:06:42 +1100395
396/* YYNTOKENS -- Number of terminals. */
David Gibsoned95d742008-08-07 12:24:17 +1000397#define YYNTOKENS 27
David Gibsona4da2e32007-12-18 15:06:42 +1100398/* YYNNTS -- Number of nonterminals. */
399#define YYNNTS 20
400/* YYNRULES -- Number of rules. */
David Gibsoned95d742008-08-07 12:24:17 +1000401#define YYNRULES 45
David Gibsona4da2e32007-12-18 15:06:42 +1100402/* YYNRULES -- Number of states. */
David Gibsoned95d742008-08-07 12:24:17 +1000403#define YYNSTATES 76
David Gibsona4da2e32007-12-18 15:06:42 +1100404
405/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
406#define YYUNDEFTOK 2
David Gibsoned95d742008-08-07 12:24:17 +1000407#define YYMAXUTOK 268
David Gibsona4da2e32007-12-18 15:06:42 +1100408
409#define YYTRANSLATE(YYX) \
410 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
411
412/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
413static const yytype_uint8 yytranslate[] =
414{
415 0, 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,
David Gibsoned95d742008-08-07 12:24:17 +1000419 24, 26, 2, 2, 25, 15, 2, 16, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 14,
421 20, 19, 21, 2, 2, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
David Gibsoned95d742008-08-07 12:24:17 +1000424 2, 22, 2, 23, 2, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
David Gibsoned95d742008-08-07 12:24:17 +1000427 2, 2, 2, 17, 2, 18, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100428 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, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
David Gibsoned95d742008-08-07 12:24:17 +1000441 5, 6, 7, 8, 9, 10, 11, 12, 13
David Gibsona4da2e32007-12-18 15:06:42 +1100442};
443
444#if YYDEBUG
445/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
446 YYRHS. */
447static const yytype_uint8 yyprhs[] =
448{
449 0, 0, 3, 8, 11, 12, 15, 21, 22, 25,
450 27, 34, 36, 38, 41, 47, 48, 51, 57, 61,
David Gibsoned95d742008-08-07 12:24:17 +1000451 64, 69, 74, 77, 87, 93, 96, 97, 100, 103,
452 104, 107, 110, 113, 114, 116, 118, 121, 122, 125,
453 128, 129, 132, 135, 139, 140
David Gibsona4da2e32007-12-18 15:06:42 +1100454};
455
456/* YYRHS -- A `-1'-separated list of the rules' RHS. */
457static const yytype_int8 yyrhs[] =
458{
David Gibsoned95d742008-08-07 12:24:17 +1000459 28, 0, -1, 3, 14, 29, 34, -1, 31, 34,
460 -1, -1, 30, 29, -1, 46, 4, 33, 33, 14,
461 -1, -1, 32, 31, -1, 30, -1, 46, 4, 33,
462 15, 33, 14, -1, 6, -1, 7, -1, 16, 35,
463 -1, 17, 36, 44, 18, 14, -1, -1, 36, 37,
464 -1, 46, 5, 19, 38, 14, -1, 46, 5, 14,
465 -1, 39, 10, -1, 39, 20, 40, 21, -1, 39,
466 22, 43, 23, -1, 39, 12, -1, 39, 13, 24,
467 10, 25, 33, 25, 33, 26, -1, 39, 13, 24,
468 10, 26, -1, 38, 11, -1, -1, 38, 25, -1,
469 39, 11, -1, -1, 40, 42, -1, 40, 12, -1,
470 40, 11, -1, -1, 8, -1, 6, -1, 41, 7,
471 -1, -1, 43, 9, -1, 43, 11, -1, -1, 45,
472 44, -1, 45, 37, -1, 46, 5, 35, -1, -1,
473 11, -1
David Gibsona4da2e32007-12-18 15:06:42 +1100474};
475
476/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
477static const yytype_uint16 yyrline[] =
478{
David Gibsoned95d742008-08-07 12:24:17 +1000479 0, 89, 89, 93, 101, 104, 111, 119, 122, 129,
480 133, 140, 144, 151, 158, 166, 169, 176, 180, 187,
481 191, 195, 199, 203, 220, 231, 239, 242, 246, 254,
482 257, 261, 266, 274, 277, 281, 285, 293, 296, 300,
483 308, 311, 315, 323, 331, 334
David Gibsona4da2e32007-12-18 15:06:42 +1100484};
485#endif
486
487#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
488/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
489 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
490static const char *const yytname[] =
491{
492 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE",
493 "DT_PROPNODENAME", "DT_LITERAL", "DT_LEGACYLITERAL", "DT_BASE",
David Gibsoned95d742008-08-07 12:24:17 +1000494 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_REF", "DT_INCBIN", "';'", "'-'",
495 "'/'", "'{'", "'}'", "'='", "'<'", "'>'", "'['", "']'", "'('", "','",
496 "')'", "$accept", "sourcefile", "memreserves", "memreserve",
497 "v0_memreserves", "v0_memreserve", "addr", "devicetree", "nodedef",
498 "proplist", "propdef", "propdata", "propdataprefix", "celllist",
499 "cellbase", "cellval", "bytestring", "subnodes", "subnode", "label", 0
David Gibsona4da2e32007-12-18 15:06:42 +1100500};
501#endif
502
503# ifdef YYPRINT
504/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
505 token YYLEX-NUM. */
506static const yytype_uint16 yytoknum[] =
507{
508 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
David Gibsoned95d742008-08-07 12:24:17 +1000509 265, 266, 267, 268, 59, 45, 47, 123, 125, 61,
510 60, 62, 91, 93, 40, 44, 41
David Gibsona4da2e32007-12-18 15:06:42 +1100511};
512# endif
513
514/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
515static const yytype_uint8 yyr1[] =
516{
David Gibsoned95d742008-08-07 12:24:17 +1000517 0, 27, 28, 28, 29, 29, 30, 31, 31, 32,
518 32, 33, 33, 34, 35, 36, 36, 37, 37, 38,
519 38, 38, 38, 38, 38, 38, 39, 39, 39, 40,
520 40, 40, 40, 41, 41, 42, 42, 43, 43, 43,
521 44, 44, 44, 45, 46, 46
David Gibsona4da2e32007-12-18 15:06:42 +1100522};
523
524/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
525static const yytype_uint8 yyr2[] =
526{
527 0, 2, 4, 2, 0, 2, 5, 0, 2, 1,
528 6, 1, 1, 2, 5, 0, 2, 5, 3, 2,
David Gibsoned95d742008-08-07 12:24:17 +1000529 4, 4, 2, 9, 5, 2, 0, 2, 2, 0,
530 2, 2, 2, 0, 1, 1, 2, 0, 2, 2,
531 0, 2, 2, 3, 0, 1
David Gibsona4da2e32007-12-18 15:06:42 +1100532};
533
534/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
535 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
536 means the default is an error. */
537static const yytype_uint8 yydefact[] =
538{
David Gibsoned95d742008-08-07 12:24:17 +1000539 7, 0, 45, 0, 9, 0, 7, 0, 4, 1,
David Gibsona4da2e32007-12-18 15:06:42 +1100540 0, 3, 8, 0, 0, 4, 0, 15, 13, 11,
David Gibsoned95d742008-08-07 12:24:17 +1000541 12, 0, 2, 5, 0, 40, 0, 0, 0, 16,
542 0, 40, 0, 0, 6, 0, 42, 41, 0, 10,
543 14, 18, 26, 43, 0, 0, 25, 17, 27, 19,
544 28, 22, 0, 29, 37, 0, 33, 0, 0, 35,
545 34, 32, 31, 20, 0, 30, 38, 39, 21, 0,
546 24, 36, 0, 0, 0, 23
David Gibsona4da2e32007-12-18 15:06:42 +1100547};
548
549/* YYDEFGOTO[NTERM-NUM]. */
550static const yytype_int8 yydefgoto[] =
551{
552 -1, 3, 14, 4, 5, 6, 27, 11, 18, 25,
David Gibsoned95d742008-08-07 12:24:17 +1000553 29, 44, 45, 56, 64, 65, 57, 30, 31, 7
David Gibsona4da2e32007-12-18 15:06:42 +1100554};
555
556/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
557 STATE-NUM. */
David Gibsoned95d742008-08-07 12:24:17 +1000558#define YYPACT_NINF -14
David Gibsona4da2e32007-12-18 15:06:42 +1100559static const yytype_int8 yypact[] =
560{
David Gibsoned95d742008-08-07 12:24:17 +1000561 30, -11, -14, 7, -14, -1, 27, 13, 27, -14,
562 8, -14, -14, 40, -1, 27, 35, -14, -14, -14,
563 -14, 21, -14, -14, 40, 24, 40, 28, 40, -14,
564 32, 24, 46, 38, -14, 39, -14, -14, 26, -14,
565 -14, -14, -14, -14, -9, 10, -14, -14, -14, -14,
566 -14, -14, 31, -14, -14, 44, -2, 3, 23, -14,
567 -14, -14, -14, -14, 50, -14, -14, -14, -14, 40,
568 -14, -14, 33, 40, 36, -14
David Gibsona4da2e32007-12-18 15:06:42 +1100569};
570
571/* YYPGOTO[NTERM-NUM]. */
572static const yytype_int8 yypgoto[] =
573{
David Gibsoned95d742008-08-07 12:24:17 +1000574 -14, -14, 48, 29, 53, -14, -13, 47, 34, -14,
575 37, -14, -14, -14, -14, -14, -14, 42, -14, -7
David Gibsona4da2e32007-12-18 15:06:42 +1100576};
577
578/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
579 positive, shift that token. If negative, reduce the rule which
580 number is the opposite. If zero, do what YYDEFACT says.
581 If YYTABLE_NINF, syntax error. */
David Gibsoned95d742008-08-07 12:24:17 +1000582#define YYTABLE_NINF -45
David Gibsona4da2e32007-12-18 15:06:42 +1100583static const yytype_int8 yytable[] =
584{
David Gibsoned95d742008-08-07 12:24:17 +1000585 21, 16, 46, 8, 59, 47, 60, 9, 16, 61,
586 62, 28, 66, 33, 67, 10, 48, 13, 32, 63,
587 49, 50, 51, 52, 32, 17, 68, 19, 20, -44,
588 53, -44, 54, 1, -44, 2, 26, 15, 2, 24,
589 41, 2, 34, 17, 15, 42, 19, 20, 69, 70,
590 35, 38, 39, 40, 58, 55, 72, 71, 73, 12,
591 74, 22, 75, 23, 0, 0, 0, 0, 36, 0,
592 0, 0, 43, 37
David Gibsona4da2e32007-12-18 15:06:42 +1100593};
594
595static const yytype_int8 yycheck[] =
596{
David Gibsoned95d742008-08-07 12:24:17 +1000597 13, 8, 11, 14, 6, 14, 8, 0, 15, 11,
598 12, 24, 9, 26, 11, 16, 25, 4, 25, 21,
599 10, 11, 12, 13, 31, 17, 23, 6, 7, 5,
600 20, 4, 22, 3, 4, 11, 15, 8, 11, 4,
601 14, 11, 14, 17, 15, 19, 6, 7, 25, 26,
602 18, 5, 14, 14, 10, 24, 69, 7, 25, 6,
603 73, 14, 26, 15, -1, -1, -1, -1, 31, -1,
604 -1, -1, 38, 31
David Gibsona4da2e32007-12-18 15:06:42 +1100605};
606
607/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
608 symbol of state STATE-NUM. */
609static const yytype_uint8 yystos[] =
610{
David Gibsoned95d742008-08-07 12:24:17 +1000611 0, 3, 11, 28, 30, 31, 32, 46, 14, 0,
612 16, 34, 31, 4, 29, 30, 46, 17, 35, 6,
613 7, 33, 34, 29, 4, 36, 15, 33, 33, 37,
614 44, 45, 46, 33, 14, 18, 37, 44, 5, 14,
615 14, 14, 19, 35, 38, 39, 11, 14, 25, 10,
616 11, 12, 13, 20, 22, 24, 40, 43, 10, 6,
617 8, 11, 12, 21, 41, 42, 9, 11, 23, 25,
618 26, 7, 33, 25, 33, 26
David Gibsona4da2e32007-12-18 15:06:42 +1100619};
620
621#define yyerrok (yyerrstatus = 0)
622#define yyclearin (yychar = YYEMPTY)
623#define YYEMPTY (-2)
624#define YYEOF 0
625
626#define YYACCEPT goto yyacceptlab
627#define YYABORT goto yyabortlab
628#define YYERROR goto yyerrorlab
629
630
631/* Like YYERROR except do call yyerror. This remains here temporarily
632 to ease the transition to the new meaning of YYERROR, for GCC.
633 Once GCC version 2 has supplanted version 1, this can go. */
634
635#define YYFAIL goto yyerrlab
636
637#define YYRECOVERING() (!!yyerrstatus)
638
639#define YYBACKUP(Token, Value) \
640do \
641 if (yychar == YYEMPTY && yylen == 1) \
642 { \
643 yychar = (Token); \
644 yylval = (Value); \
645 yytoken = YYTRANSLATE (yychar); \
646 YYPOPSTACK (1); \
647 goto yybackup; \
648 } \
649 else \
650 { \
651 yyerror (YY_("syntax error: cannot back up")); \
652 YYERROR; \
653 } \
654while (YYID (0))
655
656
657#define YYTERROR 1
658#define YYERRCODE 256
659
660
661/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
662 If N is 0, then set CURRENT to the empty location which ends
663 the previous symbol: RHS[0] (always defined). */
664
665#define YYRHSLOC(Rhs, K) ((Rhs)[K])
666#ifndef YYLLOC_DEFAULT
667# define YYLLOC_DEFAULT(Current, Rhs, N) \
668 do \
669 if (YYID (N)) \
670 { \
671 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
672 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
673 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
674 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
675 } \
676 else \
677 { \
678 (Current).first_line = (Current).last_line = \
679 YYRHSLOC (Rhs, 0).last_line; \
680 (Current).first_column = (Current).last_column = \
681 YYRHSLOC (Rhs, 0).last_column; \
682 } \
683 while (YYID (0))
684#endif
685
686
687/* YY_LOCATION_PRINT -- Print the location on the stream.
688 This macro was not mandated originally: define only if we know
689 we won't break user code: when these are the locations we know. */
690
691#ifndef YY_LOCATION_PRINT
692# if YYLTYPE_IS_TRIVIAL
693# define YY_LOCATION_PRINT(File, Loc) \
694 fprintf (File, "%d.%d-%d.%d", \
695 (Loc).first_line, (Loc).first_column, \
696 (Loc).last_line, (Loc).last_column)
697# else
698# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
699# endif
700#endif
701
702
703/* YYLEX -- calling `yylex' with the right arguments. */
704
705#ifdef YYLEX_PARAM
706# define YYLEX yylex (YYLEX_PARAM)
707#else
708# define YYLEX yylex ()
709#endif
710
711/* Enable debugging if requested. */
712#if YYDEBUG
713
714# ifndef YYFPRINTF
715# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
716# define YYFPRINTF fprintf
717# endif
718
719# define YYDPRINTF(Args) \
720do { \
721 if (yydebug) \
722 YYFPRINTF Args; \
723} while (YYID (0))
724
725# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
726do { \
727 if (yydebug) \
728 { \
729 YYFPRINTF (stderr, "%s ", Title); \
730 yy_symbol_print (stderr, \
731 Type, Value, Location); \
732 YYFPRINTF (stderr, "\n"); \
733 } \
734} while (YYID (0))
735
736
737/*--------------------------------.
738| Print this symbol on YYOUTPUT. |
739`--------------------------------*/
740
741/*ARGSUSED*/
742#if (defined __STDC__ || defined __C99__FUNC__ \
743 || defined __cplusplus || defined _MSC_VER)
744static void
745yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
746#else
747static void
748yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp)
749 FILE *yyoutput;
750 int yytype;
751 YYSTYPE const * const yyvaluep;
752 YYLTYPE const * const yylocationp;
753#endif
754{
755 if (!yyvaluep)
756 return;
757 YYUSE (yylocationp);
758# ifdef YYPRINT
759 if (yytype < YYNTOKENS)
760 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
761# else
762 YYUSE (yyoutput);
763# endif
764 switch (yytype)
765 {
766 default:
767 break;
768 }
769}
770
771
772/*--------------------------------.
773| Print this symbol on YYOUTPUT. |
774`--------------------------------*/
775
776#if (defined __STDC__ || defined __C99__FUNC__ \
777 || defined __cplusplus || defined _MSC_VER)
778static void
779yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
780#else
781static void
782yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp)
783 FILE *yyoutput;
784 int yytype;
785 YYSTYPE const * const yyvaluep;
786 YYLTYPE const * const yylocationp;
787#endif
788{
789 if (yytype < YYNTOKENS)
790 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
791 else
792 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
793
794 YY_LOCATION_PRINT (yyoutput, *yylocationp);
795 YYFPRINTF (yyoutput, ": ");
796 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp);
797 YYFPRINTF (yyoutput, ")");
798}
799
800/*------------------------------------------------------------------.
801| yy_stack_print -- Print the state stack from its BOTTOM up to its |
802| TOP (included). |
803`------------------------------------------------------------------*/
804
805#if (defined __STDC__ || defined __C99__FUNC__ \
806 || defined __cplusplus || defined _MSC_VER)
807static void
808yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
809#else
810static void
811yy_stack_print (bottom, top)
812 yytype_int16 *bottom;
813 yytype_int16 *top;
814#endif
815{
816 YYFPRINTF (stderr, "Stack now");
817 for (; bottom <= top; ++bottom)
818 YYFPRINTF (stderr, " %d", *bottom);
819 YYFPRINTF (stderr, "\n");
820}
821
822# define YY_STACK_PRINT(Bottom, Top) \
823do { \
824 if (yydebug) \
825 yy_stack_print ((Bottom), (Top)); \
826} while (YYID (0))
827
828
829/*------------------------------------------------.
830| Report that the YYRULE is going to be reduced. |
831`------------------------------------------------*/
832
833#if (defined __STDC__ || defined __C99__FUNC__ \
834 || defined __cplusplus || defined _MSC_VER)
835static void
836yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
837#else
838static void
839yy_reduce_print (yyvsp, yylsp, yyrule)
840 YYSTYPE *yyvsp;
841 YYLTYPE *yylsp;
842 int yyrule;
843#endif
844{
845 int yynrhs = yyr2[yyrule];
846 int yyi;
847 unsigned long int yylno = yyrline[yyrule];
848 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
849 yyrule - 1, yylno);
850 /* The symbols being reduced. */
851 for (yyi = 0; yyi < yynrhs; yyi++)
852 {
853 fprintf (stderr, " $%d = ", yyi + 1);
854 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
855 &(yyvsp[(yyi + 1) - (yynrhs)])
856 , &(yylsp[(yyi + 1) - (yynrhs)]) );
857 fprintf (stderr, "\n");
858 }
859}
860
861# define YY_REDUCE_PRINT(Rule) \
862do { \
863 if (yydebug) \
864 yy_reduce_print (yyvsp, yylsp, Rule); \
865} while (YYID (0))
866
867/* Nonzero means print parse trace. It is left uninitialized so that
868 multiple parsers can coexist. */
869int yydebug;
870#else /* !YYDEBUG */
871# define YYDPRINTF(Args)
872# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
873# define YY_STACK_PRINT(Bottom, Top)
874# define YY_REDUCE_PRINT(Rule)
875#endif /* !YYDEBUG */
876
877
878/* YYINITDEPTH -- initial size of the parser's stacks. */
879#ifndef YYINITDEPTH
880# define YYINITDEPTH 200
881#endif
882
883/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
884 if the built-in stack extension method is used).
885
886 Do not make this value too large; the results are undefined if
887 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
888 evaluated with infinite-precision integer arithmetic. */
889
890#ifndef YYMAXDEPTH
891# define YYMAXDEPTH 10000
892#endif
893
894
895
896#if YYERROR_VERBOSE
897
898# ifndef yystrlen
899# if defined __GLIBC__ && defined _STRING_H
900# define yystrlen strlen
901# else
902/* Return the length of YYSTR. */
903#if (defined __STDC__ || defined __C99__FUNC__ \
904 || defined __cplusplus || defined _MSC_VER)
905static YYSIZE_T
906yystrlen (const char *yystr)
907#else
908static YYSIZE_T
909yystrlen (yystr)
910 const char *yystr;
911#endif
912{
913 YYSIZE_T yylen;
914 for (yylen = 0; yystr[yylen]; yylen++)
915 continue;
916 return yylen;
917}
918# endif
919# endif
920
921# ifndef yystpcpy
922# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
923# define yystpcpy stpcpy
924# else
925/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
926 YYDEST. */
927#if (defined __STDC__ || defined __C99__FUNC__ \
928 || defined __cplusplus || defined _MSC_VER)
929static char *
930yystpcpy (char *yydest, const char *yysrc)
931#else
932static char *
933yystpcpy (yydest, yysrc)
934 char *yydest;
935 const char *yysrc;
936#endif
937{
938 char *yyd = yydest;
939 const char *yys = yysrc;
940
941 while ((*yyd++ = *yys++) != '\0')
942 continue;
943
944 return yyd - 1;
945}
946# endif
947# endif
948
949# ifndef yytnamerr
950/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
951 quotes and backslashes, so that it's suitable for yyerror. The
952 heuristic is that double-quoting is unnecessary unless the string
953 contains an apostrophe, a comma, or backslash (other than
954 backslash-backslash). YYSTR is taken from yytname. If YYRES is
955 null, do not copy; instead, return the length of what the result
956 would have been. */
957static YYSIZE_T
958yytnamerr (char *yyres, const char *yystr)
959{
960 if (*yystr == '"')
961 {
962 YYSIZE_T yyn = 0;
963 char const *yyp = yystr;
964
965 for (;;)
966 switch (*++yyp)
967 {
968 case '\'':
969 case ',':
970 goto do_not_strip_quotes;
971
972 case '\\':
973 if (*++yyp != '\\')
974 goto do_not_strip_quotes;
975 /* Fall through. */
976 default:
977 if (yyres)
978 yyres[yyn] = *yyp;
979 yyn++;
980 break;
981
982 case '"':
983 if (yyres)
984 yyres[yyn] = '\0';
985 return yyn;
986 }
987 do_not_strip_quotes: ;
988 }
989
990 if (! yyres)
991 return yystrlen (yystr);
992
993 return yystpcpy (yyres, yystr) - yyres;
994}
995# endif
996
997/* Copy into YYRESULT an error message about the unexpected token
998 YYCHAR while in state YYSTATE. Return the number of bytes copied,
999 including the terminating null byte. If YYRESULT is null, do not
1000 copy anything; just return the number of bytes that would be
1001 copied. As a special case, return 0 if an ordinary "syntax error"
1002 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1003 size calculation. */
1004static YYSIZE_T
1005yysyntax_error (char *yyresult, int yystate, int yychar)
1006{
1007 int yyn = yypact[yystate];
1008
1009 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1010 return 0;
1011 else
1012 {
1013 int yytype = YYTRANSLATE (yychar);
1014 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1015 YYSIZE_T yysize = yysize0;
1016 YYSIZE_T yysize1;
1017 int yysize_overflow = 0;
1018 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1019 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1020 int yyx;
1021
1022# if 0
1023 /* This is so xgettext sees the translatable formats that are
1024 constructed on the fly. */
1025 YY_("syntax error, unexpected %s");
1026 YY_("syntax error, unexpected %s, expecting %s");
1027 YY_("syntax error, unexpected %s, expecting %s or %s");
1028 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1029 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1030# endif
1031 char *yyfmt;
1032 char const *yyf;
1033 static char const yyunexpected[] = "syntax error, unexpected %s";
1034 static char const yyexpecting[] = ", expecting %s";
1035 static char const yyor[] = " or %s";
1036 char yyformat[sizeof yyunexpected
1037 + sizeof yyexpecting - 1
1038 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1039 * (sizeof yyor - 1))];
1040 char const *yyprefix = yyexpecting;
1041
1042 /* Start YYX at -YYN if negative to avoid negative indexes in
1043 YYCHECK. */
1044 int yyxbegin = yyn < 0 ? -yyn : 0;
1045
1046 /* Stay within bounds of both yycheck and yytname. */
1047 int yychecklim = YYLAST - yyn + 1;
1048 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1049 int yycount = 1;
1050
1051 yyarg[0] = yytname[yytype];
1052 yyfmt = yystpcpy (yyformat, yyunexpected);
1053
1054 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1055 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1056 {
1057 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1058 {
1059 yycount = 1;
1060 yysize = yysize0;
1061 yyformat[sizeof yyunexpected - 1] = '\0';
1062 break;
1063 }
1064 yyarg[yycount++] = yytname[yyx];
1065 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1066 yysize_overflow |= (yysize1 < yysize);
1067 yysize = yysize1;
1068 yyfmt = yystpcpy (yyfmt, yyprefix);
1069 yyprefix = yyor;
1070 }
1071
1072 yyf = YY_(yyformat);
1073 yysize1 = yysize + yystrlen (yyf);
1074 yysize_overflow |= (yysize1 < yysize);
1075 yysize = yysize1;
1076
1077 if (yysize_overflow)
1078 return YYSIZE_MAXIMUM;
1079
1080 if (yyresult)
1081 {
1082 /* Avoid sprintf, as that infringes on the user's name space.
1083 Don't have undefined behavior even if the translation
1084 produced a string with the wrong number of "%s"s. */
1085 char *yyp = yyresult;
1086 int yyi = 0;
1087 while ((*yyp = *yyf) != '\0')
1088 {
1089 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1090 {
1091 yyp += yytnamerr (yyp, yyarg[yyi++]);
1092 yyf += 2;
1093 }
1094 else
1095 {
1096 yyp++;
1097 yyf++;
1098 }
1099 }
1100 }
1101 return yysize;
1102 }
1103}
1104#endif /* YYERROR_VERBOSE */
1105
1106
1107/*-----------------------------------------------.
1108| Release the memory associated to this symbol. |
1109`-----------------------------------------------*/
1110
1111/*ARGSUSED*/
1112#if (defined __STDC__ || defined __C99__FUNC__ \
1113 || defined __cplusplus || defined _MSC_VER)
1114static void
1115yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1116#else
1117static void
1118yydestruct (yymsg, yytype, yyvaluep, yylocationp)
1119 const char *yymsg;
1120 int yytype;
1121 YYSTYPE *yyvaluep;
1122 YYLTYPE *yylocationp;
1123#endif
1124{
1125 YYUSE (yyvaluep);
1126 YYUSE (yylocationp);
1127
1128 if (!yymsg)
1129 yymsg = "Deleting";
1130 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1131
1132 switch (yytype)
1133 {
1134
1135 default:
1136 break;
1137 }
1138}
1139
1140
1141/* Prevent warnings from -Wmissing-prototypes. */
1142
1143#ifdef YYPARSE_PARAM
1144#if defined __STDC__ || defined __cplusplus
1145int yyparse (void *YYPARSE_PARAM);
1146#else
1147int yyparse ();
1148#endif
1149#else /* ! YYPARSE_PARAM */
1150#if defined __STDC__ || defined __cplusplus
1151int yyparse (void);
1152#else
1153int yyparse ();
1154#endif
1155#endif /* ! YYPARSE_PARAM */
1156
1157
1158
1159/* The look-ahead symbol. */
1160int yychar;
1161
1162/* The semantic value of the look-ahead symbol. */
1163YYSTYPE yylval;
1164
1165/* Number of syntax errors so far. */
1166int yynerrs;
1167/* Location data for the look-ahead symbol. */
1168YYLTYPE yylloc;
1169
1170
1171
1172/*----------.
1173| yyparse. |
1174`----------*/
1175
1176#ifdef YYPARSE_PARAM
1177#if (defined __STDC__ || defined __C99__FUNC__ \
1178 || defined __cplusplus || defined _MSC_VER)
1179int
1180yyparse (void *YYPARSE_PARAM)
1181#else
1182int
1183yyparse (YYPARSE_PARAM)
1184 void *YYPARSE_PARAM;
1185#endif
1186#else /* ! YYPARSE_PARAM */
1187#if (defined __STDC__ || defined __C99__FUNC__ \
1188 || defined __cplusplus || defined _MSC_VER)
1189int
1190yyparse (void)
1191#else
1192int
1193yyparse ()
1194
1195#endif
1196#endif
1197{
1198
1199 int yystate;
1200 int yyn;
1201 int yyresult;
1202 /* Number of tokens to shift before error messages enabled. */
1203 int yyerrstatus;
1204 /* Look-ahead token as an internal (translated) token number. */
1205 int yytoken = 0;
1206#if YYERROR_VERBOSE
1207 /* Buffer for error messages, and its allocated size. */
1208 char yymsgbuf[128];
1209 char *yymsg = yymsgbuf;
1210 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1211#endif
1212
1213 /* Three stacks and their tools:
1214 `yyss': related to states,
1215 `yyvs': related to semantic values,
1216 `yyls': related to locations.
1217
1218 Refer to the stacks thru separate pointers, to allow yyoverflow
1219 to reallocate them elsewhere. */
1220
1221 /* The state stack. */
1222 yytype_int16 yyssa[YYINITDEPTH];
1223 yytype_int16 *yyss = yyssa;
1224 yytype_int16 *yyssp;
1225
1226 /* The semantic value stack. */
1227 YYSTYPE yyvsa[YYINITDEPTH];
1228 YYSTYPE *yyvs = yyvsa;
1229 YYSTYPE *yyvsp;
1230
1231 /* The location stack. */
1232 YYLTYPE yylsa[YYINITDEPTH];
1233 YYLTYPE *yyls = yylsa;
1234 YYLTYPE *yylsp;
1235 /* The locations where the error started and ended. */
1236 YYLTYPE yyerror_range[2];
1237
1238#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1239
1240 YYSIZE_T yystacksize = YYINITDEPTH;
1241
1242 /* The variables used to return semantic value and location from the
1243 action routines. */
1244 YYSTYPE yyval;
1245 YYLTYPE yyloc;
1246
1247 /* The number of symbols on the RHS of the reduced rule.
1248 Keep to zero when no symbol should be popped. */
1249 int yylen = 0;
1250
1251 YYDPRINTF ((stderr, "Starting parse\n"));
1252
1253 yystate = 0;
1254 yyerrstatus = 0;
1255 yynerrs = 0;
1256 yychar = YYEMPTY; /* Cause a token to be read. */
1257
1258 /* Initialize stack pointers.
1259 Waste one element of value and location stack
1260 so that they stay on the same level as the state stack.
1261 The wasted elements are never initialized. */
1262
1263 yyssp = yyss;
1264 yyvsp = yyvs;
1265 yylsp = yyls;
1266#if YYLTYPE_IS_TRIVIAL
1267 /* Initialize the default location before parsing starts. */
1268 yylloc.first_line = yylloc.last_line = 1;
1269 yylloc.first_column = yylloc.last_column = 0;
1270#endif
1271
1272 goto yysetstate;
1273
1274/*------------------------------------------------------------.
1275| yynewstate -- Push a new state, which is found in yystate. |
1276`------------------------------------------------------------*/
1277 yynewstate:
1278 /* In all cases, when you get here, the value and location stacks
1279 have just been pushed. So pushing a state here evens the stacks. */
1280 yyssp++;
1281
1282 yysetstate:
1283 *yyssp = yystate;
1284
1285 if (yyss + yystacksize - 1 <= yyssp)
1286 {
1287 /* Get the current used size of the three stacks, in elements. */
1288 YYSIZE_T yysize = yyssp - yyss + 1;
1289
1290#ifdef yyoverflow
1291 {
1292 /* Give user a chance to reallocate the stack. Use copies of
1293 these so that the &'s don't force the real ones into
1294 memory. */
1295 YYSTYPE *yyvs1 = yyvs;
1296 yytype_int16 *yyss1 = yyss;
1297 YYLTYPE *yyls1 = yyls;
1298
1299 /* Each stack pointer address is followed by the size of the
1300 data in use in that stack, in bytes. This used to be a
1301 conditional around just the two extra args, but that might
1302 be undefined if yyoverflow is a macro. */
1303 yyoverflow (YY_("memory exhausted"),
1304 &yyss1, yysize * sizeof (*yyssp),
1305 &yyvs1, yysize * sizeof (*yyvsp),
1306 &yyls1, yysize * sizeof (*yylsp),
1307 &yystacksize);
1308 yyls = yyls1;
1309 yyss = yyss1;
1310 yyvs = yyvs1;
1311 }
1312#else /* no yyoverflow */
1313# ifndef YYSTACK_RELOCATE
1314 goto yyexhaustedlab;
1315# else
1316 /* Extend the stack our own way. */
1317 if (YYMAXDEPTH <= yystacksize)
1318 goto yyexhaustedlab;
1319 yystacksize *= 2;
1320 if (YYMAXDEPTH < yystacksize)
1321 yystacksize = YYMAXDEPTH;
1322
1323 {
1324 yytype_int16 *yyss1 = yyss;
1325 union yyalloc *yyptr =
1326 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1327 if (! yyptr)
1328 goto yyexhaustedlab;
1329 YYSTACK_RELOCATE (yyss);
1330 YYSTACK_RELOCATE (yyvs);
1331 YYSTACK_RELOCATE (yyls);
1332# undef YYSTACK_RELOCATE
1333 if (yyss1 != yyssa)
1334 YYSTACK_FREE (yyss1);
1335 }
1336# endif
1337#endif /* no yyoverflow */
1338
1339 yyssp = yyss + yysize - 1;
1340 yyvsp = yyvs + yysize - 1;
1341 yylsp = yyls + yysize - 1;
1342
1343 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1344 (unsigned long int) yystacksize));
1345
1346 if (yyss + yystacksize - 1 <= yyssp)
1347 YYABORT;
1348 }
1349
1350 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1351
1352 goto yybackup;
1353
1354/*-----------.
1355| yybackup. |
1356`-----------*/
1357yybackup:
1358
1359 /* Do appropriate processing given the current state. Read a
1360 look-ahead token if we need one and don't already have one. */
1361
1362 /* First try to decide what to do without reference to look-ahead token. */
1363 yyn = yypact[yystate];
1364 if (yyn == YYPACT_NINF)
1365 goto yydefault;
1366
1367 /* Not known => get a look-ahead token if don't already have one. */
1368
1369 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1370 if (yychar == YYEMPTY)
1371 {
1372 YYDPRINTF ((stderr, "Reading a token: "));
1373 yychar = YYLEX;
1374 }
1375
1376 if (yychar <= YYEOF)
1377 {
1378 yychar = yytoken = YYEOF;
1379 YYDPRINTF ((stderr, "Now at end of input.\n"));
1380 }
1381 else
1382 {
1383 yytoken = YYTRANSLATE (yychar);
1384 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1385 }
1386
1387 /* If the proper action on seeing token YYTOKEN is to reduce or to
1388 detect an error, take that action. */
1389 yyn += yytoken;
1390 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1391 goto yydefault;
1392 yyn = yytable[yyn];
1393 if (yyn <= 0)
1394 {
1395 if (yyn == 0 || yyn == YYTABLE_NINF)
1396 goto yyerrlab;
1397 yyn = -yyn;
1398 goto yyreduce;
1399 }
1400
1401 if (yyn == YYFINAL)
1402 YYACCEPT;
1403
1404 /* Count tokens shifted since error; after three, turn off error
1405 status. */
1406 if (yyerrstatus)
1407 yyerrstatus--;
1408
1409 /* Shift the look-ahead token. */
1410 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1411
1412 /* Discard the shifted token unless it is eof. */
1413 if (yychar != YYEOF)
1414 yychar = YYEMPTY;
1415
1416 yystate = yyn;
1417 *++yyvsp = yylval;
1418 *++yylsp = yylloc;
1419 goto yynewstate;
1420
1421
1422/*-----------------------------------------------------------.
1423| yydefault -- do the default action for the current state. |
1424`-----------------------------------------------------------*/
1425yydefault:
1426 yyn = yydefact[yystate];
1427 if (yyn == 0)
1428 goto yyerrlab;
1429 goto yyreduce;
1430
1431
1432/*-----------------------------.
1433| yyreduce -- Do a reduction. |
1434`-----------------------------*/
1435yyreduce:
1436 /* yyn is the number of a rule to reduce with. */
1437 yylen = yyr2[yyn];
1438
1439 /* If YYLEN is nonzero, implement the default value of the action:
1440 `$$ = $1'.
1441
1442 Otherwise, the following line sets YYVAL to garbage.
1443 This behavior is undocumented and Bison
1444 users should not rely upon it. Assigning to YYVAL
1445 unconditionally makes the parser a bit smaller, and it avoids a
1446 GCC warning that YYVAL may be used uninitialized. */
1447 yyval = yyvsp[1-yylen];
1448
1449 /* Default location. */
1450 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1451 YY_REDUCE_PRINT (yyn);
1452 switch (yyn)
1453 {
1454 case 2:
David Gibsoned95d742008-08-07 12:24:17 +10001455#line 90 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001456 {
David Gibsoned95d742008-08-07 12:24:17 +10001457 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), 0);
David Gibsona4da2e32007-12-18 15:06:42 +11001458 ;}
1459 break;
1460
1461 case 3:
David Gibsoned95d742008-08-07 12:24:17 +10001462#line 94 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001463 {
David Gibsoned95d742008-08-07 12:24:17 +10001464 the_boot_info = build_boot_info((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].node), 0);
David Gibsona4da2e32007-12-18 15:06:42 +11001465 ;}
1466 break;
1467
1468 case 4:
David Gibsoned95d742008-08-07 12:24:17 +10001469#line 101 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001470 {
1471 (yyval.re) = NULL;
1472 ;}
1473 break;
1474
1475 case 5:
David Gibsoned95d742008-08-07 12:24:17 +10001476#line 105 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001477 {
1478 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1479 ;}
1480 break;
1481
1482 case 6:
David Gibsoned95d742008-08-07 12:24:17 +10001483#line 112 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001484 {
1485 (yyval.re) = build_reserve_entry((yyvsp[(3) - (5)].addr), (yyvsp[(4) - (5)].addr), (yyvsp[(1) - (5)].labelref));
1486 ;}
1487 break;
1488
1489 case 7:
David Gibsoned95d742008-08-07 12:24:17 +10001490#line 119 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001491 {
1492 (yyval.re) = NULL;
1493 ;}
1494 break;
1495
1496 case 8:
David Gibsoned95d742008-08-07 12:24:17 +10001497#line 123 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001498 {
1499 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
1500 ;}
1501 break;
1502
1503 case 9:
David Gibsoned95d742008-08-07 12:24:17 +10001504#line 130 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001505 {
1506 (yyval.re) = (yyvsp[(1) - (1)].re);
1507 ;}
1508 break;
1509
1510 case 10:
David Gibsoned95d742008-08-07 12:24:17 +10001511#line 134 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001512 {
1513 (yyval.re) = build_reserve_entry((yyvsp[(3) - (6)].addr), (yyvsp[(5) - (6)].addr) - (yyvsp[(3) - (6)].addr) + 1, (yyvsp[(1) - (6)].labelref));
1514 ;}
1515 break;
1516
1517 case 11:
David Gibsoned95d742008-08-07 12:24:17 +10001518#line 141 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001519 {
1520 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
1521 ;}
1522 break;
1523
1524 case 12:
David Gibsoned95d742008-08-07 12:24:17 +10001525#line 145 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001526 {
1527 (yyval.addr) = eval_literal((yyvsp[(1) - (1)].literal), 16, 64);
1528 ;}
1529 break;
1530
1531 case 13:
David Gibsoned95d742008-08-07 12:24:17 +10001532#line 152 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001533 {
1534 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "", NULL);
1535 ;}
1536 break;
1537
1538 case 14:
David Gibsoned95d742008-08-07 12:24:17 +10001539#line 159 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001540 {
1541 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
1542 ;}
1543 break;
1544
1545 case 15:
David Gibsoned95d742008-08-07 12:24:17 +10001546#line 166 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001547 {
1548 (yyval.proplist) = NULL;
1549 ;}
1550 break;
1551
1552 case 16:
David Gibsoned95d742008-08-07 12:24:17 +10001553#line 170 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001554 {
1555 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
1556 ;}
1557 break;
1558
1559 case 17:
David Gibsoned95d742008-08-07 12:24:17 +10001560#line 177 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001561 {
1562 (yyval.prop) = build_property((yyvsp[(2) - (5)].propnodename), (yyvsp[(4) - (5)].data), (yyvsp[(1) - (5)].labelref));
1563 ;}
1564 break;
1565
1566 case 18:
David Gibsoned95d742008-08-07 12:24:17 +10001567#line 181 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001568 {
1569 (yyval.prop) = build_property((yyvsp[(2) - (3)].propnodename), empty_data, (yyvsp[(1) - (3)].labelref));
1570 ;}
1571 break;
1572
1573 case 19:
David Gibsoned95d742008-08-07 12:24:17 +10001574#line 188 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001575 {
1576 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
1577 ;}
1578 break;
1579
1580 case 20:
David Gibsona4da2e32007-12-18 15:06:42 +11001581#line 192 "dtc-parser.y"
1582 {
1583 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1584 ;}
1585 break;
1586
David Gibsoned95d742008-08-07 12:24:17 +10001587 case 21:
David Gibsona4da2e32007-12-18 15:06:42 +11001588#line 196 "dtc-parser.y"
1589 {
David Gibsoned95d742008-08-07 12:24:17 +10001590 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
1591 ;}
1592 break;
1593
1594 case 22:
1595#line 200 "dtc-parser.y"
1596 {
David Gibsona4da2e32007-12-18 15:06:42 +11001597 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
1598 ;}
1599 break;
1600
1601 case 23:
David Gibsoned95d742008-08-07 12:24:17 +10001602#line 204 "dtc-parser.y"
1603 {
1604 struct search_path path = { srcpos_file->dir, NULL, NULL };
1605 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (9)].data).val, &path);
1606 struct data d = empty_data;
1607
1608 if ((yyvsp[(6) - (9)].addr) != 0)
1609 if (fseek(file->file, (yyvsp[(6) - (9)].addr), SEEK_SET) != 0)
1610 yyerrorf("Couldn't seek to offset %llu in \"%s\": %s",
1611 (unsigned long long)(yyvsp[(6) - (9)].addr),
1612 (yyvsp[(4) - (9)].data).val, strerror(errno));
1613
1614 d = data_copy_file(file->file, (yyvsp[(8) - (9)].addr));
1615
1616 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
1617 dtc_close_file(file);
1618 ;}
1619 break;
1620
1621 case 24:
1622#line 221 "dtc-parser.y"
1623 {
1624 struct search_path path = { srcpos_file->dir, NULL, NULL };
1625 struct dtc_file *file = dtc_open_file((yyvsp[(4) - (5)].data).val, &path);
1626 struct data d = empty_data;
1627
1628 d = data_copy_file(file->file, -1);
1629
1630 (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
1631 dtc_close_file(file);
1632 ;}
1633 break;
1634
1635 case 25:
1636#line 232 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001637 {
1638 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1639 ;}
1640 break;
1641
David Gibsoned95d742008-08-07 12:24:17 +10001642 case 26:
1643#line 239 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001644 {
1645 (yyval.data) = empty_data;
1646 ;}
1647 break;
1648
David Gibsoned95d742008-08-07 12:24:17 +10001649 case 27:
1650#line 243 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001651 {
1652 (yyval.data) = (yyvsp[(1) - (2)].data);
1653 ;}
1654 break;
1655
David Gibsoned95d742008-08-07 12:24:17 +10001656 case 28:
1657#line 247 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001658 {
1659 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1660 ;}
1661 break;
1662
David Gibsoned95d742008-08-07 12:24:17 +10001663 case 29:
1664#line 254 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001665 {
1666 (yyval.data) = empty_data;
1667 ;}
1668 break;
1669
David Gibsoned95d742008-08-07 12:24:17 +10001670 case 30:
1671#line 258 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001672 {
1673 (yyval.data) = data_append_cell((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].cell));
1674 ;}
1675 break;
1676
David Gibsoned95d742008-08-07 12:24:17 +10001677 case 31:
1678#line 262 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001679 {
1680 (yyval.data) = data_append_cell(data_add_marker((yyvsp[(1) - (2)].data), REF_PHANDLE,
1681 (yyvsp[(2) - (2)].labelref)), -1);
1682 ;}
1683 break;
1684
David Gibsoned95d742008-08-07 12:24:17 +10001685 case 32:
1686#line 267 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001687 {
1688 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1689 ;}
1690 break;
1691
David Gibsoned95d742008-08-07 12:24:17 +10001692 case 33:
1693#line 274 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001694 {
1695 (yyval.cbase) = 16;
1696 ;}
1697 break;
1698
David Gibsoned95d742008-08-07 12:24:17 +10001699 case 35:
1700#line 282 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001701 {
1702 (yyval.cell) = eval_literal((yyvsp[(1) - (1)].literal), 0, 32);
1703 ;}
1704 break;
1705
David Gibsoned95d742008-08-07 12:24:17 +10001706 case 36:
1707#line 286 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001708 {
1709 (yyval.cell) = eval_literal((yyvsp[(2) - (2)].literal), (yyvsp[(1) - (2)].cbase), 32);
1710 ;}
1711 break;
1712
David Gibsoned95d742008-08-07 12:24:17 +10001713 case 37:
1714#line 293 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001715 {
1716 (yyval.data) = empty_data;
1717 ;}
1718 break;
1719
David Gibsoned95d742008-08-07 12:24:17 +10001720 case 38:
1721#line 297 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001722 {
1723 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
1724 ;}
1725 break;
1726
David Gibsoned95d742008-08-07 12:24:17 +10001727 case 39:
1728#line 301 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001729 {
1730 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
1731 ;}
1732 break;
1733
David Gibsoned95d742008-08-07 12:24:17 +10001734 case 40:
1735#line 308 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001736 {
1737 (yyval.nodelist) = NULL;
1738 ;}
1739 break;
1740
David Gibsoned95d742008-08-07 12:24:17 +10001741 case 41:
1742#line 312 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001743 {
1744 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
1745 ;}
1746 break;
1747
David Gibsoned95d742008-08-07 12:24:17 +10001748 case 42:
1749#line 316 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001750 {
David Gibsoned95d742008-08-07 12:24:17 +10001751 yyerror("syntax error: properties must precede subnodes");
David Gibsona4da2e32007-12-18 15:06:42 +11001752 YYERROR;
1753 ;}
1754 break;
1755
David Gibsoned95d742008-08-07 12:24:17 +10001756 case 43:
1757#line 324 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001758 {
1759 (yyval.node) = name_node((yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].propnodename), (yyvsp[(1) - (3)].labelref));
1760 ;}
1761 break;
1762
David Gibsoned95d742008-08-07 12:24:17 +10001763 case 44:
1764#line 331 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001765 {
1766 (yyval.labelref) = NULL;
1767 ;}
1768 break;
1769
David Gibsoned95d742008-08-07 12:24:17 +10001770 case 45:
1771#line 335 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001772 {
1773 (yyval.labelref) = (yyvsp[(1) - (1)].labelref);
1774 ;}
1775 break;
1776
1777
1778/* Line 1267 of yacc.c. */
David Gibsoned95d742008-08-07 12:24:17 +10001779#line 1780 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +11001780 default: break;
1781 }
1782 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1783
1784 YYPOPSTACK (yylen);
1785 yylen = 0;
1786 YY_STACK_PRINT (yyss, yyssp);
1787
1788 *++yyvsp = yyval;
1789 *++yylsp = yyloc;
1790
1791 /* Now `shift' the result of the reduction. Determine what state
1792 that goes to, based on the state we popped back to and the rule
1793 number reduced by. */
1794
1795 yyn = yyr1[yyn];
1796
1797 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1798 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1799 yystate = yytable[yystate];
1800 else
1801 yystate = yydefgoto[yyn - YYNTOKENS];
1802
1803 goto yynewstate;
1804
1805
1806/*------------------------------------.
1807| yyerrlab -- here on detecting error |
1808`------------------------------------*/
1809yyerrlab:
1810 /* If not already recovering from an error, report this error. */
1811 if (!yyerrstatus)
1812 {
1813 ++yynerrs;
1814#if ! YYERROR_VERBOSE
1815 yyerror (YY_("syntax error"));
1816#else
1817 {
1818 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1819 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1820 {
1821 YYSIZE_T yyalloc = 2 * yysize;
1822 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1823 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1824 if (yymsg != yymsgbuf)
1825 YYSTACK_FREE (yymsg);
1826 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1827 if (yymsg)
1828 yymsg_alloc = yyalloc;
1829 else
1830 {
1831 yymsg = yymsgbuf;
1832 yymsg_alloc = sizeof yymsgbuf;
1833 }
1834 }
1835
1836 if (0 < yysize && yysize <= yymsg_alloc)
1837 {
1838 (void) yysyntax_error (yymsg, yystate, yychar);
1839 yyerror (yymsg);
1840 }
1841 else
1842 {
1843 yyerror (YY_("syntax error"));
1844 if (yysize != 0)
1845 goto yyexhaustedlab;
1846 }
1847 }
1848#endif
1849 }
1850
1851 yyerror_range[0] = yylloc;
1852
1853 if (yyerrstatus == 3)
1854 {
1855 /* If just tried and failed to reuse look-ahead token after an
1856 error, discard it. */
1857
1858 if (yychar <= YYEOF)
1859 {
1860 /* Return failure if at end of input. */
1861 if (yychar == YYEOF)
1862 YYABORT;
1863 }
1864 else
1865 {
1866 yydestruct ("Error: discarding",
1867 yytoken, &yylval, &yylloc);
1868 yychar = YYEMPTY;
1869 }
1870 }
1871
1872 /* Else will try to reuse look-ahead token after shifting the error
1873 token. */
1874 goto yyerrlab1;
1875
1876
1877/*---------------------------------------------------.
1878| yyerrorlab -- error raised explicitly by YYERROR. |
1879`---------------------------------------------------*/
1880yyerrorlab:
1881
1882 /* Pacify compilers like GCC when the user code never invokes
1883 YYERROR and the label yyerrorlab therefore never appears in user
1884 code. */
1885 if (/*CONSTCOND*/ 0)
1886 goto yyerrorlab;
1887
1888 yyerror_range[0] = yylsp[1-yylen];
1889 /* Do not reclaim the symbols of the rule which action triggered
1890 this YYERROR. */
1891 YYPOPSTACK (yylen);
1892 yylen = 0;
1893 YY_STACK_PRINT (yyss, yyssp);
1894 yystate = *yyssp;
1895 goto yyerrlab1;
1896
1897
1898/*-------------------------------------------------------------.
1899| yyerrlab1 -- common code for both syntax error and YYERROR. |
1900`-------------------------------------------------------------*/
1901yyerrlab1:
1902 yyerrstatus = 3; /* Each real token shifted decrements this. */
1903
1904 for (;;)
1905 {
1906 yyn = yypact[yystate];
1907 if (yyn != YYPACT_NINF)
1908 {
1909 yyn += YYTERROR;
1910 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1911 {
1912 yyn = yytable[yyn];
1913 if (0 < yyn)
1914 break;
1915 }
1916 }
1917
1918 /* Pop the current state because it cannot handle the error token. */
1919 if (yyssp == yyss)
1920 YYABORT;
1921
1922 yyerror_range[0] = *yylsp;
1923 yydestruct ("Error: popping",
1924 yystos[yystate], yyvsp, yylsp);
1925 YYPOPSTACK (1);
1926 yystate = *yyssp;
1927 YY_STACK_PRINT (yyss, yyssp);
1928 }
1929
1930 if (yyn == YYFINAL)
1931 YYACCEPT;
1932
1933 *++yyvsp = yylval;
1934
1935 yyerror_range[1] = yylloc;
1936 /* Using YYLLOC is tempting, but would change the location of
1937 the look-ahead. YYLOC is available though. */
1938 YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
1939 *++yylsp = yyloc;
1940
1941 /* Shift the error token. */
1942 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1943
1944 yystate = yyn;
1945 goto yynewstate;
1946
1947
1948/*-------------------------------------.
1949| yyacceptlab -- YYACCEPT comes here. |
1950`-------------------------------------*/
1951yyacceptlab:
1952 yyresult = 0;
1953 goto yyreturn;
1954
1955/*-----------------------------------.
1956| yyabortlab -- YYABORT comes here. |
1957`-----------------------------------*/
1958yyabortlab:
1959 yyresult = 1;
1960 goto yyreturn;
1961
1962#ifndef yyoverflow
1963/*-------------------------------------------------.
1964| yyexhaustedlab -- memory exhaustion comes here. |
1965`-------------------------------------------------*/
1966yyexhaustedlab:
1967 yyerror (YY_("memory exhausted"));
1968 yyresult = 2;
1969 /* Fall through. */
1970#endif
1971
1972yyreturn:
1973 if (yychar != YYEOF && yychar != YYEMPTY)
1974 yydestruct ("Cleanup: discarding lookahead",
1975 yytoken, &yylval, &yylloc);
1976 /* Do not reclaim the symbols of the rule which action triggered
1977 this YYABORT or YYACCEPT. */
1978 YYPOPSTACK (yylen);
1979 YY_STACK_PRINT (yyss, yyssp);
1980 while (yyssp != yyss)
1981 {
1982 yydestruct ("Cleanup: popping",
1983 yystos[*yyssp], yyvsp, yylsp);
1984 YYPOPSTACK (1);
1985 }
1986#ifndef yyoverflow
1987 if (yyss != yyssa)
1988 YYSTACK_FREE (yyss);
1989#endif
1990#if YYERROR_VERBOSE
1991 if (yymsg != yymsgbuf)
1992 YYSTACK_FREE (yymsg);
1993#endif
1994 /* Make sure YYID is used. */
1995 return YYID (yyresult);
1996}
1997
1998
David Gibsoned95d742008-08-07 12:24:17 +10001999#line 340 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002000
2001
David Gibsoned95d742008-08-07 12:24:17 +10002002void yyerrorf(char const *s, ...)
David Gibsona4da2e32007-12-18 15:06:42 +11002003{
David Gibsoned95d742008-08-07 12:24:17 +10002004 const char *fname = srcpos_file ? srcpos_file->name : "<no-file>";
2005 va_list va;
2006 va_start(va, s);
David Gibsona4da2e32007-12-18 15:06:42 +11002007
2008 if (strcmp(fname, "-") == 0)
2009 fname = "stdin";
2010
David Gibsoned95d742008-08-07 12:24:17 +10002011 fprintf(stderr, "%s:%d ", fname, yylloc.first_line);
2012 vfprintf(stderr, s, va);
2013 fprintf(stderr, "\n");
2014
2015 treesource_error = 1;
2016 va_end(va);
David Gibsona4da2e32007-12-18 15:06:42 +11002017}
2018
David Gibsoned95d742008-08-07 12:24:17 +10002019void yyerror (char const *s)
2020{
2021 yyerrorf("%s", s);
2022}
2023
2024static unsigned long long eval_literal(const char *s, int base, int bits)
David Gibsona4da2e32007-12-18 15:06:42 +11002025{
2026 unsigned long long val;
2027 char *e;
2028
2029 errno = 0;
2030 val = strtoull(s, &e, base);
2031 if (*e)
2032 yyerror("bad characters in literal");
2033 else if ((errno == ERANGE)
2034 || ((bits < 64) && (val >= (1ULL << bits))))
2035 yyerror("literal out of range");
2036 else if (errno != 0)
2037 yyerror("bad literal");
2038 return val;
2039}
2040