blob: 4af55900a15ba22f1c5b37239038e7d8bb4090ed [file] [log] [blame]
Stephen Warrencd296722012-09-28 21:25:59 +00001
2/* A Bison parser, made by GNU Bison 2.4.1. */
David Gibsona4da2e32007-12-18 15:06:42 +11003
4/* Skeleton implementation for Bison's Yacc-like parsers in C
John Bonesio658f29a2010-11-17 15:28:20 -08005
Stephen Warrencd296722012-09-28 21:25:59 +00006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
7 Free Software Foundation, Inc.
John Bonesio658f29a2010-11-17 15:28:20 -08008
9 This program is free software: you can redistribute it and/or modify
David Gibsona4da2e32007-12-18 15:06:42 +110010 it under the terms of the GNU General Public License as published by
John Bonesio658f29a2010-11-17 15:28:20 -080011 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
David Gibsona4da2e32007-12-18 15:06:42 +110014 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.
John Bonesio658f29a2010-11-17 15:28:20 -080018
David Gibsona4da2e32007-12-18 15:06:42 +110019 You should have received a copy of the GNU General Public License
John Bonesio658f29a2010-11-17 15:28:20 -080020 along with this program. If not, see <http://www.gnu.org/licenses/>. */
David Gibsona4da2e32007-12-18 15:06:42 +110021
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.
John Bonesio658f29a2010-11-17 15:28:20 -080031
David Gibsona4da2e32007-12-18 15:06:42 +110032 This special exception was added by the Free Software Foundation in
33 version 2.2 of Bison. */
34
35/* C LALR(1) parser skeleton written by Richard Stallman, by
36 simplifying the original so-called "semantic" parser. */
37
38/* All symbols defined below should begin with yy or YY, to avoid
39 infringing on user name space. This should be done even for local
40 variables, as they might otherwise be expanded by user macros.
41 There are some unavoidable exceptions within include files to
42 define necessary library symbols; they are noted "INFRINGES ON
43 USER NAME SPACE" below. */
44
45/* Identify Bison output. */
46#define YYBISON 1
47
48/* Bison version. */
Stephen Warrencd296722012-09-28 21:25:59 +000049#define YYBISON_VERSION "2.4.1"
David Gibsona4da2e32007-12-18 15:06:42 +110050
51/* Skeleton name. */
52#define YYSKELETON_NAME "yacc.c"
53
54/* Pure parsers. */
55#define YYPURE 0
56
John Bonesio658f29a2010-11-17 15:28:20 -080057/* Push parsers. */
58#define YYPUSH 0
59
60/* Pull parsers. */
61#define YYPULL 1
62
David Gibsona4da2e32007-12-18 15:06:42 +110063/* Using locations. */
John Bonesio658f29a2010-11-17 15:28:20 -080064#define YYLSP_NEEDED 0
David Gibsona4da2e32007-12-18 15:06:42 +110065
66
67
68/* Copy the first part of user declarations. */
John Bonesio658f29a2010-11-17 15:28:20 -080069
Stephen Warrencd296722012-09-28 21:25:59 +000070/* Line 189 of yacc.c */
71#line 21 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +110072
David Gibsoned95d742008-08-07 12:24:17 +100073#include <stdio.h>
74
David Gibsona4da2e32007-12-18 15:06:42 +110075#include "dtc.h"
76#include "srcpos.h"
77
John Bonesio658f29a2010-11-17 15:28:20 -080078YYLTYPE yylloc;
79
David Gibsoned95d742008-08-07 12:24:17 +100080extern int yylex(void);
John Bonesio658f29a2010-11-17 15:28:20 -080081extern void print_error(char const *fmt, ...);
82extern void yyerror(char const *s);
David Gibsona4da2e32007-12-18 15:06:42 +110083
84extern struct boot_info *the_boot_info;
David Gibsoned95d742008-08-07 12:24:17 +100085extern int treesource_error;
David Gibsona4da2e32007-12-18 15:06:42 +110086
David Gibsoned95d742008-08-07 12:24:17 +100087static unsigned long long eval_literal(const char *s, int base, int bits);
Stephen Warrencd296722012-09-28 21:25:59 +000088static unsigned char eval_char_literal(const char *s);
David Gibsona4da2e32007-12-18 15:06:42 +110089
90
Stephen Warrencd296722012-09-28 21:25:59 +000091/* Line 189 of yacc.c */
92#line 93 "dtc-parser.tab.c"
John Bonesio658f29a2010-11-17 15:28:20 -080093
David Gibsona4da2e32007-12-18 15:06:42 +110094/* Enabling traces. */
95#ifndef YYDEBUG
Stephen Warrencd296722012-09-28 21:25:59 +000096# define YYDEBUG 0
David Gibsona4da2e32007-12-18 15:06:42 +110097#endif
98
99/* Enabling verbose error messages. */
100#ifdef YYERROR_VERBOSE
101# undef YYERROR_VERBOSE
102# define YYERROR_VERBOSE 1
103#else
104# define YYERROR_VERBOSE 0
105#endif
106
107/* Enabling the token table. */
108#ifndef YYTOKEN_TABLE
109# define YYTOKEN_TABLE 0
110#endif
111
John Bonesio658f29a2010-11-17 15:28:20 -0800112
113/* Tokens. */
114#ifndef YYTOKENTYPE
115# define YYTOKENTYPE
116 /* Put the tokens into the symbol table, so that GDB and other debuggers
117 know about them. */
118 enum yytokentype {
119 DT_V1 = 258,
120 DT_MEMRESERVE = 259,
Stephen Warrencd296722012-09-28 21:25:59 +0000121 DT_LSHIFT = 260,
122 DT_RSHIFT = 261,
123 DT_LE = 262,
124 DT_GE = 263,
125 DT_EQ = 264,
126 DT_NE = 265,
127 DT_AND = 266,
128 DT_OR = 267,
129 DT_BITS = 268,
130 DT_DEL_PROP = 269,
131 DT_DEL_NODE = 270,
132 DT_PROPNODENAME = 271,
133 DT_LITERAL = 272,
134 DT_CHAR_LITERAL = 273,
135 DT_BASE = 274,
136 DT_BYTE = 275,
137 DT_STRING = 276,
138 DT_LABEL = 277,
139 DT_REF = 278,
140 DT_INCBIN = 279
John Bonesio658f29a2010-11-17 15:28:20 -0800141 };
142#endif
143
144
145
David Gibsona4da2e32007-12-18 15:06:42 +1100146#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
147typedef union YYSTYPE
David Gibsona4da2e32007-12-18 15:06:42 +1100148{
John Bonesio658f29a2010-11-17 15:28:20 -0800149
Stephen Warrencd296722012-09-28 21:25:59 +0000150/* Line 214 of yacc.c */
151#line 40 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -0800152
David Gibsona4da2e32007-12-18 15:06:42 +1100153 char *propnodename;
154 char *literal;
155 char *labelref;
156 unsigned int cbase;
David Gibsoned95d742008-08-07 12:24:17 +1000157 uint8_t byte;
David Gibsona4da2e32007-12-18 15:06:42 +1100158 struct data data;
159
Stephen Warrencd296722012-09-28 21:25:59 +0000160 struct {
161 struct data data;
162 int bits;
163 } array;
164
David Gibsona4da2e32007-12-18 15:06:42 +1100165 struct property *prop;
166 struct property *proplist;
167 struct node *node;
168 struct node *nodelist;
169 struct reserve_info *re;
Stephen Warrencd296722012-09-28 21:25:59 +0000170 uint64_t integer;
John Bonesio658f29a2010-11-17 15:28:20 -0800171
172
173
Stephen Warrencd296722012-09-28 21:25:59 +0000174/* Line 214 of yacc.c */
175#line 176 "dtc-parser.tab.c"
John Bonesio658f29a2010-11-17 15:28:20 -0800176} YYSTYPE;
177# define YYSTYPE_IS_TRIVIAL 1
David Gibsona4da2e32007-12-18 15:06:42 +1100178# define yystype YYSTYPE /* obsolescent; will be withdrawn */
179# define YYSTYPE_IS_DECLARED 1
David Gibsona4da2e32007-12-18 15:06:42 +1100180#endif
181
182
183/* Copy the second part of user declarations. */
184
185
Stephen Warrencd296722012-09-28 21:25:59 +0000186/* Line 264 of yacc.c */
187#line 188 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100188
189#ifdef short
190# undef short
191#endif
192
193#ifdef YYTYPE_UINT8
194typedef YYTYPE_UINT8 yytype_uint8;
195#else
196typedef unsigned char yytype_uint8;
197#endif
198
199#ifdef YYTYPE_INT8
200typedef YYTYPE_INT8 yytype_int8;
201#elif (defined __STDC__ || defined __C99__FUNC__ \
202 || defined __cplusplus || defined _MSC_VER)
203typedef signed char yytype_int8;
204#else
205typedef short int yytype_int8;
206#endif
207
208#ifdef YYTYPE_UINT16
209typedef YYTYPE_UINT16 yytype_uint16;
210#else
211typedef unsigned short int yytype_uint16;
212#endif
213
214#ifdef YYTYPE_INT16
215typedef YYTYPE_INT16 yytype_int16;
216#else
217typedef short int yytype_int16;
218#endif
219
220#ifndef YYSIZE_T
221# ifdef __SIZE_TYPE__
222# define YYSIZE_T __SIZE_TYPE__
223# elif defined size_t
224# define YYSIZE_T size_t
225# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
226 || defined __cplusplus || defined _MSC_VER)
227# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
228# define YYSIZE_T size_t
229# else
230# define YYSIZE_T unsigned int
231# endif
232#endif
233
234#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
235
236#ifndef YY_
Stephen Warrencd296722012-09-28 21:25:59 +0000237# if YYENABLE_NLS
David Gibsona4da2e32007-12-18 15:06:42 +1100238# if ENABLE_NLS
239# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
240# define YY_(msgid) dgettext ("bison-runtime", msgid)
241# endif
242# endif
243# ifndef YY_
244# define YY_(msgid) msgid
245# endif
246#endif
247
248/* Suppress unused-variable warnings by "using" E. */
249#if ! defined lint || defined __GNUC__
250# define YYUSE(e) ((void) (e))
251#else
252# define YYUSE(e) /* empty */
253#endif
254
255/* Identity function, used to suppress warnings about constant conditions. */
256#ifndef lint
257# define YYID(n) (n)
258#else
259#if (defined __STDC__ || defined __C99__FUNC__ \
260 || defined __cplusplus || defined _MSC_VER)
261static int
John Bonesio658f29a2010-11-17 15:28:20 -0800262YYID (int yyi)
David Gibsona4da2e32007-12-18 15:06:42 +1100263#else
264static int
John Bonesio658f29a2010-11-17 15:28:20 -0800265YYID (yyi)
266 int yyi;
David Gibsona4da2e32007-12-18 15:06:42 +1100267#endif
268{
John Bonesio658f29a2010-11-17 15:28:20 -0800269 return yyi;
David Gibsona4da2e32007-12-18 15:06:42 +1100270}
271#endif
272
273#if ! defined yyoverflow || YYERROR_VERBOSE
274
275/* The parser invokes alloca or malloc; define the necessary symbols. */
276
277# ifdef YYSTACK_USE_ALLOCA
278# if YYSTACK_USE_ALLOCA
279# ifdef __GNUC__
280# define YYSTACK_ALLOC __builtin_alloca
281# elif defined __BUILTIN_VA_ARG_INCR
282# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
283# elif defined _AIX
284# define YYSTACK_ALLOC __alloca
285# elif defined _MSC_VER
286# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
287# define alloca _alloca
288# else
289# define YYSTACK_ALLOC alloca
290# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
291 || defined __cplusplus || defined _MSC_VER)
292# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
293# ifndef _STDLIB_H
294# define _STDLIB_H 1
295# endif
296# endif
297# endif
298# endif
299# endif
300
301# ifdef YYSTACK_ALLOC
302 /* Pacify GCC's `empty if-body' warning. */
303# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
304# ifndef YYSTACK_ALLOC_MAXIMUM
305 /* The OS might guarantee only one guard page at the bottom of the stack,
306 and a page size can be as small as 4096 bytes. So we cannot safely
307 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
308 to allow for a few compiler-allocated temporary stack slots. */
309# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
310# endif
311# else
312# define YYSTACK_ALLOC YYMALLOC
313# define YYSTACK_FREE YYFREE
314# ifndef YYSTACK_ALLOC_MAXIMUM
315# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
316# endif
317# if (defined __cplusplus && ! defined _STDLIB_H \
318 && ! ((defined YYMALLOC || defined malloc) \
319 && (defined YYFREE || defined free)))
320# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
321# ifndef _STDLIB_H
322# define _STDLIB_H 1
323# endif
324# endif
325# ifndef YYMALLOC
326# define YYMALLOC malloc
327# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
328 || defined __cplusplus || defined _MSC_VER)
329void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
330# endif
331# endif
332# ifndef YYFREE
333# define YYFREE free
334# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
335 || defined __cplusplus || defined _MSC_VER)
336void free (void *); /* INFRINGES ON USER NAME SPACE */
337# endif
338# endif
339# endif
340#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
341
342
343#if (! defined yyoverflow \
344 && (! defined __cplusplus \
John Bonesio658f29a2010-11-17 15:28:20 -0800345 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
David Gibsona4da2e32007-12-18 15:06:42 +1100346
347/* A type that is properly aligned for any stack member. */
348union yyalloc
349{
John Bonesio658f29a2010-11-17 15:28:20 -0800350 yytype_int16 yyss_alloc;
351 YYSTYPE yyvs_alloc;
David Gibsona4da2e32007-12-18 15:06:42 +1100352};
353
354/* The size of the maximum gap between one aligned stack and the next. */
355# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
356
357/* The size of an array large to enough to hold all stacks, each with
358 N elements. */
359# define YYSTACK_BYTES(N) \
John Bonesio658f29a2010-11-17 15:28:20 -0800360 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
361 + YYSTACK_GAP_MAXIMUM)
David Gibsona4da2e32007-12-18 15:06:42 +1100362
363/* Copy COUNT objects from FROM to TO. The source and destination do
364 not overlap. */
365# ifndef YYCOPY
366# if defined __GNUC__ && 1 < __GNUC__
367# define YYCOPY(To, From, Count) \
368 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
369# else
370# define YYCOPY(To, From, Count) \
371 do \
372 { \
373 YYSIZE_T yyi; \
374 for (yyi = 0; yyi < (Count); yyi++) \
375 (To)[yyi] = (From)[yyi]; \
376 } \
377 while (YYID (0))
378# endif
379# endif
380
381/* Relocate STACK from its old location to the new one. The
382 local variables YYSIZE and YYSTACKSIZE give the old and new number of
383 elements in the stack, and YYPTR gives the new location of the
384 stack. Advance YYPTR to a properly aligned location for the next
385 stack. */
John Bonesio658f29a2010-11-17 15:28:20 -0800386# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
David Gibsona4da2e32007-12-18 15:06:42 +1100387 do \
388 { \
389 YYSIZE_T yynewbytes; \
John Bonesio658f29a2010-11-17 15:28:20 -0800390 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
391 Stack = &yyptr->Stack_alloc; \
David Gibsona4da2e32007-12-18 15:06:42 +1100392 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
393 yyptr += yynewbytes / sizeof (*yyptr); \
394 } \
395 while (YYID (0))
396
397#endif
398
399/* YYFINAL -- State number of the termination state. */
John Bonesio658f29a2010-11-17 15:28:20 -0800400#define YYFINAL 4
David Gibsona4da2e32007-12-18 15:06:42 +1100401/* YYLAST -- Last index in YYTABLE. */
Stephen Warrencd296722012-09-28 21:25:59 +0000402#define YYLAST 133
David Gibsona4da2e32007-12-18 15:06:42 +1100403
404/* YYNTOKENS -- Number of terminals. */
Stephen Warrencd296722012-09-28 21:25:59 +0000405#define YYNTOKENS 48
David Gibsona4da2e32007-12-18 15:06:42 +1100406/* YYNNTS -- Number of nonterminals. */
Stephen Warrencd296722012-09-28 21:25:59 +0000407#define YYNNTS 28
David Gibsona4da2e32007-12-18 15:06:42 +1100408/* YYNRULES -- Number of rules. */
Stephen Warrencd296722012-09-28 21:25:59 +0000409#define YYNRULES 79
David Gibsona4da2e32007-12-18 15:06:42 +1100410/* YYNRULES -- Number of states. */
Stephen Warrencd296722012-09-28 21:25:59 +0000411#define YYNSTATES 141
David Gibsona4da2e32007-12-18 15:06:42 +1100412
413/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
414#define YYUNDEFTOK 2
Stephen Warrencd296722012-09-28 21:25:59 +0000415#define YYMAXUTOK 279
David Gibsona4da2e32007-12-18 15:06:42 +1100416
417#define YYTRANSLATE(YYX) \
418 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
419
420/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
421static const yytype_uint8 yytranslate[] =
422{
423 0, 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,
Stephen Warrencd296722012-09-28 21:25:59 +0000426 2, 2, 2, 47, 2, 2, 2, 45, 41, 2,
427 33, 35, 44, 42, 34, 43, 2, 26, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 38, 25,
429 36, 29, 30, 37, 2, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Stephen Warrencd296722012-09-28 21:25:59 +0000432 2, 31, 2, 32, 40, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Stephen Warrencd296722012-09-28 21:25:59 +0000435 2, 2, 2, 27, 39, 28, 46, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100436 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, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
Stephen Warrencd296722012-09-28 21:25:59 +0000449 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
450 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
David Gibsona4da2e32007-12-18 15:06:42 +1100451};
452
453#if YYDEBUG
454/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
455 YYRHS. */
Stephen Warrencd296722012-09-28 21:25:59 +0000456static const yytype_uint16 yyprhs[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100457{
Stephen Warrencd296722012-09-28 21:25:59 +0000458 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
459 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
460 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
461 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
462 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
463 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
464 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
465 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
David Gibsona4da2e32007-12-18 15:06:42 +1100466};
467
468/* YYRHS -- A `-1'-separated list of the rules' RHS. */
469static const yytype_int8 yyrhs[] =
470{
Stephen Warrencd296722012-09-28 21:25:59 +0000471 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
472 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
473 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
474 -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
475 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
476 -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
477 -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
478 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
479 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
480 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
481 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
482 -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
483 -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
484 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
485 -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
486 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
487 -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
488 -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
489 -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
490 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
491 -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
492 -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
493 -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
494 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
495 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
496 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
497 75, -1
David Gibsona4da2e32007-12-18 15:06:42 +1100498};
499
500/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
501static const yytype_uint16 yyrline[] =
502{
Stephen Warrencd296722012-09-28 21:25:59 +0000503 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
504 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
505 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
506 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
507 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
508 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
509 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
510 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
David Gibsona4da2e32007-12-18 15:06:42 +1100511};
512#endif
513
514#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
515/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
516 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
517static const char *const yytname[] =
518{
Stephen Warrencd296722012-09-28 21:25:59 +0000519 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
520 "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
521 "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
522 "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
523 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
524 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
525 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
526 "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
527 "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
528 "integer_expr", "integer_trinary", "integer_or", "integer_and",
529 "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
530 "integer_rela", "integer_shift", "integer_add", "integer_mul",
531 "integer_unary", "bytestring", "subnodes", "subnode", 0
David Gibsona4da2e32007-12-18 15:06:42 +1100532};
533#endif
534
535# ifdef YYPRINT
536/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
537 token YYLEX-NUM. */
538static const yytype_uint16 yytoknum[] =
539{
540 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
Stephen Warrencd296722012-09-28 21:25:59 +0000541 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
542 275, 276, 277, 278, 279, 59, 47, 123, 125, 61,
543 62, 91, 93, 40, 44, 41, 60, 63, 58, 124,
544 94, 38, 43, 45, 42, 37, 126, 33
David Gibsona4da2e32007-12-18 15:06:42 +1100545};
546# endif
547
548/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
549static const yytype_uint8 yyr1[] =
550{
Stephen Warrencd296722012-09-28 21:25:59 +0000551 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
552 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
553 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
554 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
555 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
556 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
557 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
558 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
David Gibsona4da2e32007-12-18 15:06:42 +1100559};
560
561/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
562static const yytype_uint8 yyr2[] =
563{
Stephen Warrencd296722012-09-28 21:25:59 +0000564 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
565 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
566 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
567 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
568 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
569 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
570 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
571 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
David Gibsona4da2e32007-12-18 15:06:42 +1100572};
573
574/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
575 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
576 means the default is an error. */
577static const yytype_uint8 yydefact[] =
578{
Stephen Warrencd296722012-09-28 21:25:59 +0000579 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
580 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
581 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
582 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
583 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
584 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
585 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
586 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
587 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
588 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
589 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
590 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
591 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
592 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
593 22
David Gibsona4da2e32007-12-18 15:06:42 +1100594};
595
596/* YYDEFGOTO[NTERM-NUM]. */
597static const yytype_int8 yydefgoto[] =
598{
Stephen Warrencd296722012-09-28 21:25:59 +0000599 -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
600 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
601 29, 30, 31, 32, 33, 125, 92, 93
David Gibsona4da2e32007-12-18 15:06:42 +1100602};
603
604/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
605 STATE-NUM. */
Stephen Warrencd296722012-09-28 21:25:59 +0000606#define YYPACT_NINF -78
David Gibsona4da2e32007-12-18 15:06:42 +1100607static const yytype_int8 yypact[] =
608{
Stephen Warrencd296722012-09-28 21:25:59 +0000609 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
610 -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
611 -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
612 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
613 -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
614 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
615 -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
616 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
617 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
618 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
619 -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
620 -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
621 -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
622 -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
623 -78
David Gibsona4da2e32007-12-18 15:06:42 +1100624};
625
626/* YYPGOTO[NTERM-NUM]. */
627static const yytype_int8 yypgoto[] =
628{
Stephen Warrencd296722012-09-28 21:25:59 +0000629 -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
630 -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
631 34, 20, 26, 28, -14, -78, 18, 24
David Gibsona4da2e32007-12-18 15:06:42 +1100632};
633
634/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
635 positive, shift that token. If negative, reduce the rule which
636 number is the opposite. If zero, do what YYDEFACT says.
637 If YYTABLE_NINF, syntax error. */
John Bonesio658f29a2010-11-17 15:28:20 -0800638#define YYTABLE_NINF -1
639static const yytype_uint8 yytable[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100640{
Stephen Warrencd296722012-09-28 21:25:59 +0000641 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
642 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
643 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
644 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
645 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
646 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
647 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
648 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
649 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
650 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
651 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
652 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
653 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
654 137, 0, 73, 139
David Gibsona4da2e32007-12-18 15:06:42 +1100655};
656
Stephen Warrencd296722012-09-28 21:25:59 +0000657static const yytype_int16 yycheck[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100658{
Stephen Warrencd296722012-09-28 21:25:59 +0000659 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
660 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
661 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
662 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
663 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
664 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
665 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
666 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
667 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
668 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
669 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
670 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
671 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
672 135, -1, 49, 138
David Gibsona4da2e32007-12-18 15:06:42 +1100673};
674
675/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
676 symbol of state STATE-NUM. */
677static const yytype_uint8 yystos[] =
678{
Stephen Warrencd296722012-09-28 21:25:59 +0000679 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
680 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
681 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
682 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
683 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
684 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
685 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
686 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
687 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
688 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
689 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
690 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
691 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
692 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
693 35
David Gibsona4da2e32007-12-18 15:06:42 +1100694};
695
696#define yyerrok (yyerrstatus = 0)
697#define yyclearin (yychar = YYEMPTY)
698#define YYEMPTY (-2)
699#define YYEOF 0
700
701#define YYACCEPT goto yyacceptlab
702#define YYABORT goto yyabortlab
703#define YYERROR goto yyerrorlab
704
705
706/* Like YYERROR except do call yyerror. This remains here temporarily
707 to ease the transition to the new meaning of YYERROR, for GCC.
Stephen Warrencd296722012-09-28 21:25:59 +0000708 Once GCC version 2 has supplanted version 1, this can go. */
David Gibsona4da2e32007-12-18 15:06:42 +1100709
710#define YYFAIL goto yyerrlab
711
712#define YYRECOVERING() (!!yyerrstatus)
713
714#define YYBACKUP(Token, Value) \
715do \
716 if (yychar == YYEMPTY && yylen == 1) \
717 { \
718 yychar = (Token); \
719 yylval = (Value); \
720 yytoken = YYTRANSLATE (yychar); \
721 YYPOPSTACK (1); \
722 goto yybackup; \
723 } \
724 else \
725 { \
726 yyerror (YY_("syntax error: cannot back up")); \
727 YYERROR; \
728 } \
729while (YYID (0))
730
731
732#define YYTERROR 1
733#define YYERRCODE 256
734
735
736/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
737 If N is 0, then set CURRENT to the empty location which ends
738 the previous symbol: RHS[0] (always defined). */
739
740#define YYRHSLOC(Rhs, K) ((Rhs)[K])
741#ifndef YYLLOC_DEFAULT
742# define YYLLOC_DEFAULT(Current, Rhs, N) \
743 do \
744 if (YYID (N)) \
745 { \
746 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
747 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
748 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
749 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
750 } \
751 else \
752 { \
753 (Current).first_line = (Current).last_line = \
754 YYRHSLOC (Rhs, 0).last_line; \
755 (Current).first_column = (Current).last_column = \
756 YYRHSLOC (Rhs, 0).last_column; \
757 } \
758 while (YYID (0))
759#endif
760
761
762/* YY_LOCATION_PRINT -- Print the location on the stream.
763 This macro was not mandated originally: define only if we know
764 we won't break user code: when these are the locations we know. */
765
766#ifndef YY_LOCATION_PRINT
Stephen Warrencd296722012-09-28 21:25:59 +0000767# if YYLTYPE_IS_TRIVIAL
David Gibsona4da2e32007-12-18 15:06:42 +1100768# define YY_LOCATION_PRINT(File, Loc) \
769 fprintf (File, "%d.%d-%d.%d", \
770 (Loc).first_line, (Loc).first_column, \
771 (Loc).last_line, (Loc).last_column)
772# else
773# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
774# endif
775#endif
776
777
778/* YYLEX -- calling `yylex' with the right arguments. */
779
780#ifdef YYLEX_PARAM
781# define YYLEX yylex (YYLEX_PARAM)
782#else
783# define YYLEX yylex ()
784#endif
785
786/* Enable debugging if requested. */
787#if YYDEBUG
788
789# ifndef YYFPRINTF
790# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
791# define YYFPRINTF fprintf
792# endif
793
794# define YYDPRINTF(Args) \
795do { \
796 if (yydebug) \
797 YYFPRINTF Args; \
798} while (YYID (0))
799
800# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
801do { \
802 if (yydebug) \
803 { \
804 YYFPRINTF (stderr, "%s ", Title); \
805 yy_symbol_print (stderr, \
John Bonesio658f29a2010-11-17 15:28:20 -0800806 Type, Value); \
David Gibsona4da2e32007-12-18 15:06:42 +1100807 YYFPRINTF (stderr, "\n"); \
808 } \
809} while (YYID (0))
810
811
812/*--------------------------------.
813| Print this symbol on YYOUTPUT. |
814`--------------------------------*/
815
816/*ARGSUSED*/
817#if (defined __STDC__ || defined __C99__FUNC__ \
818 || defined __cplusplus || defined _MSC_VER)
819static void
John Bonesio658f29a2010-11-17 15:28:20 -0800820yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100821#else
822static void
John Bonesio658f29a2010-11-17 15:28:20 -0800823yy_symbol_value_print (yyoutput, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100824 FILE *yyoutput;
825 int yytype;
826 YYSTYPE const * const yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +1100827#endif
828{
829 if (!yyvaluep)
830 return;
David Gibsona4da2e32007-12-18 15:06:42 +1100831# ifdef YYPRINT
832 if (yytype < YYNTOKENS)
833 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
834# else
835 YYUSE (yyoutput);
836# endif
837 switch (yytype)
838 {
839 default:
840 break;
841 }
842}
843
844
845/*--------------------------------.
846| Print this symbol on YYOUTPUT. |
847`--------------------------------*/
848
849#if (defined __STDC__ || defined __C99__FUNC__ \
850 || defined __cplusplus || defined _MSC_VER)
851static void
John Bonesio658f29a2010-11-17 15:28:20 -0800852yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100853#else
854static void
John Bonesio658f29a2010-11-17 15:28:20 -0800855yy_symbol_print (yyoutput, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100856 FILE *yyoutput;
857 int yytype;
858 YYSTYPE const * const yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +1100859#endif
860{
861 if (yytype < YYNTOKENS)
862 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
863 else
864 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
865
John Bonesio658f29a2010-11-17 15:28:20 -0800866 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
David Gibsona4da2e32007-12-18 15:06:42 +1100867 YYFPRINTF (yyoutput, ")");
868}
869
870/*------------------------------------------------------------------.
871| yy_stack_print -- Print the state stack from its BOTTOM up to its |
872| TOP (included). |
873`------------------------------------------------------------------*/
874
875#if (defined __STDC__ || defined __C99__FUNC__ \
876 || defined __cplusplus || defined _MSC_VER)
877static void
John Bonesio658f29a2010-11-17 15:28:20 -0800878yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
David Gibsona4da2e32007-12-18 15:06:42 +1100879#else
880static void
John Bonesio658f29a2010-11-17 15:28:20 -0800881yy_stack_print (yybottom, yytop)
882 yytype_int16 *yybottom;
883 yytype_int16 *yytop;
David Gibsona4da2e32007-12-18 15:06:42 +1100884#endif
885{
886 YYFPRINTF (stderr, "Stack now");
John Bonesio658f29a2010-11-17 15:28:20 -0800887 for (; yybottom <= yytop; yybottom++)
888 {
889 int yybot = *yybottom;
890 YYFPRINTF (stderr, " %d", yybot);
891 }
David Gibsona4da2e32007-12-18 15:06:42 +1100892 YYFPRINTF (stderr, "\n");
893}
894
895# define YY_STACK_PRINT(Bottom, Top) \
896do { \
897 if (yydebug) \
898 yy_stack_print ((Bottom), (Top)); \
899} while (YYID (0))
900
901
902/*------------------------------------------------.
903| Report that the YYRULE is going to be reduced. |
904`------------------------------------------------*/
905
906#if (defined __STDC__ || defined __C99__FUNC__ \
907 || defined __cplusplus || defined _MSC_VER)
908static void
John Bonesio658f29a2010-11-17 15:28:20 -0800909yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
David Gibsona4da2e32007-12-18 15:06:42 +1100910#else
911static void
John Bonesio658f29a2010-11-17 15:28:20 -0800912yy_reduce_print (yyvsp, yyrule)
David Gibsona4da2e32007-12-18 15:06:42 +1100913 YYSTYPE *yyvsp;
David Gibsona4da2e32007-12-18 15:06:42 +1100914 int yyrule;
915#endif
916{
917 int yynrhs = yyr2[yyrule];
918 int yyi;
919 unsigned long int yylno = yyrline[yyrule];
920 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
921 yyrule - 1, yylno);
922 /* The symbols being reduced. */
923 for (yyi = 0; yyi < yynrhs; yyi++)
924 {
John Bonesio658f29a2010-11-17 15:28:20 -0800925 YYFPRINTF (stderr, " $%d = ", yyi + 1);
David Gibsona4da2e32007-12-18 15:06:42 +1100926 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
927 &(yyvsp[(yyi + 1) - (yynrhs)])
John Bonesio658f29a2010-11-17 15:28:20 -0800928 );
929 YYFPRINTF (stderr, "\n");
David Gibsona4da2e32007-12-18 15:06:42 +1100930 }
931}
932
933# define YY_REDUCE_PRINT(Rule) \
934do { \
935 if (yydebug) \
John Bonesio658f29a2010-11-17 15:28:20 -0800936 yy_reduce_print (yyvsp, Rule); \
David Gibsona4da2e32007-12-18 15:06:42 +1100937} while (YYID (0))
938
939/* Nonzero means print parse trace. It is left uninitialized so that
940 multiple parsers can coexist. */
941int yydebug;
942#else /* !YYDEBUG */
943# define YYDPRINTF(Args)
944# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
945# define YY_STACK_PRINT(Bottom, Top)
946# define YY_REDUCE_PRINT(Rule)
947#endif /* !YYDEBUG */
948
949
950/* YYINITDEPTH -- initial size of the parser's stacks. */
951#ifndef YYINITDEPTH
952# define YYINITDEPTH 200
953#endif
954
955/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
956 if the built-in stack extension method is used).
957
958 Do not make this value too large; the results are undefined if
959 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
960 evaluated with infinite-precision integer arithmetic. */
961
962#ifndef YYMAXDEPTH
963# define YYMAXDEPTH 10000
964#endif
965
966
967
968#if YYERROR_VERBOSE
969
970# ifndef yystrlen
971# if defined __GLIBC__ && defined _STRING_H
972# define yystrlen strlen
973# else
974/* Return the length of YYSTR. */
975#if (defined __STDC__ || defined __C99__FUNC__ \
976 || defined __cplusplus || defined _MSC_VER)
977static YYSIZE_T
978yystrlen (const char *yystr)
979#else
980static YYSIZE_T
981yystrlen (yystr)
982 const char *yystr;
983#endif
984{
985 YYSIZE_T yylen;
986 for (yylen = 0; yystr[yylen]; yylen++)
987 continue;
988 return yylen;
989}
990# endif
991# endif
992
993# ifndef yystpcpy
994# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
995# define yystpcpy stpcpy
996# else
997/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
998 YYDEST. */
999#if (defined __STDC__ || defined __C99__FUNC__ \
1000 || defined __cplusplus || defined _MSC_VER)
1001static char *
1002yystpcpy (char *yydest, const char *yysrc)
1003#else
1004static char *
1005yystpcpy (yydest, yysrc)
1006 char *yydest;
1007 const char *yysrc;
1008#endif
1009{
1010 char *yyd = yydest;
1011 const char *yys = yysrc;
1012
1013 while ((*yyd++ = *yys++) != '\0')
1014 continue;
1015
1016 return yyd - 1;
1017}
1018# endif
1019# endif
1020
1021# ifndef yytnamerr
1022/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1023 quotes and backslashes, so that it's suitable for yyerror. The
1024 heuristic is that double-quoting is unnecessary unless the string
1025 contains an apostrophe, a comma, or backslash (other than
1026 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1027 null, do not copy; instead, return the length of what the result
1028 would have been. */
1029static YYSIZE_T
1030yytnamerr (char *yyres, const char *yystr)
1031{
1032 if (*yystr == '"')
1033 {
1034 YYSIZE_T yyn = 0;
1035 char const *yyp = yystr;
1036
1037 for (;;)
1038 switch (*++yyp)
1039 {
1040 case '\'':
1041 case ',':
1042 goto do_not_strip_quotes;
1043
1044 case '\\':
1045 if (*++yyp != '\\')
1046 goto do_not_strip_quotes;
1047 /* Fall through. */
1048 default:
1049 if (yyres)
1050 yyres[yyn] = *yyp;
1051 yyn++;
1052 break;
1053
1054 case '"':
1055 if (yyres)
1056 yyres[yyn] = '\0';
1057 return yyn;
1058 }
1059 do_not_strip_quotes: ;
1060 }
1061
1062 if (! yyres)
1063 return yystrlen (yystr);
1064
1065 return yystpcpy (yyres, yystr) - yyres;
1066}
1067# endif
1068
1069/* Copy into YYRESULT an error message about the unexpected token
1070 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1071 including the terminating null byte. If YYRESULT is null, do not
1072 copy anything; just return the number of bytes that would be
1073 copied. As a special case, return 0 if an ordinary "syntax error"
1074 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1075 size calculation. */
1076static YYSIZE_T
1077yysyntax_error (char *yyresult, int yystate, int yychar)
1078{
1079 int yyn = yypact[yystate];
1080
1081 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1082 return 0;
1083 else
1084 {
1085 int yytype = YYTRANSLATE (yychar);
1086 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1087 YYSIZE_T yysize = yysize0;
1088 YYSIZE_T yysize1;
1089 int yysize_overflow = 0;
1090 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1091 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1092 int yyx;
1093
1094# if 0
1095 /* This is so xgettext sees the translatable formats that are
1096 constructed on the fly. */
1097 YY_("syntax error, unexpected %s");
1098 YY_("syntax error, unexpected %s, expecting %s");
1099 YY_("syntax error, unexpected %s, expecting %s or %s");
1100 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1101 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1102# endif
1103 char *yyfmt;
1104 char const *yyf;
1105 static char const yyunexpected[] = "syntax error, unexpected %s";
1106 static char const yyexpecting[] = ", expecting %s";
1107 static char const yyor[] = " or %s";
1108 char yyformat[sizeof yyunexpected
1109 + sizeof yyexpecting - 1
1110 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1111 * (sizeof yyor - 1))];
1112 char const *yyprefix = yyexpecting;
1113
1114 /* Start YYX at -YYN if negative to avoid negative indexes in
1115 YYCHECK. */
1116 int yyxbegin = yyn < 0 ? -yyn : 0;
1117
1118 /* Stay within bounds of both yycheck and yytname. */
1119 int yychecklim = YYLAST - yyn + 1;
1120 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1121 int yycount = 1;
1122
1123 yyarg[0] = yytname[yytype];
1124 yyfmt = yystpcpy (yyformat, yyunexpected);
1125
1126 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1127 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1128 {
1129 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1130 {
1131 yycount = 1;
1132 yysize = yysize0;
1133 yyformat[sizeof yyunexpected - 1] = '\0';
1134 break;
1135 }
1136 yyarg[yycount++] = yytname[yyx];
1137 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1138 yysize_overflow |= (yysize1 < yysize);
1139 yysize = yysize1;
1140 yyfmt = yystpcpy (yyfmt, yyprefix);
1141 yyprefix = yyor;
1142 }
1143
1144 yyf = YY_(yyformat);
1145 yysize1 = yysize + yystrlen (yyf);
1146 yysize_overflow |= (yysize1 < yysize);
1147 yysize = yysize1;
1148
1149 if (yysize_overflow)
1150 return YYSIZE_MAXIMUM;
1151
1152 if (yyresult)
1153 {
1154 /* Avoid sprintf, as that infringes on the user's name space.
1155 Don't have undefined behavior even if the translation
1156 produced a string with the wrong number of "%s"s. */
1157 char *yyp = yyresult;
1158 int yyi = 0;
1159 while ((*yyp = *yyf) != '\0')
1160 {
1161 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1162 {
1163 yyp += yytnamerr (yyp, yyarg[yyi++]);
1164 yyf += 2;
1165 }
1166 else
1167 {
1168 yyp++;
1169 yyf++;
1170 }
1171 }
1172 }
1173 return yysize;
1174 }
1175}
1176#endif /* YYERROR_VERBOSE */
1177
1178
1179/*-----------------------------------------------.
1180| Release the memory associated to this symbol. |
1181`-----------------------------------------------*/
1182
1183/*ARGSUSED*/
1184#if (defined __STDC__ || defined __C99__FUNC__ \
1185 || defined __cplusplus || defined _MSC_VER)
1186static void
John Bonesio658f29a2010-11-17 15:28:20 -08001187yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +11001188#else
1189static void
John Bonesio658f29a2010-11-17 15:28:20 -08001190yydestruct (yymsg, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +11001191 const char *yymsg;
1192 int yytype;
1193 YYSTYPE *yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +11001194#endif
1195{
1196 YYUSE (yyvaluep);
David Gibsona4da2e32007-12-18 15:06:42 +11001197
1198 if (!yymsg)
1199 yymsg = "Deleting";
1200 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1201
1202 switch (yytype)
1203 {
1204
1205 default:
1206 break;
1207 }
1208}
David Gibsona4da2e32007-12-18 15:06:42 +11001209
1210/* Prevent warnings from -Wmissing-prototypes. */
David Gibsona4da2e32007-12-18 15:06:42 +11001211#ifdef YYPARSE_PARAM
1212#if defined __STDC__ || defined __cplusplus
1213int yyparse (void *YYPARSE_PARAM);
1214#else
1215int yyparse ();
1216#endif
1217#else /* ! YYPARSE_PARAM */
1218#if defined __STDC__ || defined __cplusplus
1219int yyparse (void);
1220#else
1221int yyparse ();
1222#endif
1223#endif /* ! YYPARSE_PARAM */
1224
1225
John Bonesio658f29a2010-11-17 15:28:20 -08001226/* The lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001227int yychar;
1228
John Bonesio658f29a2010-11-17 15:28:20 -08001229/* The semantic value of the lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001230YYSTYPE yylval;
1231
1232/* Number of syntax errors so far. */
1233int yynerrs;
David Gibsona4da2e32007-12-18 15:06:42 +11001234
1235
1236
John Bonesio658f29a2010-11-17 15:28:20 -08001237/*-------------------------.
1238| yyparse or yypush_parse. |
1239`-------------------------*/
David Gibsona4da2e32007-12-18 15:06:42 +11001240
1241#ifdef YYPARSE_PARAM
1242#if (defined __STDC__ || defined __C99__FUNC__ \
1243 || defined __cplusplus || defined _MSC_VER)
1244int
1245yyparse (void *YYPARSE_PARAM)
1246#else
1247int
1248yyparse (YYPARSE_PARAM)
1249 void *YYPARSE_PARAM;
1250#endif
1251#else /* ! YYPARSE_PARAM */
1252#if (defined __STDC__ || defined __C99__FUNC__ \
1253 || defined __cplusplus || defined _MSC_VER)
1254int
1255yyparse (void)
1256#else
1257int
1258yyparse ()
1259
1260#endif
1261#endif
1262{
John Bonesio658f29a2010-11-17 15:28:20 -08001263
1264
1265 int yystate;
1266 /* Number of tokens to shift before error messages enabled. */
1267 int yyerrstatus;
1268
1269 /* The stacks and their tools:
1270 `yyss': related to states.
1271 `yyvs': related to semantic values.
1272
1273 Refer to the stacks thru separate pointers, to allow yyoverflow
1274 to reallocate them elsewhere. */
1275
1276 /* The state stack. */
1277 yytype_int16 yyssa[YYINITDEPTH];
1278 yytype_int16 *yyss;
1279 yytype_int16 *yyssp;
1280
1281 /* The semantic value stack. */
1282 YYSTYPE yyvsa[YYINITDEPTH];
1283 YYSTYPE *yyvs;
1284 YYSTYPE *yyvsp;
1285
1286 YYSIZE_T yystacksize;
1287
David Gibsona4da2e32007-12-18 15:06:42 +11001288 int yyn;
1289 int yyresult;
John Bonesio658f29a2010-11-17 15:28:20 -08001290 /* Lookahead token as an internal (translated) token number. */
1291 int yytoken;
1292 /* The variables used to return semantic value and location from the
1293 action routines. */
1294 YYSTYPE yyval;
1295
David Gibsona4da2e32007-12-18 15:06:42 +11001296#if YYERROR_VERBOSE
1297 /* Buffer for error messages, and its allocated size. */
1298 char yymsgbuf[128];
1299 char *yymsg = yymsgbuf;
1300 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1301#endif
1302
John Bonesio658f29a2010-11-17 15:28:20 -08001303#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
David Gibsona4da2e32007-12-18 15:06:42 +11001304
1305 /* The number of symbols on the RHS of the reduced rule.
1306 Keep to zero when no symbol should be popped. */
1307 int yylen = 0;
1308
John Bonesio658f29a2010-11-17 15:28:20 -08001309 yytoken = 0;
1310 yyss = yyssa;
1311 yyvs = yyvsa;
1312 yystacksize = YYINITDEPTH;
1313
David Gibsona4da2e32007-12-18 15:06:42 +11001314 YYDPRINTF ((stderr, "Starting parse\n"));
1315
1316 yystate = 0;
1317 yyerrstatus = 0;
1318 yynerrs = 0;
John Bonesio658f29a2010-11-17 15:28:20 -08001319 yychar = YYEMPTY; /* Cause a token to be read. */
David Gibsona4da2e32007-12-18 15:06:42 +11001320
1321 /* Initialize stack pointers.
1322 Waste one element of value and location stack
1323 so that they stay on the same level as the state stack.
1324 The wasted elements are never initialized. */
David Gibsona4da2e32007-12-18 15:06:42 +11001325 yyssp = yyss;
1326 yyvsp = yyvs;
David Gibsona4da2e32007-12-18 15:06:42 +11001327
1328 goto yysetstate;
1329
1330/*------------------------------------------------------------.
1331| yynewstate -- Push a new state, which is found in yystate. |
1332`------------------------------------------------------------*/
1333 yynewstate:
1334 /* In all cases, when you get here, the value and location stacks
1335 have just been pushed. So pushing a state here evens the stacks. */
1336 yyssp++;
1337
1338 yysetstate:
1339 *yyssp = yystate;
1340
1341 if (yyss + yystacksize - 1 <= yyssp)
1342 {
1343 /* Get the current used size of the three stacks, in elements. */
1344 YYSIZE_T yysize = yyssp - yyss + 1;
1345
1346#ifdef yyoverflow
1347 {
1348 /* Give user a chance to reallocate the stack. Use copies of
1349 these so that the &'s don't force the real ones into
1350 memory. */
1351 YYSTYPE *yyvs1 = yyvs;
1352 yytype_int16 *yyss1 = yyss;
David Gibsona4da2e32007-12-18 15:06:42 +11001353
1354 /* Each stack pointer address is followed by the size of the
1355 data in use in that stack, in bytes. This used to be a
1356 conditional around just the two extra args, but that might
1357 be undefined if yyoverflow is a macro. */
1358 yyoverflow (YY_("memory exhausted"),
1359 &yyss1, yysize * sizeof (*yyssp),
1360 &yyvs1, yysize * sizeof (*yyvsp),
David Gibsona4da2e32007-12-18 15:06:42 +11001361 &yystacksize);
John Bonesio658f29a2010-11-17 15:28:20 -08001362
David Gibsona4da2e32007-12-18 15:06:42 +11001363 yyss = yyss1;
1364 yyvs = yyvs1;
1365 }
1366#else /* no yyoverflow */
1367# ifndef YYSTACK_RELOCATE
1368 goto yyexhaustedlab;
1369# else
1370 /* Extend the stack our own way. */
1371 if (YYMAXDEPTH <= yystacksize)
1372 goto yyexhaustedlab;
1373 yystacksize *= 2;
1374 if (YYMAXDEPTH < yystacksize)
1375 yystacksize = YYMAXDEPTH;
1376
1377 {
1378 yytype_int16 *yyss1 = yyss;
1379 union yyalloc *yyptr =
1380 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1381 if (! yyptr)
1382 goto yyexhaustedlab;
John Bonesio658f29a2010-11-17 15:28:20 -08001383 YYSTACK_RELOCATE (yyss_alloc, yyss);
1384 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
David Gibsona4da2e32007-12-18 15:06:42 +11001385# undef YYSTACK_RELOCATE
1386 if (yyss1 != yyssa)
1387 YYSTACK_FREE (yyss1);
1388 }
1389# endif
1390#endif /* no yyoverflow */
1391
1392 yyssp = yyss + yysize - 1;
1393 yyvsp = yyvs + yysize - 1;
David Gibsona4da2e32007-12-18 15:06:42 +11001394
1395 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1396 (unsigned long int) yystacksize));
1397
1398 if (yyss + yystacksize - 1 <= yyssp)
1399 YYABORT;
1400 }
1401
1402 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1403
John Bonesio658f29a2010-11-17 15:28:20 -08001404 if (yystate == YYFINAL)
1405 YYACCEPT;
1406
David Gibsona4da2e32007-12-18 15:06:42 +11001407 goto yybackup;
1408
1409/*-----------.
1410| yybackup. |
1411`-----------*/
1412yybackup:
1413
1414 /* Do appropriate processing given the current state. Read a
John Bonesio658f29a2010-11-17 15:28:20 -08001415 lookahead token if we need one and don't already have one. */
David Gibsona4da2e32007-12-18 15:06:42 +11001416
John Bonesio658f29a2010-11-17 15:28:20 -08001417 /* First try to decide what to do without reference to lookahead token. */
David Gibsona4da2e32007-12-18 15:06:42 +11001418 yyn = yypact[yystate];
1419 if (yyn == YYPACT_NINF)
1420 goto yydefault;
1421
John Bonesio658f29a2010-11-17 15:28:20 -08001422 /* Not known => get a lookahead token if don't already have one. */
David Gibsona4da2e32007-12-18 15:06:42 +11001423
John Bonesio658f29a2010-11-17 15:28:20 -08001424 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001425 if (yychar == YYEMPTY)
1426 {
1427 YYDPRINTF ((stderr, "Reading a token: "));
1428 yychar = YYLEX;
1429 }
1430
1431 if (yychar <= YYEOF)
1432 {
1433 yychar = yytoken = YYEOF;
1434 YYDPRINTF ((stderr, "Now at end of input.\n"));
1435 }
1436 else
1437 {
1438 yytoken = YYTRANSLATE (yychar);
1439 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1440 }
1441
1442 /* If the proper action on seeing token YYTOKEN is to reduce or to
1443 detect an error, take that action. */
1444 yyn += yytoken;
1445 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1446 goto yydefault;
1447 yyn = yytable[yyn];
1448 if (yyn <= 0)
1449 {
1450 if (yyn == 0 || yyn == YYTABLE_NINF)
1451 goto yyerrlab;
1452 yyn = -yyn;
1453 goto yyreduce;
1454 }
1455
David Gibsona4da2e32007-12-18 15:06:42 +11001456 /* Count tokens shifted since error; after three, turn off error
1457 status. */
1458 if (yyerrstatus)
1459 yyerrstatus--;
1460
John Bonesio658f29a2010-11-17 15:28:20 -08001461 /* Shift the lookahead token. */
David Gibsona4da2e32007-12-18 15:06:42 +11001462 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1463
John Bonesio658f29a2010-11-17 15:28:20 -08001464 /* Discard the shifted token. */
1465 yychar = YYEMPTY;
David Gibsona4da2e32007-12-18 15:06:42 +11001466
1467 yystate = yyn;
1468 *++yyvsp = yylval;
John Bonesio658f29a2010-11-17 15:28:20 -08001469
David Gibsona4da2e32007-12-18 15:06:42 +11001470 goto yynewstate;
1471
1472
1473/*-----------------------------------------------------------.
1474| yydefault -- do the default action for the current state. |
1475`-----------------------------------------------------------*/
1476yydefault:
1477 yyn = yydefact[yystate];
1478 if (yyn == 0)
1479 goto yyerrlab;
1480 goto yyreduce;
1481
1482
1483/*-----------------------------.
1484| yyreduce -- Do a reduction. |
1485`-----------------------------*/
1486yyreduce:
1487 /* yyn is the number of a rule to reduce with. */
1488 yylen = yyr2[yyn];
1489
1490 /* If YYLEN is nonzero, implement the default value of the action:
1491 `$$ = $1'.
1492
1493 Otherwise, the following line sets YYVAL to garbage.
1494 This behavior is undocumented and Bison
1495 users should not rely upon it. Assigning to YYVAL
1496 unconditionally makes the parser a bit smaller, and it avoids a
1497 GCC warning that YYVAL may be used uninitialized. */
1498 yyval = yyvsp[1-yylen];
1499
John Bonesio658f29a2010-11-17 15:28:20 -08001500
David Gibsona4da2e32007-12-18 15:06:42 +11001501 YY_REDUCE_PRINT (yyn);
1502 switch (yyn)
1503 {
1504 case 2:
John Bonesio658f29a2010-11-17 15:28:20 -08001505
Stephen Warrencd296722012-09-28 21:25:59 +00001506/* Line 1455 of yacc.c */
1507#line 110 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001508 {
John Bonesio658f29a2010-11-17 15:28:20 -08001509 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
1510 guess_boot_cpuid((yyvsp[(4) - (4)].node)));
David Gibsona4da2e32007-12-18 15:06:42 +11001511 ;}
1512 break;
1513
1514 case 3:
John Bonesio658f29a2010-11-17 15:28:20 -08001515
Stephen Warrencd296722012-09-28 21:25:59 +00001516/* Line 1455 of yacc.c */
1517#line 118 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001518 {
John Bonesio658f29a2010-11-17 15:28:20 -08001519 (yyval.re) = NULL;
David Gibsona4da2e32007-12-18 15:06:42 +11001520 ;}
1521 break;
1522
1523 case 4:
John Bonesio658f29a2010-11-17 15:28:20 -08001524
Stephen Warrencd296722012-09-28 21:25:59 +00001525/* Line 1455 of yacc.c */
1526#line 122 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001527 {
John Bonesio658f29a2010-11-17 15:28:20 -08001528 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
David Gibsona4da2e32007-12-18 15:06:42 +11001529 ;}
1530 break;
1531
1532 case 5:
John Bonesio658f29a2010-11-17 15:28:20 -08001533
Stephen Warrencd296722012-09-28 21:25:59 +00001534/* Line 1455 of yacc.c */
1535#line 129 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001536 {
Stephen Warrencd296722012-09-28 21:25:59 +00001537 (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
David Gibsona4da2e32007-12-18 15:06:42 +11001538 ;}
1539 break;
1540
1541 case 6:
John Bonesio658f29a2010-11-17 15:28:20 -08001542
Stephen Warrencd296722012-09-28 21:25:59 +00001543/* Line 1455 of yacc.c */
1544#line 133 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001545 {
John Bonesio658f29a2010-11-17 15:28:20 -08001546 add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
1547 (yyval.re) = (yyvsp[(2) - (2)].re);
David Gibsona4da2e32007-12-18 15:06:42 +11001548 ;}
1549 break;
1550
1551 case 7:
David Gibsona4da2e32007-12-18 15:06:42 +11001552
Stephen Warrencd296722012-09-28 21:25:59 +00001553/* Line 1455 of yacc.c */
1554#line 141 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001555 {
John Bonesio658f29a2010-11-17 15:28:20 -08001556 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
David Gibsona4da2e32007-12-18 15:06:42 +11001557 ;}
1558 break;
1559
Stephen Warrencd296722012-09-28 21:25:59 +00001560 case 8:
John Bonesio658f29a2010-11-17 15:28:20 -08001561
Stephen Warrencd296722012-09-28 21:25:59 +00001562/* Line 1455 of yacc.c */
1563#line 145 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001564 {
John Bonesio658f29a2010-11-17 15:28:20 -08001565 (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
David Gibsona4da2e32007-12-18 15:06:42 +11001566 ;}
1567 break;
1568
Stephen Warrencd296722012-09-28 21:25:59 +00001569 case 9:
John Bonesio658f29a2010-11-17 15:28:20 -08001570
Stephen Warrencd296722012-09-28 21:25:59 +00001571/* Line 1455 of yacc.c */
1572#line 149 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001573 {
1574 struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
1575
1576 if (target)
1577 merge_nodes(target, (yyvsp[(3) - (3)].node));
1578 else
1579 print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
1580 (yyval.node) = (yyvsp[(1) - (3)].node);
1581 ;}
1582 break;
1583
Stephen Warrencd296722012-09-28 21:25:59 +00001584 case 10:
1585
1586/* Line 1455 of yacc.c */
1587#line 159 "dtc-parser.y"
1588 {
1589 struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
1590
1591 if (!target)
1592 print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
1593 else
1594 delete_node(target);
1595
1596 (yyval.node) = (yyvsp[(1) - (4)].node);
1597 ;}
1598 break;
1599
John Bonesio658f29a2010-11-17 15:28:20 -08001600 case 11:
1601
Stephen Warrencd296722012-09-28 21:25:59 +00001602/* Line 1455 of yacc.c */
1603#line 173 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001604 {
1605 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
1606 ;}
1607 break;
1608
John Bonesio658f29a2010-11-17 15:28:20 -08001609 case 12:
1610
Stephen Warrencd296722012-09-28 21:25:59 +00001611/* Line 1455 of yacc.c */
1612#line 180 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001613 {
1614 (yyval.proplist) = NULL;
1615 ;}
1616 break;
1617
John Bonesio658f29a2010-11-17 15:28:20 -08001618 case 13:
1619
Stephen Warrencd296722012-09-28 21:25:59 +00001620/* Line 1455 of yacc.c */
1621#line 184 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001622 {
1623 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
1624 ;}
1625 break;
1626
John Bonesio658f29a2010-11-17 15:28:20 -08001627 case 14:
1628
Stephen Warrencd296722012-09-28 21:25:59 +00001629/* Line 1455 of yacc.c */
1630#line 191 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001631 {
1632 (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
1633 ;}
1634 break;
1635
1636 case 15:
1637
Stephen Warrencd296722012-09-28 21:25:59 +00001638/* Line 1455 of yacc.c */
1639#line 195 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001640 {
1641 (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
1642 ;}
1643 break;
1644
1645 case 16:
1646
Stephen Warrencd296722012-09-28 21:25:59 +00001647/* Line 1455 of yacc.c */
1648#line 199 "dtc-parser.y"
1649 {
1650 (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
1651 ;}
1652 break;
1653
1654 case 17:
1655
1656/* Line 1455 of yacc.c */
1657#line 203 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001658 {
1659 add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
1660 (yyval.prop) = (yyvsp[(2) - (2)].prop);
1661 ;}
1662 break;
1663
Stephen Warrencd296722012-09-28 21:25:59 +00001664 case 18:
David Gibsona4da2e32007-12-18 15:06:42 +11001665
Stephen Warrencd296722012-09-28 21:25:59 +00001666/* Line 1455 of yacc.c */
1667#line 211 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001668 {
1669 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
1670 ;}
1671 break;
1672
John Bonesio658f29a2010-11-17 15:28:20 -08001673 case 19:
1674
Stephen Warrencd296722012-09-28 21:25:59 +00001675/* Line 1455 of yacc.c */
1676#line 215 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001677 {
Stephen Warrencd296722012-09-28 21:25:59 +00001678 (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
John Bonesio658f29a2010-11-17 15:28:20 -08001679 ;}
1680 break;
1681
David Gibsona4da2e32007-12-18 15:06:42 +11001682 case 20:
John Bonesio658f29a2010-11-17 15:28:20 -08001683
Stephen Warrencd296722012-09-28 21:25:59 +00001684/* Line 1455 of yacc.c */
1685#line 219 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001686 {
Stephen Warrencd296722012-09-28 21:25:59 +00001687 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
David Gibsona4da2e32007-12-18 15:06:42 +11001688 ;}
1689 break;
1690
John Bonesio658f29a2010-11-17 15:28:20 -08001691 case 21:
1692
Stephen Warrencd296722012-09-28 21:25:59 +00001693/* Line 1455 of yacc.c */
1694#line 223 "dtc-parser.y"
1695 {
1696 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
1697 ;}
1698 break;
1699
1700 case 22:
1701
1702/* Line 1455 of yacc.c */
1703#line 227 "dtc-parser.y"
David Gibsoned95d742008-08-07 12:24:17 +10001704 {
John Bonesio658f29a2010-11-17 15:28:20 -08001705 FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
1706 struct data d;
David Gibsoned95d742008-08-07 12:24:17 +10001707
Stephen Warrencd296722012-09-28 21:25:59 +00001708 if ((yyvsp[(6) - (9)].integer) != 0)
1709 if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
John Bonesio658f29a2010-11-17 15:28:20 -08001710 print_error("Couldn't seek to offset %llu in \"%s\": %s",
Stephen Warrencd296722012-09-28 21:25:59 +00001711 (unsigned long long)(yyvsp[(6) - (9)].integer),
John Bonesio658f29a2010-11-17 15:28:20 -08001712 (yyvsp[(4) - (9)].data).val,
1713 strerror(errno));
David Gibsoned95d742008-08-07 12:24:17 +10001714
Stephen Warrencd296722012-09-28 21:25:59 +00001715 d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
David Gibsoned95d742008-08-07 12:24:17 +10001716
1717 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
John Bonesio658f29a2010-11-17 15:28:20 -08001718 fclose(f);
David Gibsoned95d742008-08-07 12:24:17 +10001719 ;}
1720 break;
1721
Stephen Warrencd296722012-09-28 21:25:59 +00001722 case 23:
John Bonesio658f29a2010-11-17 15:28:20 -08001723
Stephen Warrencd296722012-09-28 21:25:59 +00001724/* Line 1455 of yacc.c */
1725#line 244 "dtc-parser.y"
David Gibsoned95d742008-08-07 12:24:17 +10001726 {
John Bonesio658f29a2010-11-17 15:28:20 -08001727 FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
David Gibsoned95d742008-08-07 12:24:17 +10001728 struct data d = empty_data;
1729
John Bonesio658f29a2010-11-17 15:28:20 -08001730 d = data_copy_file(f, -1);
David Gibsoned95d742008-08-07 12:24:17 +10001731
1732 (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
John Bonesio658f29a2010-11-17 15:28:20 -08001733 fclose(f);
David Gibsoned95d742008-08-07 12:24:17 +10001734 ;}
1735 break;
1736
John Bonesio658f29a2010-11-17 15:28:20 -08001737 case 24:
1738
Stephen Warrencd296722012-09-28 21:25:59 +00001739/* Line 1455 of yacc.c */
1740#line 254 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001741 {
Stephen Warrencd296722012-09-28 21:25:59 +00001742 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
David Gibsona4da2e32007-12-18 15:06:42 +11001743 ;}
1744 break;
1745
John Bonesio658f29a2010-11-17 15:28:20 -08001746 case 25:
1747
Stephen Warrencd296722012-09-28 21:25:59 +00001748/* Line 1455 of yacc.c */
1749#line 261 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001750 {
Stephen Warrencd296722012-09-28 21:25:59 +00001751 (yyval.data) = empty_data;
David Gibsona4da2e32007-12-18 15:06:42 +11001752 ;}
1753 break;
1754
John Bonesio658f29a2010-11-17 15:28:20 -08001755 case 26:
1756
Stephen Warrencd296722012-09-28 21:25:59 +00001757/* Line 1455 of yacc.c */
1758#line 265 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001759 {
Stephen Warrencd296722012-09-28 21:25:59 +00001760 (yyval.data) = (yyvsp[(1) - (2)].data);
David Gibsona4da2e32007-12-18 15:06:42 +11001761 ;}
1762 break;
1763
John Bonesio658f29a2010-11-17 15:28:20 -08001764 case 27:
1765
Stephen Warrencd296722012-09-28 21:25:59 +00001766/* Line 1455 of yacc.c */
1767#line 269 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001768 {
Stephen Warrencd296722012-09-28 21:25:59 +00001769 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
David Gibsona4da2e32007-12-18 15:06:42 +11001770 ;}
1771 break;
1772
John Bonesio658f29a2010-11-17 15:28:20 -08001773 case 28:
1774
Stephen Warrencd296722012-09-28 21:25:59 +00001775/* Line 1455 of yacc.c */
1776#line 276 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001777 {
Stephen Warrencd296722012-09-28 21:25:59 +00001778 (yyval.array).data = empty_data;
1779 (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
1780
1781 if (((yyval.array).bits != 8) &&
1782 ((yyval.array).bits != 16) &&
1783 ((yyval.array).bits != 32) &&
1784 ((yyval.array).bits != 64))
1785 {
1786 print_error("Only 8, 16, 32 and 64-bit elements"
1787 " are currently supported");
1788 (yyval.array).bits = 32;
1789 }
David Gibsona4da2e32007-12-18 15:06:42 +11001790 ;}
1791 break;
1792
John Bonesio658f29a2010-11-17 15:28:20 -08001793 case 29:
1794
Stephen Warrencd296722012-09-28 21:25:59 +00001795/* Line 1455 of yacc.c */
1796#line 291 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001797 {
Stephen Warrencd296722012-09-28 21:25:59 +00001798 (yyval.array).data = empty_data;
1799 (yyval.array).bits = 32;
David Gibsona4da2e32007-12-18 15:06:42 +11001800 ;}
1801 break;
1802
John Bonesio658f29a2010-11-17 15:28:20 -08001803 case 30:
1804
Stephen Warrencd296722012-09-28 21:25:59 +00001805/* Line 1455 of yacc.c */
1806#line 296 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001807 {
Stephen Warrencd296722012-09-28 21:25:59 +00001808 if ((yyvsp[(1) - (2)].array).bits < 64) {
1809 uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
1810 /*
1811 * Bits above mask must either be all zero
1812 * (positive within range of mask) or all one
1813 * (negative and sign-extended). The second
1814 * condition is true if when we set all bits
1815 * within the mask to one (i.e. | in the
1816 * mask), all bits are one.
1817 */
1818 if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
1819 print_error(
1820 "integer value out of range "
1821 "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
1822 }
1823
1824 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
David Gibsona4da2e32007-12-18 15:06:42 +11001825 ;}
1826 break;
1827
John Bonesio658f29a2010-11-17 15:28:20 -08001828 case 31:
David Gibsona4da2e32007-12-18 15:06:42 +11001829
Stephen Warrencd296722012-09-28 21:25:59 +00001830/* Line 1455 of yacc.c */
1831#line 316 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001832 {
Stephen Warrencd296722012-09-28 21:25:59 +00001833 uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
1834
1835 if ((yyvsp[(1) - (2)].array).bits == 32)
1836 (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
1837 REF_PHANDLE,
1838 (yyvsp[(2) - (2)].labelref));
1839 else
1840 print_error("References are only allowed in "
1841 "arrays with 32-bit elements.");
1842
1843 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
David Gibsona4da2e32007-12-18 15:06:42 +11001844 ;}
1845 break;
1846
John Bonesio658f29a2010-11-17 15:28:20 -08001847 case 32:
David Gibsona4da2e32007-12-18 15:06:42 +11001848
Stephen Warrencd296722012-09-28 21:25:59 +00001849/* Line 1455 of yacc.c */
1850#line 330 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001851 {
Stephen Warrencd296722012-09-28 21:25:59 +00001852 (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
David Gibsona4da2e32007-12-18 15:06:42 +11001853 ;}
1854 break;
1855
John Bonesio658f29a2010-11-17 15:28:20 -08001856 case 33:
1857
Stephen Warrencd296722012-09-28 21:25:59 +00001858/* Line 1455 of yacc.c */
1859#line 337 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001860 {
Stephen Warrencd296722012-09-28 21:25:59 +00001861 (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
David Gibsona4da2e32007-12-18 15:06:42 +11001862 ;}
1863 break;
1864
John Bonesio658f29a2010-11-17 15:28:20 -08001865 case 34:
1866
Stephen Warrencd296722012-09-28 21:25:59 +00001867/* Line 1455 of yacc.c */
1868#line 341 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001869 {
Stephen Warrencd296722012-09-28 21:25:59 +00001870 (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
David Gibsona4da2e32007-12-18 15:06:42 +11001871 ;}
1872 break;
1873
John Bonesio658f29a2010-11-17 15:28:20 -08001874 case 35:
1875
Stephen Warrencd296722012-09-28 21:25:59 +00001876/* Line 1455 of yacc.c */
1877#line 345 "dtc-parser.y"
1878 {
1879 (yyval.integer) = (yyvsp[(2) - (3)].integer);
1880 ;}
1881 break;
1882
1883 case 38:
1884
1885/* Line 1455 of yacc.c */
1886#line 356 "dtc-parser.y"
1887 { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); ;}
1888 break;
1889
1890 case 40:
1891
1892/* Line 1455 of yacc.c */
1893#line 361 "dtc-parser.y"
1894 { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); ;}
1895 break;
1896
1897 case 42:
1898
1899/* Line 1455 of yacc.c */
1900#line 366 "dtc-parser.y"
1901 { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); ;}
1902 break;
1903
1904 case 44:
1905
1906/* Line 1455 of yacc.c */
1907#line 371 "dtc-parser.y"
1908 { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); ;}
1909 break;
1910
1911 case 46:
1912
1913/* Line 1455 of yacc.c */
1914#line 376 "dtc-parser.y"
1915 { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); ;}
1916 break;
1917
1918 case 48:
1919
1920/* Line 1455 of yacc.c */
1921#line 381 "dtc-parser.y"
1922 { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); ;}
1923 break;
1924
1925 case 50:
1926
1927/* Line 1455 of yacc.c */
1928#line 386 "dtc-parser.y"
1929 { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); ;}
1930 break;
1931
1932 case 51:
1933
1934/* Line 1455 of yacc.c */
1935#line 387 "dtc-parser.y"
1936 { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); ;}
1937 break;
1938
1939 case 53:
1940
1941/* Line 1455 of yacc.c */
1942#line 392 "dtc-parser.y"
1943 { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); ;}
1944 break;
1945
1946 case 54:
1947
1948/* Line 1455 of yacc.c */
1949#line 393 "dtc-parser.y"
1950 { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); ;}
1951 break;
1952
1953 case 55:
1954
1955/* Line 1455 of yacc.c */
1956#line 394 "dtc-parser.y"
1957 { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); ;}
1958 break;
1959
1960 case 56:
1961
1962/* Line 1455 of yacc.c */
1963#line 395 "dtc-parser.y"
1964 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); ;}
1965 break;
1966
1967 case 57:
1968
1969/* Line 1455 of yacc.c */
1970#line 399 "dtc-parser.y"
1971 { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); ;}
1972 break;
1973
1974 case 58:
1975
1976/* Line 1455 of yacc.c */
1977#line 400 "dtc-parser.y"
1978 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); ;}
1979 break;
1980
1981 case 60:
1982
1983/* Line 1455 of yacc.c */
1984#line 405 "dtc-parser.y"
1985 { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;}
1986 break;
1987
1988 case 61:
1989
1990/* Line 1455 of yacc.c */
1991#line 406 "dtc-parser.y"
1992 { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); ;}
1993 break;
1994
1995 case 63:
1996
1997/* Line 1455 of yacc.c */
1998#line 411 "dtc-parser.y"
1999 { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); ;}
2000 break;
2001
2002 case 64:
2003
2004/* Line 1455 of yacc.c */
2005#line 412 "dtc-parser.y"
2006 { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); ;}
2007 break;
2008
2009 case 65:
2010
2011/* Line 1455 of yacc.c */
2012#line 413 "dtc-parser.y"
2013 { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); ;}
2014 break;
2015
2016 case 68:
2017
2018/* Line 1455 of yacc.c */
2019#line 419 "dtc-parser.y"
2020 { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;}
2021 break;
2022
2023 case 69:
2024
2025/* Line 1455 of yacc.c */
2026#line 420 "dtc-parser.y"
2027 { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); ;}
2028 break;
2029
2030 case 70:
2031
2032/* Line 1455 of yacc.c */
2033#line 421 "dtc-parser.y"
2034 { (yyval.integer) = !(yyvsp[(2) - (2)].integer); ;}
2035 break;
2036
2037 case 71:
2038
2039/* Line 1455 of yacc.c */
2040#line 426 "dtc-parser.y"
2041 {
2042 (yyval.data) = empty_data;
2043 ;}
2044 break;
2045
2046 case 72:
2047
2048/* Line 1455 of yacc.c */
2049#line 430 "dtc-parser.y"
2050 {
2051 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
2052 ;}
2053 break;
2054
2055 case 73:
2056
2057/* Line 1455 of yacc.c */
2058#line 434 "dtc-parser.y"
2059 {
2060 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
2061 ;}
2062 break;
2063
2064 case 74:
2065
2066/* Line 1455 of yacc.c */
2067#line 441 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002068 {
2069 (yyval.nodelist) = NULL;
2070 ;}
2071 break;
2072
Stephen Warrencd296722012-09-28 21:25:59 +00002073 case 75:
John Bonesio658f29a2010-11-17 15:28:20 -08002074
Stephen Warrencd296722012-09-28 21:25:59 +00002075/* Line 1455 of yacc.c */
2076#line 445 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002077 {
2078 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
2079 ;}
2080 break;
2081
Stephen Warrencd296722012-09-28 21:25:59 +00002082 case 76:
John Bonesio658f29a2010-11-17 15:28:20 -08002083
Stephen Warrencd296722012-09-28 21:25:59 +00002084/* Line 1455 of yacc.c */
2085#line 449 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002086 {
John Bonesio658f29a2010-11-17 15:28:20 -08002087 print_error("syntax error: properties must precede subnodes");
David Gibsona4da2e32007-12-18 15:06:42 +11002088 YYERROR;
2089 ;}
2090 break;
2091
Stephen Warrencd296722012-09-28 21:25:59 +00002092 case 77:
John Bonesio658f29a2010-11-17 15:28:20 -08002093
Stephen Warrencd296722012-09-28 21:25:59 +00002094/* Line 1455 of yacc.c */
2095#line 457 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002096 {
John Bonesio658f29a2010-11-17 15:28:20 -08002097 (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
David Gibsona4da2e32007-12-18 15:06:42 +11002098 ;}
2099 break;
2100
Stephen Warrencd296722012-09-28 21:25:59 +00002101 case 78:
David Gibsona4da2e32007-12-18 15:06:42 +11002102
Stephen Warrencd296722012-09-28 21:25:59 +00002103/* Line 1455 of yacc.c */
2104#line 461 "dtc-parser.y"
2105 {
2106 (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
2107 ;}
2108 break;
2109
2110 case 79:
2111
2112/* Line 1455 of yacc.c */
2113#line 465 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002114 {
John Bonesio658f29a2010-11-17 15:28:20 -08002115 add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
2116 (yyval.node) = (yyvsp[(2) - (2)].node);
David Gibsona4da2e32007-12-18 15:06:42 +11002117 ;}
2118 break;
2119
2120
John Bonesio658f29a2010-11-17 15:28:20 -08002121
Stephen Warrencd296722012-09-28 21:25:59 +00002122/* Line 1455 of yacc.c */
2123#line 2124 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +11002124 default: break;
2125 }
2126 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2127
2128 YYPOPSTACK (yylen);
2129 yylen = 0;
2130 YY_STACK_PRINT (yyss, yyssp);
2131
2132 *++yyvsp = yyval;
David Gibsona4da2e32007-12-18 15:06:42 +11002133
2134 /* Now `shift' the result of the reduction. Determine what state
2135 that goes to, based on the state we popped back to and the rule
2136 number reduced by. */
2137
2138 yyn = yyr1[yyn];
2139
2140 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2141 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2142 yystate = yytable[yystate];
2143 else
2144 yystate = yydefgoto[yyn - YYNTOKENS];
2145
2146 goto yynewstate;
2147
2148
2149/*------------------------------------.
2150| yyerrlab -- here on detecting error |
2151`------------------------------------*/
2152yyerrlab:
2153 /* If not already recovering from an error, report this error. */
2154 if (!yyerrstatus)
2155 {
2156 ++yynerrs;
2157#if ! YYERROR_VERBOSE
2158 yyerror (YY_("syntax error"));
2159#else
2160 {
2161 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
2162 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
2163 {
2164 YYSIZE_T yyalloc = 2 * yysize;
2165 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
2166 yyalloc = YYSTACK_ALLOC_MAXIMUM;
2167 if (yymsg != yymsgbuf)
2168 YYSTACK_FREE (yymsg);
2169 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
2170 if (yymsg)
2171 yymsg_alloc = yyalloc;
2172 else
2173 {
2174 yymsg = yymsgbuf;
2175 yymsg_alloc = sizeof yymsgbuf;
2176 }
2177 }
2178
2179 if (0 < yysize && yysize <= yymsg_alloc)
2180 {
2181 (void) yysyntax_error (yymsg, yystate, yychar);
2182 yyerror (yymsg);
2183 }
2184 else
2185 {
2186 yyerror (YY_("syntax error"));
2187 if (yysize != 0)
2188 goto yyexhaustedlab;
2189 }
2190 }
2191#endif
2192 }
2193
John Bonesio658f29a2010-11-17 15:28:20 -08002194
David Gibsona4da2e32007-12-18 15:06:42 +11002195
2196 if (yyerrstatus == 3)
2197 {
John Bonesio658f29a2010-11-17 15:28:20 -08002198 /* If just tried and failed to reuse lookahead token after an
David Gibsona4da2e32007-12-18 15:06:42 +11002199 error, discard it. */
2200
2201 if (yychar <= YYEOF)
2202 {
2203 /* Return failure if at end of input. */
2204 if (yychar == YYEOF)
2205 YYABORT;
2206 }
2207 else
2208 {
2209 yydestruct ("Error: discarding",
John Bonesio658f29a2010-11-17 15:28:20 -08002210 yytoken, &yylval);
David Gibsona4da2e32007-12-18 15:06:42 +11002211 yychar = YYEMPTY;
2212 }
2213 }
2214
John Bonesio658f29a2010-11-17 15:28:20 -08002215 /* Else will try to reuse lookahead token after shifting the error
David Gibsona4da2e32007-12-18 15:06:42 +11002216 token. */
2217 goto yyerrlab1;
2218
2219
2220/*---------------------------------------------------.
2221| yyerrorlab -- error raised explicitly by YYERROR. |
2222`---------------------------------------------------*/
2223yyerrorlab:
2224
2225 /* Pacify compilers like GCC when the user code never invokes
2226 YYERROR and the label yyerrorlab therefore never appears in user
2227 code. */
2228 if (/*CONSTCOND*/ 0)
2229 goto yyerrorlab;
2230
David Gibsona4da2e32007-12-18 15:06:42 +11002231 /* Do not reclaim the symbols of the rule which action triggered
2232 this YYERROR. */
2233 YYPOPSTACK (yylen);
2234 yylen = 0;
2235 YY_STACK_PRINT (yyss, yyssp);
2236 yystate = *yyssp;
2237 goto yyerrlab1;
2238
2239
2240/*-------------------------------------------------------------.
2241| yyerrlab1 -- common code for both syntax error and YYERROR. |
2242`-------------------------------------------------------------*/
2243yyerrlab1:
2244 yyerrstatus = 3; /* Each real token shifted decrements this. */
2245
2246 for (;;)
2247 {
2248 yyn = yypact[yystate];
2249 if (yyn != YYPACT_NINF)
2250 {
2251 yyn += YYTERROR;
2252 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2253 {
2254 yyn = yytable[yyn];
2255 if (0 < yyn)
2256 break;
2257 }
2258 }
2259
2260 /* Pop the current state because it cannot handle the error token. */
2261 if (yyssp == yyss)
2262 YYABORT;
2263
John Bonesio658f29a2010-11-17 15:28:20 -08002264
David Gibsona4da2e32007-12-18 15:06:42 +11002265 yydestruct ("Error: popping",
John Bonesio658f29a2010-11-17 15:28:20 -08002266 yystos[yystate], yyvsp);
David Gibsona4da2e32007-12-18 15:06:42 +11002267 YYPOPSTACK (1);
2268 yystate = *yyssp;
2269 YY_STACK_PRINT (yyss, yyssp);
2270 }
2271
David Gibsona4da2e32007-12-18 15:06:42 +11002272 *++yyvsp = yylval;
2273
David Gibsona4da2e32007-12-18 15:06:42 +11002274
2275 /* Shift the error token. */
2276 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2277
2278 yystate = yyn;
2279 goto yynewstate;
2280
2281
2282/*-------------------------------------.
2283| yyacceptlab -- YYACCEPT comes here. |
2284`-------------------------------------*/
2285yyacceptlab:
2286 yyresult = 0;
2287 goto yyreturn;
2288
2289/*-----------------------------------.
2290| yyabortlab -- YYABORT comes here. |
2291`-----------------------------------*/
2292yyabortlab:
2293 yyresult = 1;
2294 goto yyreturn;
2295
John Bonesio658f29a2010-11-17 15:28:20 -08002296#if !defined(yyoverflow) || YYERROR_VERBOSE
David Gibsona4da2e32007-12-18 15:06:42 +11002297/*-------------------------------------------------.
2298| yyexhaustedlab -- memory exhaustion comes here. |
2299`-------------------------------------------------*/
2300yyexhaustedlab:
2301 yyerror (YY_("memory exhausted"));
2302 yyresult = 2;
2303 /* Fall through. */
2304#endif
2305
2306yyreturn:
John Bonesio658f29a2010-11-17 15:28:20 -08002307 if (yychar != YYEMPTY)
David Gibsona4da2e32007-12-18 15:06:42 +11002308 yydestruct ("Cleanup: discarding lookahead",
John Bonesio658f29a2010-11-17 15:28:20 -08002309 yytoken, &yylval);
David Gibsona4da2e32007-12-18 15:06:42 +11002310 /* Do not reclaim the symbols of the rule which action triggered
2311 this YYABORT or YYACCEPT. */
2312 YYPOPSTACK (yylen);
2313 YY_STACK_PRINT (yyss, yyssp);
2314 while (yyssp != yyss)
2315 {
2316 yydestruct ("Cleanup: popping",
John Bonesio658f29a2010-11-17 15:28:20 -08002317 yystos[*yyssp], yyvsp);
David Gibsona4da2e32007-12-18 15:06:42 +11002318 YYPOPSTACK (1);
2319 }
2320#ifndef yyoverflow
2321 if (yyss != yyssa)
2322 YYSTACK_FREE (yyss);
2323#endif
2324#if YYERROR_VERBOSE
2325 if (yymsg != yymsgbuf)
2326 YYSTACK_FREE (yymsg);
2327#endif
2328 /* Make sure YYID is used. */
2329 return YYID (yyresult);
2330}
2331
2332
John Bonesio658f29a2010-11-17 15:28:20 -08002333
Stephen Warrencd296722012-09-28 21:25:59 +00002334/* Line 1675 of yacc.c */
2335#line 471 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002336
2337
John Bonesio658f29a2010-11-17 15:28:20 -08002338void print_error(char const *fmt, ...)
David Gibsona4da2e32007-12-18 15:06:42 +11002339{
David Gibsoned95d742008-08-07 12:24:17 +10002340 va_list va;
David Gibsona4da2e32007-12-18 15:06:42 +11002341
John Bonesio658f29a2010-11-17 15:28:20 -08002342 va_start(va, fmt);
2343 srcpos_verror(&yylloc, fmt, va);
2344 va_end(va);
David Gibsoned95d742008-08-07 12:24:17 +10002345
2346 treesource_error = 1;
David Gibsona4da2e32007-12-18 15:06:42 +11002347}
2348
John Bonesio658f29a2010-11-17 15:28:20 -08002349void yyerror(char const *s) {
2350 print_error("%s", s);
David Gibsoned95d742008-08-07 12:24:17 +10002351}
2352
2353static unsigned long long eval_literal(const char *s, int base, int bits)
David Gibsona4da2e32007-12-18 15:06:42 +11002354{
2355 unsigned long long val;
2356 char *e;
2357
2358 errno = 0;
2359 val = strtoull(s, &e, base);
Stephen Warrencd296722012-09-28 21:25:59 +00002360 if (*e) {
2361 size_t uls = strspn(e, "UL");
2362 if (e[uls])
2363 print_error("bad characters in literal");
2364 }
2365 if ((errno == ERANGE)
David Gibsona4da2e32007-12-18 15:06:42 +11002366 || ((bits < 64) && (val >= (1ULL << bits))))
John Bonesio658f29a2010-11-17 15:28:20 -08002367 print_error("literal out of range");
David Gibsona4da2e32007-12-18 15:06:42 +11002368 else if (errno != 0)
John Bonesio658f29a2010-11-17 15:28:20 -08002369 print_error("bad literal");
David Gibsona4da2e32007-12-18 15:06:42 +11002370 return val;
2371}
2372
Stephen Warrencd296722012-09-28 21:25:59 +00002373static unsigned char eval_char_literal(const char *s)
2374{
2375 int i = 1;
2376 char c = s[0];
2377
2378 if (c == '\0')
2379 {
2380 print_error("empty character literal");
2381 return 0;
2382 }
2383
2384 /*
2385 * If the first character in the character literal is a \ then process
2386 * the remaining characters as an escape encoding. If the first
2387 * character is neither an escape or a terminator it should be the only
2388 * character in the literal and will be returned.
2389 */
2390 if (c == '\\')
2391 c = get_escape_char(s, &i);
2392
2393 if (s[i] != '\0')
2394 print_error("malformed character literal");
2395
2396 return c;
2397}
2398