blob: ee1d8c3042fbb841447f369676e4b45b34fd6ab8 [file] [log] [blame]
Grant Likely2a6a08c2013-06-13 13:00:43 +01001/* A Bison parser, made by GNU Bison 2.5. */
Stephen Warrencd296722012-09-28 21:25:59 +00002
Grant Likely2a6a08c2013-06-13 13:00:43 +01003/* Bison implementation for Yacc-like parsers in C
John Bonesio658f29a2010-11-17 15:28:20 -08004
Grant Likely2a6a08c2013-06-13 13:00:43 +01005 Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
John Bonesio658f29a2010-11-17 15:28:20 -08006
7 This program is free software: you can redistribute it and/or modify
David Gibsona4da2e32007-12-18 15:06:42 +11008 it under the terms of the GNU General Public License as published by
John Bonesio658f29a2010-11-17 15:28:20 -08009 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
David Gibsona4da2e32007-12-18 15:06:42 +110012 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
John Bonesio658f29a2010-11-17 15:28:20 -080016
David Gibsona4da2e32007-12-18 15:06:42 +110017 You should have received a copy of the GNU General Public License
John Bonesio658f29a2010-11-17 15:28:20 -080018 along with this program. If not, see <http://www.gnu.org/licenses/>. */
David Gibsona4da2e32007-12-18 15:06:42 +110019
20/* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
John Bonesio658f29a2010-11-17 15:28:20 -080029
David Gibsona4da2e32007-12-18 15:06:42 +110030 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33/* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36/* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43/* Identify Bison output. */
44#define YYBISON 1
45
46/* Bison version. */
Grant Likely2a6a08c2013-06-13 13:00:43 +010047#define YYBISON_VERSION "2.5"
David Gibsona4da2e32007-12-18 15:06:42 +110048
49/* Skeleton name. */
50#define YYSKELETON_NAME "yacc.c"
51
52/* Pure parsers. */
53#define YYPURE 0
54
John Bonesio658f29a2010-11-17 15:28:20 -080055/* Push parsers. */
56#define YYPUSH 0
57
58/* Pull parsers. */
59#define YYPULL 1
60
David Gibsona4da2e32007-12-18 15:06:42 +110061/* Using locations. */
John Bonesio658f29a2010-11-17 15:28:20 -080062#define YYLSP_NEEDED 0
David Gibsona4da2e32007-12-18 15:06:42 +110063
64
65
66/* Copy the first part of user declarations. */
John Bonesio658f29a2010-11-17 15:28:20 -080067
Grant Likely2a6a08c2013-06-13 13:00:43 +010068/* Line 268 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +000069#line 21 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +110070
David Gibsoned95d742008-08-07 12:24:17 +100071#include <stdio.h>
72
David Gibsona4da2e32007-12-18 15:06:42 +110073#include "dtc.h"
74#include "srcpos.h"
75
John Bonesio658f29a2010-11-17 15:28:20 -080076YYLTYPE yylloc;
77
David Gibsoned95d742008-08-07 12:24:17 +100078extern int yylex(void);
John Bonesio658f29a2010-11-17 15:28:20 -080079extern void print_error(char const *fmt, ...);
80extern void yyerror(char const *s);
David Gibsona4da2e32007-12-18 15:06:42 +110081
82extern struct boot_info *the_boot_info;
David Gibsoned95d742008-08-07 12:24:17 +100083extern int treesource_error;
David Gibsona4da2e32007-12-18 15:06:42 +110084
David Gibsoned95d742008-08-07 12:24:17 +100085static unsigned long long eval_literal(const char *s, int base, int bits);
Stephen Warrencd296722012-09-28 21:25:59 +000086static unsigned char eval_char_literal(const char *s);
David Gibsona4da2e32007-12-18 15:06:42 +110087
88
Grant Likely2a6a08c2013-06-13 13:00:43 +010089/* Line 268 of yacc.c */
90#line 91 "dtc-parser.tab.c"
John Bonesio658f29a2010-11-17 15:28:20 -080091
David Gibsona4da2e32007-12-18 15:06:42 +110092/* Enabling traces. */
93#ifndef YYDEBUG
Stephen Warrencd296722012-09-28 21:25:59 +000094# define YYDEBUG 0
David Gibsona4da2e32007-12-18 15:06:42 +110095#endif
96
97/* Enabling verbose error messages. */
98#ifdef YYERROR_VERBOSE
99# undef YYERROR_VERBOSE
100# define YYERROR_VERBOSE 1
101#else
102# define YYERROR_VERBOSE 0
103#endif
104
105/* Enabling the token table. */
106#ifndef YYTOKEN_TABLE
107# define YYTOKEN_TABLE 0
108#endif
109
John Bonesio658f29a2010-11-17 15:28:20 -0800110
111/* Tokens. */
112#ifndef YYTOKENTYPE
113# define YYTOKENTYPE
114 /* Put the tokens into the symbol table, so that GDB and other debuggers
115 know about them. */
116 enum yytokentype {
117 DT_V1 = 258,
118 DT_MEMRESERVE = 259,
Stephen Warrencd296722012-09-28 21:25:59 +0000119 DT_LSHIFT = 260,
120 DT_RSHIFT = 261,
121 DT_LE = 262,
122 DT_GE = 263,
123 DT_EQ = 264,
124 DT_NE = 265,
125 DT_AND = 266,
126 DT_OR = 267,
127 DT_BITS = 268,
128 DT_DEL_PROP = 269,
129 DT_DEL_NODE = 270,
130 DT_PROPNODENAME = 271,
131 DT_LITERAL = 272,
132 DT_CHAR_LITERAL = 273,
133 DT_BASE = 274,
134 DT_BYTE = 275,
135 DT_STRING = 276,
136 DT_LABEL = 277,
137 DT_REF = 278,
138 DT_INCBIN = 279
John Bonesio658f29a2010-11-17 15:28:20 -0800139 };
140#endif
141
142
143
David Gibsona4da2e32007-12-18 15:06:42 +1100144#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
145typedef union YYSTYPE
David Gibsona4da2e32007-12-18 15:06:42 +1100146{
John Bonesio658f29a2010-11-17 15:28:20 -0800147
Grant Likely2a6a08c2013-06-13 13:00:43 +0100148/* Line 293 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +0000149#line 40 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -0800150
David Gibsona4da2e32007-12-18 15:06:42 +1100151 char *propnodename;
152 char *literal;
153 char *labelref;
154 unsigned int cbase;
David Gibsoned95d742008-08-07 12:24:17 +1000155 uint8_t byte;
David Gibsona4da2e32007-12-18 15:06:42 +1100156 struct data data;
157
Stephen Warrencd296722012-09-28 21:25:59 +0000158 struct {
159 struct data data;
160 int bits;
161 } array;
162
David Gibsona4da2e32007-12-18 15:06:42 +1100163 struct property *prop;
164 struct property *proplist;
165 struct node *node;
166 struct node *nodelist;
167 struct reserve_info *re;
Stephen Warrencd296722012-09-28 21:25:59 +0000168 uint64_t integer;
John Bonesio658f29a2010-11-17 15:28:20 -0800169
170
171
Grant Likely2a6a08c2013-06-13 13:00:43 +0100172/* Line 293 of yacc.c */
173#line 174 "dtc-parser.tab.c"
John Bonesio658f29a2010-11-17 15:28:20 -0800174} YYSTYPE;
175# define YYSTYPE_IS_TRIVIAL 1
David Gibsona4da2e32007-12-18 15:06:42 +1100176# define yystype YYSTYPE /* obsolescent; will be withdrawn */
177# define YYSTYPE_IS_DECLARED 1
David Gibsona4da2e32007-12-18 15:06:42 +1100178#endif
179
180
181/* Copy the second part of user declarations. */
182
183
Grant Likely2a6a08c2013-06-13 13:00:43 +0100184/* Line 343 of yacc.c */
185#line 186 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +1100186
187#ifdef short
188# undef short
189#endif
190
191#ifdef YYTYPE_UINT8
192typedef YYTYPE_UINT8 yytype_uint8;
193#else
194typedef unsigned char yytype_uint8;
195#endif
196
197#ifdef YYTYPE_INT8
198typedef YYTYPE_INT8 yytype_int8;
199#elif (defined __STDC__ || defined __C99__FUNC__ \
200 || defined __cplusplus || defined _MSC_VER)
201typedef signed char yytype_int8;
202#else
203typedef short int yytype_int8;
204#endif
205
206#ifdef YYTYPE_UINT16
207typedef YYTYPE_UINT16 yytype_uint16;
208#else
209typedef unsigned short int yytype_uint16;
210#endif
211
212#ifdef YYTYPE_INT16
213typedef YYTYPE_INT16 yytype_int16;
214#else
215typedef short int yytype_int16;
216#endif
217
218#ifndef YYSIZE_T
219# ifdef __SIZE_TYPE__
220# define YYSIZE_T __SIZE_TYPE__
221# elif defined size_t
222# define YYSIZE_T size_t
223# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
224 || defined __cplusplus || defined _MSC_VER)
225# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
226# define YYSIZE_T size_t
227# else
228# define YYSIZE_T unsigned int
229# endif
230#endif
231
232#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
233
234#ifndef YY_
Grant Likely2a6a08c2013-06-13 13:00:43 +0100235# if defined YYENABLE_NLS && YYENABLE_NLS
David Gibsona4da2e32007-12-18 15:06:42 +1100236# if ENABLE_NLS
237# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
238# define YY_(msgid) dgettext ("bison-runtime", msgid)
239# endif
240# endif
241# ifndef YY_
242# define YY_(msgid) msgid
243# endif
244#endif
245
246/* Suppress unused-variable warnings by "using" E. */
247#if ! defined lint || defined __GNUC__
248# define YYUSE(e) ((void) (e))
249#else
250# define YYUSE(e) /* empty */
251#endif
252
253/* Identity function, used to suppress warnings about constant conditions. */
254#ifndef lint
255# define YYID(n) (n)
256#else
257#if (defined __STDC__ || defined __C99__FUNC__ \
258 || defined __cplusplus || defined _MSC_VER)
259static int
John Bonesio658f29a2010-11-17 15:28:20 -0800260YYID (int yyi)
David Gibsona4da2e32007-12-18 15:06:42 +1100261#else
262static int
John Bonesio658f29a2010-11-17 15:28:20 -0800263YYID (yyi)
264 int yyi;
David Gibsona4da2e32007-12-18 15:06:42 +1100265#endif
266{
John Bonesio658f29a2010-11-17 15:28:20 -0800267 return yyi;
David Gibsona4da2e32007-12-18 15:06:42 +1100268}
269#endif
270
271#if ! defined yyoverflow || YYERROR_VERBOSE
272
273/* The parser invokes alloca or malloc; define the necessary symbols. */
274
275# ifdef YYSTACK_USE_ALLOCA
276# if YYSTACK_USE_ALLOCA
277# ifdef __GNUC__
278# define YYSTACK_ALLOC __builtin_alloca
279# elif defined __BUILTIN_VA_ARG_INCR
280# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
281# elif defined _AIX
282# define YYSTACK_ALLOC __alloca
283# elif defined _MSC_VER
284# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
285# define alloca _alloca
286# else
287# define YYSTACK_ALLOC alloca
Grant Likely2a6a08c2013-06-13 13:00:43 +0100288# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
David Gibsona4da2e32007-12-18 15:06:42 +1100289 || defined __cplusplus || defined _MSC_VER)
290# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Grant Likely2a6a08c2013-06-13 13:00:43 +0100291# ifndef EXIT_SUCCESS
292# define EXIT_SUCCESS 0
David Gibsona4da2e32007-12-18 15:06:42 +1100293# endif
294# endif
295# endif
296# endif
297# endif
298
299# ifdef YYSTACK_ALLOC
300 /* Pacify GCC's `empty if-body' warning. */
301# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
302# ifndef YYSTACK_ALLOC_MAXIMUM
303 /* The OS might guarantee only one guard page at the bottom of the stack,
304 and a page size can be as small as 4096 bytes. So we cannot safely
305 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
306 to allow for a few compiler-allocated temporary stack slots. */
307# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
308# endif
309# else
310# define YYSTACK_ALLOC YYMALLOC
311# define YYSTACK_FREE YYFREE
312# ifndef YYSTACK_ALLOC_MAXIMUM
313# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
314# endif
Grant Likely2a6a08c2013-06-13 13:00:43 +0100315# if (defined __cplusplus && ! defined EXIT_SUCCESS \
David Gibsona4da2e32007-12-18 15:06:42 +1100316 && ! ((defined YYMALLOC || defined malloc) \
317 && (defined YYFREE || defined free)))
318# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
Grant Likely2a6a08c2013-06-13 13:00:43 +0100319# ifndef EXIT_SUCCESS
320# define EXIT_SUCCESS 0
David Gibsona4da2e32007-12-18 15:06:42 +1100321# endif
322# endif
323# ifndef YYMALLOC
324# define YYMALLOC malloc
Grant Likely2a6a08c2013-06-13 13:00:43 +0100325# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
David Gibsona4da2e32007-12-18 15:06:42 +1100326 || defined __cplusplus || defined _MSC_VER)
327void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
328# endif
329# endif
330# ifndef YYFREE
331# define YYFREE free
Grant Likely2a6a08c2013-06-13 13:00:43 +0100332# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
David Gibsona4da2e32007-12-18 15:06:42 +1100333 || defined __cplusplus || defined _MSC_VER)
334void free (void *); /* INFRINGES ON USER NAME SPACE */
335# endif
336# endif
337# endif
338#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
339
340
341#if (! defined yyoverflow \
342 && (! defined __cplusplus \
John Bonesio658f29a2010-11-17 15:28:20 -0800343 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
David Gibsona4da2e32007-12-18 15:06:42 +1100344
345/* A type that is properly aligned for any stack member. */
346union yyalloc
347{
John Bonesio658f29a2010-11-17 15:28:20 -0800348 yytype_int16 yyss_alloc;
349 YYSTYPE yyvs_alloc;
David Gibsona4da2e32007-12-18 15:06:42 +1100350};
351
352/* The size of the maximum gap between one aligned stack and the next. */
353# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
354
355/* The size of an array large to enough to hold all stacks, each with
356 N elements. */
357# define YYSTACK_BYTES(N) \
John Bonesio658f29a2010-11-17 15:28:20 -0800358 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
359 + YYSTACK_GAP_MAXIMUM)
David Gibsona4da2e32007-12-18 15:06:42 +1100360
Grant Likely2a6a08c2013-06-13 13:00:43 +0100361# define YYCOPY_NEEDED 1
David Gibsona4da2e32007-12-18 15:06:42 +1100362
363/* Relocate STACK from its old location to the new one. The
364 local variables YYSIZE and YYSTACKSIZE give the old and new number of
365 elements in the stack, and YYPTR gives the new location of the
366 stack. Advance YYPTR to a properly aligned location for the next
367 stack. */
John Bonesio658f29a2010-11-17 15:28:20 -0800368# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
David Gibsona4da2e32007-12-18 15:06:42 +1100369 do \
370 { \
371 YYSIZE_T yynewbytes; \
John Bonesio658f29a2010-11-17 15:28:20 -0800372 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
373 Stack = &yyptr->Stack_alloc; \
David Gibsona4da2e32007-12-18 15:06:42 +1100374 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
375 yyptr += yynewbytes / sizeof (*yyptr); \
376 } \
377 while (YYID (0))
378
379#endif
380
Grant Likely2a6a08c2013-06-13 13:00:43 +0100381#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
382/* Copy COUNT objects from FROM to TO. The source and destination do
383 not overlap. */
384# ifndef YYCOPY
385# if defined __GNUC__ && 1 < __GNUC__
386# define YYCOPY(To, From, Count) \
387 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
388# else
389# define YYCOPY(To, From, Count) \
390 do \
391 { \
392 YYSIZE_T yyi; \
393 for (yyi = 0; yyi < (Count); yyi++) \
394 (To)[yyi] = (From)[yyi]; \
395 } \
396 while (YYID (0))
397# endif
398# endif
399#endif /* !YYCOPY_NEEDED */
400
David Gibsona4da2e32007-12-18 15:06:42 +1100401/* YYFINAL -- State number of the termination state. */
John Bonesio658f29a2010-11-17 15:28:20 -0800402#define YYFINAL 4
David Gibsona4da2e32007-12-18 15:06:42 +1100403/* YYLAST -- Last index in YYTABLE. */
Stephen Warrencd296722012-09-28 21:25:59 +0000404#define YYLAST 133
David Gibsona4da2e32007-12-18 15:06:42 +1100405
406/* YYNTOKENS -- Number of terminals. */
Stephen Warrencd296722012-09-28 21:25:59 +0000407#define YYNTOKENS 48
David Gibsona4da2e32007-12-18 15:06:42 +1100408/* YYNNTS -- Number of nonterminals. */
Stephen Warrencd296722012-09-28 21:25:59 +0000409#define YYNNTS 28
David Gibsona4da2e32007-12-18 15:06:42 +1100410/* YYNRULES -- Number of rules. */
Stephen Warrencd296722012-09-28 21:25:59 +0000411#define YYNRULES 79
David Gibsona4da2e32007-12-18 15:06:42 +1100412/* YYNRULES -- Number of states. */
Stephen Warrencd296722012-09-28 21:25:59 +0000413#define YYNSTATES 141
David Gibsona4da2e32007-12-18 15:06:42 +1100414
415/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
416#define YYUNDEFTOK 2
Stephen Warrencd296722012-09-28 21:25:59 +0000417#define YYMAXUTOK 279
David Gibsona4da2e32007-12-18 15:06:42 +1100418
419#define YYTRANSLATE(YYX) \
420 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
421
422/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
423static const yytype_uint8 yytranslate[] =
424{
425 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Stephen Warrencd296722012-09-28 21:25:59 +0000428 2, 2, 2, 47, 2, 2, 2, 45, 41, 2,
429 33, 35, 44, 42, 34, 43, 2, 26, 2, 2,
430 2, 2, 2, 2, 2, 2, 2, 2, 38, 25,
431 36, 29, 30, 37, 2, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Stephen Warrencd296722012-09-28 21:25:59 +0000434 2, 31, 2, 32, 40, 2, 2, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100435 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
Stephen Warrencd296722012-09-28 21:25:59 +0000437 2, 2, 2, 27, 39, 28, 46, 2, 2, 2,
David Gibsona4da2e32007-12-18 15:06:42 +1100438 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, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
Stephen Warrencd296722012-09-28 21:25:59 +0000451 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
452 15, 16, 17, 18, 19, 20, 21, 22, 23, 24
David Gibsona4da2e32007-12-18 15:06:42 +1100453};
454
455#if YYDEBUG
456/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
457 YYRHS. */
Stephen Warrencd296722012-09-28 21:25:59 +0000458static const yytype_uint16 yyprhs[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100459{
Stephen Warrencd296722012-09-28 21:25:59 +0000460 0, 0, 3, 8, 9, 12, 17, 20, 23, 27,
461 31, 36, 42, 43, 46, 51, 54, 58, 61, 64,
462 68, 73, 76, 86, 92, 95, 96, 99, 102, 106,
463 108, 111, 114, 117, 119, 121, 125, 127, 129, 135,
464 137, 141, 143, 147, 149, 153, 155, 159, 161, 165,
465 167, 171, 175, 177, 181, 185, 189, 193, 197, 201,
466 203, 207, 211, 213, 217, 221, 225, 227, 229, 232,
467 235, 238, 239, 242, 245, 246, 249, 252, 255, 259
David Gibsona4da2e32007-12-18 15:06:42 +1100468};
469
470/* YYRHS -- A `-1'-separated list of the rules' RHS. */
471static const yytype_int8 yyrhs[] =
472{
Stephen Warrencd296722012-09-28 21:25:59 +0000473 49, 0, -1, 3, 25, 50, 52, -1, -1, 51,
474 50, -1, 4, 59, 59, 25, -1, 22, 51, -1,
475 26, 53, -1, 52, 26, 53, -1, 52, 23, 53,
476 -1, 52, 15, 23, 25, -1, 27, 54, 74, 28,
477 25, -1, -1, 54, 55, -1, 16, 29, 56, 25,
478 -1, 16, 25, -1, 14, 16, 25, -1, 22, 55,
479 -1, 57, 21, -1, 57, 58, 30, -1, 57, 31,
480 73, 32, -1, 57, 23, -1, 57, 24, 33, 21,
481 34, 59, 34, 59, 35, -1, 57, 24, 33, 21,
482 35, -1, 56, 22, -1, -1, 56, 34, -1, 57,
483 22, -1, 13, 17, 36, -1, 36, -1, 58, 59,
484 -1, 58, 23, -1, 58, 22, -1, 17, -1, 18,
485 -1, 33, 60, 35, -1, 61, -1, 62, -1, 62,
486 37, 60, 38, 61, -1, 63, -1, 62, 12, 63,
487 -1, 64, -1, 63, 11, 64, -1, 65, -1, 64,
488 39, 65, -1, 66, -1, 65, 40, 66, -1, 67,
489 -1, 66, 41, 67, -1, 68, -1, 67, 9, 68,
490 -1, 67, 10, 68, -1, 69, -1, 68, 36, 69,
491 -1, 68, 30, 69, -1, 68, 7, 69, -1, 68,
492 8, 69, -1, 69, 5, 70, -1, 69, 6, 70,
493 -1, 70, -1, 70, 42, 71, -1, 70, 43, 71,
494 -1, 71, -1, 71, 44, 72, -1, 71, 26, 72,
495 -1, 71, 45, 72, -1, 72, -1, 59, -1, 43,
496 72, -1, 46, 72, -1, 47, 72, -1, -1, 73,
497 20, -1, 73, 22, -1, -1, 75, 74, -1, 75,
498 55, -1, 16, 53, -1, 15, 16, 25, -1, 22,
499 75, -1
David Gibsona4da2e32007-12-18 15:06:42 +1100500};
501
502/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
503static const yytype_uint16 yyrline[] =
504{
Stephen Warrencd296722012-09-28 21:25:59 +0000505 0, 109, 109, 118, 121, 128, 132, 140, 144, 148,
506 158, 172, 180, 183, 190, 194, 198, 202, 210, 214,
507 218, 222, 226, 243, 253, 261, 264, 268, 275, 290,
508 295, 315, 329, 336, 340, 344, 351, 355, 356, 360,
509 361, 365, 366, 370, 371, 375, 376, 380, 381, 385,
510 386, 387, 391, 392, 393, 394, 395, 399, 400, 401,
511 405, 406, 407, 411, 412, 413, 414, 418, 419, 420,
512 421, 426, 429, 433, 441, 444, 448, 456, 460, 464
David Gibsona4da2e32007-12-18 15:06:42 +1100513};
514#endif
515
516#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
517/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
518 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
519static const char *const yytname[] =
520{
Stephen Warrencd296722012-09-28 21:25:59 +0000521 "$end", "error", "$undefined", "DT_V1", "DT_MEMRESERVE", "DT_LSHIFT",
522 "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ", "DT_NE", "DT_AND", "DT_OR",
523 "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE", "DT_PROPNODENAME", "DT_LITERAL",
524 "DT_CHAR_LITERAL", "DT_BASE", "DT_BYTE", "DT_STRING", "DT_LABEL",
525 "DT_REF", "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['",
526 "']'", "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'",
527 "'+'", "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile",
528 "memreserves", "memreserve", "devicetree", "nodedef", "proplist",
529 "propdef", "propdata", "propdataprefix", "arrayprefix", "integer_prim",
530 "integer_expr", "integer_trinary", "integer_or", "integer_and",
531 "integer_bitor", "integer_bitxor", "integer_bitand", "integer_eq",
532 "integer_rela", "integer_shift", "integer_add", "integer_mul",
533 "integer_unary", "bytestring", "subnodes", "subnode", 0
David Gibsona4da2e32007-12-18 15:06:42 +1100534};
535#endif
536
537# ifdef YYPRINT
538/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
539 token YYLEX-NUM. */
540static const yytype_uint16 yytoknum[] =
541{
542 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
Stephen Warrencd296722012-09-28 21:25:59 +0000543 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
544 275, 276, 277, 278, 279, 59, 47, 123, 125, 61,
545 62, 91, 93, 40, 44, 41, 60, 63, 58, 124,
546 94, 38, 43, 45, 42, 37, 126, 33
David Gibsona4da2e32007-12-18 15:06:42 +1100547};
548# endif
549
550/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
551static const yytype_uint8 yyr1[] =
552{
Stephen Warrencd296722012-09-28 21:25:59 +0000553 0, 48, 49, 50, 50, 51, 51, 52, 52, 52,
554 52, 53, 54, 54, 55, 55, 55, 55, 56, 56,
555 56, 56, 56, 56, 56, 57, 57, 57, 58, 58,
556 58, 58, 58, 59, 59, 59, 60, 61, 61, 62,
557 62, 63, 63, 64, 64, 65, 65, 66, 66, 67,
558 67, 67, 68, 68, 68, 68, 68, 69, 69, 69,
559 70, 70, 70, 71, 71, 71, 71, 72, 72, 72,
560 72, 73, 73, 73, 74, 74, 74, 75, 75, 75
David Gibsona4da2e32007-12-18 15:06:42 +1100561};
562
563/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
564static const yytype_uint8 yyr2[] =
565{
Stephen Warrencd296722012-09-28 21:25:59 +0000566 0, 2, 4, 0, 2, 4, 2, 2, 3, 3,
567 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
568 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
569 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
570 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
571 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
572 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
573 2, 0, 2, 2, 0, 2, 2, 2, 3, 2
David Gibsona4da2e32007-12-18 15:06:42 +1100574};
575
Grant Likely2a6a08c2013-06-13 13:00:43 +0100576/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
577 Performed when YYTABLE doesn't specify something else to do. Zero
David Gibsona4da2e32007-12-18 15:06:42 +1100578 means the default is an error. */
579static const yytype_uint8 yydefact[] =
580{
Stephen Warrencd296722012-09-28 21:25:59 +0000581 0, 0, 0, 3, 1, 0, 0, 0, 3, 33,
582 34, 0, 0, 6, 0, 2, 4, 0, 0, 0,
583 67, 0, 36, 37, 39, 41, 43, 45, 47, 49,
584 52, 59, 62, 66, 0, 12, 7, 0, 0, 0,
585 68, 69, 70, 35, 0, 0, 0, 0, 0, 0,
586 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
587 0, 0, 0, 5, 74, 0, 9, 8, 40, 0,
588 42, 44, 46, 48, 50, 51, 55, 56, 54, 53,
589 57, 58, 60, 61, 64, 63, 65, 0, 0, 0,
590 0, 13, 0, 74, 10, 0, 0, 0, 15, 25,
591 77, 17, 79, 0, 76, 75, 38, 16, 78, 0,
592 0, 11, 24, 14, 26, 0, 18, 27, 21, 0,
593 71, 29, 0, 0, 0, 0, 32, 31, 19, 30,
594 28, 0, 72, 73, 20, 0, 23, 0, 0, 0,
595 22
David Gibsona4da2e32007-12-18 15:06:42 +1100596};
597
598/* YYDEFGOTO[NTERM-NUM]. */
599static const yytype_int8 yydefgoto[] =
600{
Stephen Warrencd296722012-09-28 21:25:59 +0000601 -1, 2, 7, 8, 15, 36, 64, 91, 109, 110,
602 122, 20, 21, 22, 23, 24, 25, 26, 27, 28,
603 29, 30, 31, 32, 33, 125, 92, 93
David Gibsona4da2e32007-12-18 15:06:42 +1100604};
605
606/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
607 STATE-NUM. */
Stephen Warrencd296722012-09-28 21:25:59 +0000608#define YYPACT_NINF -78
David Gibsona4da2e32007-12-18 15:06:42 +1100609static const yytype_int8 yypact[] =
610{
Stephen Warrencd296722012-09-28 21:25:59 +0000611 22, 11, 51, 10, -78, 23, 10, 2, 10, -78,
612 -78, -9, 23, -78, 30, 38, -78, -9, -9, -9,
613 -78, 35, -78, -6, 52, 29, 48, 49, 33, 3,
614 71, 36, 0, -78, 64, -78, -78, 68, 30, 30,
615 -78, -78, -78, -78, -9, -9, -9, -9, -9, -9,
616 -9, -9, -9, -9, -9, -9, -9, -9, -9, -9,
617 -9, -9, -9, -78, 44, 67, -78, -78, 52, 55,
618 29, 48, 49, 33, 3, 3, 71, 71, 71, 71,
619 36, 36, 0, 0, -78, -78, -78, 78, 79, 42,
620 44, -78, 69, 44, -78, -9, 73, 74, -78, -78,
621 -78, -78, -78, 75, -78, -78, -78, -78, -78, -7,
622 -1, -78, -78, -78, -78, 84, -78, -78, -78, 63,
623 -78, -78, 32, 66, 82, -3, -78, -78, -78, -78,
624 -78, 46, -78, -78, -78, 23, -78, 70, 23, 72,
625 -78
David Gibsona4da2e32007-12-18 15:06:42 +1100626};
627
628/* YYPGOTO[NTERM-NUM]. */
629static const yytype_int8 yypgoto[] =
630{
Stephen Warrencd296722012-09-28 21:25:59 +0000631 -78, -78, 97, 100, -78, -37, -78, -77, -78, -78,
632 -78, -5, 65, 13, -78, 76, 77, 62, 80, 83,
633 34, 20, 26, 28, -14, -78, 18, 24
David Gibsona4da2e32007-12-18 15:06:42 +1100634};
635
636/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
637 positive, shift that token. If negative, reduce the rule which
Grant Likely2a6a08c2013-06-13 13:00:43 +0100638 number is the opposite. If YYTABLE_NINF, syntax error. */
John Bonesio658f29a2010-11-17 15:28:20 -0800639#define YYTABLE_NINF -1
640static const yytype_uint8 yytable[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100641{
Stephen Warrencd296722012-09-28 21:25:59 +0000642 12, 66, 67, 40, 41, 42, 44, 34, 9, 10,
643 52, 53, 115, 101, 5, 112, 104, 132, 113, 133,
644 116, 117, 118, 119, 11, 1, 60, 114, 14, 134,
645 120, 45, 6, 54, 17, 121, 3, 18, 19, 55,
646 9, 10, 50, 51, 61, 62, 84, 85, 86, 9,
647 10, 4, 100, 37, 126, 127, 11, 35, 87, 88,
648 89, 38, 128, 46, 39, 11, 90, 98, 47, 35,
649 43, 99, 76, 77, 78, 79, 56, 57, 58, 59,
650 135, 136, 80, 81, 74, 75, 82, 83, 48, 63,
651 49, 65, 94, 95, 96, 97, 124, 103, 107, 108,
652 111, 123, 130, 131, 138, 16, 13, 140, 106, 71,
653 69, 105, 0, 0, 102, 0, 0, 129, 0, 0,
654 68, 0, 0, 70, 0, 0, 0, 0, 72, 0,
655 137, 0, 73, 139
David Gibsona4da2e32007-12-18 15:06:42 +1100656};
657
Grant Likely2a6a08c2013-06-13 13:00:43 +0100658#define yypact_value_is_default(yystate) \
659 ((yystate) == (-78))
660
661#define yytable_value_is_error(yytable_value) \
662 YYID (0)
663
Stephen Warrencd296722012-09-28 21:25:59 +0000664static const yytype_int16 yycheck[] =
David Gibsona4da2e32007-12-18 15:06:42 +1100665{
Stephen Warrencd296722012-09-28 21:25:59 +0000666 5, 38, 39, 17, 18, 19, 12, 12, 17, 18,
667 7, 8, 13, 90, 4, 22, 93, 20, 25, 22,
668 21, 22, 23, 24, 33, 3, 26, 34, 26, 32,
669 31, 37, 22, 30, 43, 36, 25, 46, 47, 36,
670 17, 18, 9, 10, 44, 45, 60, 61, 62, 17,
671 18, 0, 89, 15, 22, 23, 33, 27, 14, 15,
672 16, 23, 30, 11, 26, 33, 22, 25, 39, 27,
673 35, 29, 52, 53, 54, 55, 5, 6, 42, 43,
674 34, 35, 56, 57, 50, 51, 58, 59, 40, 25,
675 41, 23, 25, 38, 16, 16, 33, 28, 25, 25,
676 25, 17, 36, 21, 34, 8, 6, 35, 95, 47,
677 45, 93, -1, -1, 90, -1, -1, 122, -1, -1,
678 44, -1, -1, 46, -1, -1, -1, -1, 48, -1,
679 135, -1, 49, 138
David Gibsona4da2e32007-12-18 15:06:42 +1100680};
681
682/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
683 symbol of state STATE-NUM. */
684static const yytype_uint8 yystos[] =
685{
Stephen Warrencd296722012-09-28 21:25:59 +0000686 0, 3, 49, 25, 0, 4, 22, 50, 51, 17,
687 18, 33, 59, 51, 26, 52, 50, 43, 46, 47,
688 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
689 69, 70, 71, 72, 59, 27, 53, 15, 23, 26,
690 72, 72, 72, 35, 12, 37, 11, 39, 40, 41,
691 9, 10, 7, 8, 30, 36, 5, 6, 42, 43,
692 26, 44, 45, 25, 54, 23, 53, 53, 63, 60,
693 64, 65, 66, 67, 68, 68, 69, 69, 69, 69,
694 70, 70, 71, 71, 72, 72, 72, 14, 15, 16,
695 22, 55, 74, 75, 25, 38, 16, 16, 25, 29,
696 53, 55, 75, 28, 55, 74, 61, 25, 25, 56,
697 57, 25, 22, 25, 34, 13, 21, 22, 23, 24,
698 31, 36, 58, 17, 33, 73, 22, 23, 30, 59,
699 36, 21, 20, 22, 32, 34, 35, 59, 34, 59,
700 35
David Gibsona4da2e32007-12-18 15:06:42 +1100701};
702
703#define yyerrok (yyerrstatus = 0)
704#define yyclearin (yychar = YYEMPTY)
705#define YYEMPTY (-2)
706#define YYEOF 0
707
708#define YYACCEPT goto yyacceptlab
709#define YYABORT goto yyabortlab
710#define YYERROR goto yyerrorlab
711
712
713/* Like YYERROR except do call yyerror. This remains here temporarily
714 to ease the transition to the new meaning of YYERROR, for GCC.
Grant Likely2a6a08c2013-06-13 13:00:43 +0100715 Once GCC version 2 has supplanted version 1, this can go. However,
716 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
717 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
718 discussed. */
David Gibsona4da2e32007-12-18 15:06:42 +1100719
720#define YYFAIL goto yyerrlab
Grant Likely2a6a08c2013-06-13 13:00:43 +0100721#if defined YYFAIL
722 /* This is here to suppress warnings from the GCC cpp's
723 -Wunused-macros. Normally we don't worry about that warning, but
724 some users do, and we want to make it easy for users to remove
725 YYFAIL uses, which will produce warnings from Bison 2.5. */
726#endif
David Gibsona4da2e32007-12-18 15:06:42 +1100727
728#define YYRECOVERING() (!!yyerrstatus)
729
730#define YYBACKUP(Token, Value) \
731do \
732 if (yychar == YYEMPTY && yylen == 1) \
733 { \
734 yychar = (Token); \
735 yylval = (Value); \
David Gibsona4da2e32007-12-18 15:06:42 +1100736 YYPOPSTACK (1); \
737 goto yybackup; \
738 } \
739 else \
740 { \
741 yyerror (YY_("syntax error: cannot back up")); \
742 YYERROR; \
743 } \
744while (YYID (0))
745
746
747#define YYTERROR 1
748#define YYERRCODE 256
749
750
751/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
752 If N is 0, then set CURRENT to the empty location which ends
753 the previous symbol: RHS[0] (always defined). */
754
755#define YYRHSLOC(Rhs, K) ((Rhs)[K])
756#ifndef YYLLOC_DEFAULT
757# define YYLLOC_DEFAULT(Current, Rhs, N) \
758 do \
759 if (YYID (N)) \
760 { \
761 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
762 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
763 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
764 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
765 } \
766 else \
767 { \
768 (Current).first_line = (Current).last_line = \
769 YYRHSLOC (Rhs, 0).last_line; \
770 (Current).first_column = (Current).last_column = \
771 YYRHSLOC (Rhs, 0).last_column; \
772 } \
773 while (YYID (0))
774#endif
775
776
Grant Likely2a6a08c2013-06-13 13:00:43 +0100777/* This macro is provided for backward compatibility. */
David Gibsona4da2e32007-12-18 15:06:42 +1100778
779#ifndef YY_LOCATION_PRINT
Grant Likely2a6a08c2013-06-13 13:00:43 +0100780# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
David Gibsona4da2e32007-12-18 15:06:42 +1100781#endif
782
783
784/* YYLEX -- calling `yylex' with the right arguments. */
785
786#ifdef YYLEX_PARAM
787# define YYLEX yylex (YYLEX_PARAM)
788#else
789# define YYLEX yylex ()
790#endif
791
792/* Enable debugging if requested. */
793#if YYDEBUG
794
795# ifndef YYFPRINTF
796# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
797# define YYFPRINTF fprintf
798# endif
799
800# define YYDPRINTF(Args) \
801do { \
802 if (yydebug) \
803 YYFPRINTF Args; \
804} while (YYID (0))
805
806# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
807do { \
808 if (yydebug) \
809 { \
810 YYFPRINTF (stderr, "%s ", Title); \
811 yy_symbol_print (stderr, \
John Bonesio658f29a2010-11-17 15:28:20 -0800812 Type, Value); \
David Gibsona4da2e32007-12-18 15:06:42 +1100813 YYFPRINTF (stderr, "\n"); \
814 } \
815} while (YYID (0))
816
817
818/*--------------------------------.
819| Print this symbol on YYOUTPUT. |
820`--------------------------------*/
821
822/*ARGSUSED*/
823#if (defined __STDC__ || defined __C99__FUNC__ \
824 || defined __cplusplus || defined _MSC_VER)
825static void
John Bonesio658f29a2010-11-17 15:28:20 -0800826yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100827#else
828static void
John Bonesio658f29a2010-11-17 15:28:20 -0800829yy_symbol_value_print (yyoutput, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100830 FILE *yyoutput;
831 int yytype;
832 YYSTYPE const * const yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +1100833#endif
834{
835 if (!yyvaluep)
836 return;
David Gibsona4da2e32007-12-18 15:06:42 +1100837# ifdef YYPRINT
838 if (yytype < YYNTOKENS)
839 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
840# else
841 YYUSE (yyoutput);
842# endif
843 switch (yytype)
844 {
845 default:
846 break;
847 }
848}
849
850
851/*--------------------------------.
852| Print this symbol on YYOUTPUT. |
853`--------------------------------*/
854
855#if (defined __STDC__ || defined __C99__FUNC__ \
856 || defined __cplusplus || defined _MSC_VER)
857static void
John Bonesio658f29a2010-11-17 15:28:20 -0800858yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100859#else
860static void
John Bonesio658f29a2010-11-17 15:28:20 -0800861yy_symbol_print (yyoutput, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +1100862 FILE *yyoutput;
863 int yytype;
864 YYSTYPE const * const yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +1100865#endif
866{
867 if (yytype < YYNTOKENS)
868 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
869 else
870 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
871
John Bonesio658f29a2010-11-17 15:28:20 -0800872 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
David Gibsona4da2e32007-12-18 15:06:42 +1100873 YYFPRINTF (yyoutput, ")");
874}
875
876/*------------------------------------------------------------------.
877| yy_stack_print -- Print the state stack from its BOTTOM up to its |
878| TOP (included). |
879`------------------------------------------------------------------*/
880
881#if (defined __STDC__ || defined __C99__FUNC__ \
882 || defined __cplusplus || defined _MSC_VER)
883static void
John Bonesio658f29a2010-11-17 15:28:20 -0800884yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
David Gibsona4da2e32007-12-18 15:06:42 +1100885#else
886static void
John Bonesio658f29a2010-11-17 15:28:20 -0800887yy_stack_print (yybottom, yytop)
888 yytype_int16 *yybottom;
889 yytype_int16 *yytop;
David Gibsona4da2e32007-12-18 15:06:42 +1100890#endif
891{
892 YYFPRINTF (stderr, "Stack now");
John Bonesio658f29a2010-11-17 15:28:20 -0800893 for (; yybottom <= yytop; yybottom++)
894 {
895 int yybot = *yybottom;
896 YYFPRINTF (stderr, " %d", yybot);
897 }
David Gibsona4da2e32007-12-18 15:06:42 +1100898 YYFPRINTF (stderr, "\n");
899}
900
901# define YY_STACK_PRINT(Bottom, Top) \
902do { \
903 if (yydebug) \
904 yy_stack_print ((Bottom), (Top)); \
905} while (YYID (0))
906
907
908/*------------------------------------------------.
909| Report that the YYRULE is going to be reduced. |
910`------------------------------------------------*/
911
912#if (defined __STDC__ || defined __C99__FUNC__ \
913 || defined __cplusplus || defined _MSC_VER)
914static void
John Bonesio658f29a2010-11-17 15:28:20 -0800915yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
David Gibsona4da2e32007-12-18 15:06:42 +1100916#else
917static void
John Bonesio658f29a2010-11-17 15:28:20 -0800918yy_reduce_print (yyvsp, yyrule)
David Gibsona4da2e32007-12-18 15:06:42 +1100919 YYSTYPE *yyvsp;
David Gibsona4da2e32007-12-18 15:06:42 +1100920 int yyrule;
921#endif
922{
923 int yynrhs = yyr2[yyrule];
924 int yyi;
925 unsigned long int yylno = yyrline[yyrule];
926 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
927 yyrule - 1, yylno);
928 /* The symbols being reduced. */
929 for (yyi = 0; yyi < yynrhs; yyi++)
930 {
John Bonesio658f29a2010-11-17 15:28:20 -0800931 YYFPRINTF (stderr, " $%d = ", yyi + 1);
David Gibsona4da2e32007-12-18 15:06:42 +1100932 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
933 &(yyvsp[(yyi + 1) - (yynrhs)])
John Bonesio658f29a2010-11-17 15:28:20 -0800934 );
935 YYFPRINTF (stderr, "\n");
David Gibsona4da2e32007-12-18 15:06:42 +1100936 }
937}
938
939# define YY_REDUCE_PRINT(Rule) \
940do { \
941 if (yydebug) \
John Bonesio658f29a2010-11-17 15:28:20 -0800942 yy_reduce_print (yyvsp, Rule); \
David Gibsona4da2e32007-12-18 15:06:42 +1100943} while (YYID (0))
944
945/* Nonzero means print parse trace. It is left uninitialized so that
946 multiple parsers can coexist. */
947int yydebug;
948#else /* !YYDEBUG */
949# define YYDPRINTF(Args)
950# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
951# define YY_STACK_PRINT(Bottom, Top)
952# define YY_REDUCE_PRINT(Rule)
953#endif /* !YYDEBUG */
954
955
956/* YYINITDEPTH -- initial size of the parser's stacks. */
957#ifndef YYINITDEPTH
958# define YYINITDEPTH 200
959#endif
960
961/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
962 if the built-in stack extension method is used).
963
964 Do not make this value too large; the results are undefined if
965 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
966 evaluated with infinite-precision integer arithmetic. */
967
968#ifndef YYMAXDEPTH
969# define YYMAXDEPTH 10000
970#endif
971
David Gibsona4da2e32007-12-18 15:06:42 +1100972
973#if YYERROR_VERBOSE
974
975# ifndef yystrlen
976# if defined __GLIBC__ && defined _STRING_H
977# define yystrlen strlen
978# else
979/* Return the length of YYSTR. */
980#if (defined __STDC__ || defined __C99__FUNC__ \
981 || defined __cplusplus || defined _MSC_VER)
982static YYSIZE_T
983yystrlen (const char *yystr)
984#else
985static YYSIZE_T
986yystrlen (yystr)
987 const char *yystr;
988#endif
989{
990 YYSIZE_T yylen;
991 for (yylen = 0; yystr[yylen]; yylen++)
992 continue;
993 return yylen;
994}
995# endif
996# endif
997
998# ifndef yystpcpy
999# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1000# define yystpcpy stpcpy
1001# else
1002/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1003 YYDEST. */
1004#if (defined __STDC__ || defined __C99__FUNC__ \
1005 || defined __cplusplus || defined _MSC_VER)
1006static char *
1007yystpcpy (char *yydest, const char *yysrc)
1008#else
1009static char *
1010yystpcpy (yydest, yysrc)
1011 char *yydest;
1012 const char *yysrc;
1013#endif
1014{
1015 char *yyd = yydest;
1016 const char *yys = yysrc;
1017
1018 while ((*yyd++ = *yys++) != '\0')
1019 continue;
1020
1021 return yyd - 1;
1022}
1023# endif
1024# endif
1025
1026# ifndef yytnamerr
1027/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1028 quotes and backslashes, so that it's suitable for yyerror. The
1029 heuristic is that double-quoting is unnecessary unless the string
1030 contains an apostrophe, a comma, or backslash (other than
1031 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1032 null, do not copy; instead, return the length of what the result
1033 would have been. */
1034static YYSIZE_T
1035yytnamerr (char *yyres, const char *yystr)
1036{
1037 if (*yystr == '"')
1038 {
1039 YYSIZE_T yyn = 0;
1040 char const *yyp = yystr;
1041
1042 for (;;)
1043 switch (*++yyp)
1044 {
1045 case '\'':
1046 case ',':
1047 goto do_not_strip_quotes;
1048
1049 case '\\':
1050 if (*++yyp != '\\')
1051 goto do_not_strip_quotes;
1052 /* Fall through. */
1053 default:
1054 if (yyres)
1055 yyres[yyn] = *yyp;
1056 yyn++;
1057 break;
1058
1059 case '"':
1060 if (yyres)
1061 yyres[yyn] = '\0';
1062 return yyn;
1063 }
1064 do_not_strip_quotes: ;
1065 }
1066
1067 if (! yyres)
1068 return yystrlen (yystr);
1069
1070 return yystpcpy (yyres, yystr) - yyres;
1071}
1072# endif
1073
Grant Likely2a6a08c2013-06-13 13:00:43 +01001074/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1075 about the unexpected token YYTOKEN for the state stack whose top is
1076 YYSSP.
1077
1078 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1079 not large enough to hold the message. In that case, also set
1080 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1081 required number of bytes is too large to store. */
1082static int
1083yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1084 yytype_int16 *yyssp, int yytoken)
David Gibsona4da2e32007-12-18 15:06:42 +11001085{
Grant Likely2a6a08c2013-06-13 13:00:43 +01001086 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
1087 YYSIZE_T yysize = yysize0;
1088 YYSIZE_T yysize1;
1089 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1090 /* Internationalized format string. */
1091 const char *yyformat = 0;
1092 /* Arguments of yyformat. */
1093 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1094 /* Number of reported tokens (one for the "unexpected", one per
1095 "expected"). */
1096 int yycount = 0;
David Gibsona4da2e32007-12-18 15:06:42 +11001097
Grant Likely2a6a08c2013-06-13 13:00:43 +01001098 /* There are many possibilities here to consider:
1099 - Assume YYFAIL is not used. It's too flawed to consider. See
1100 <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
1101 for details. YYERROR is fine as it does not invoke this
1102 function.
1103 - If this state is a consistent state with a default action, then
1104 the only way this function was invoked is if the default action
1105 is an error action. In that case, don't check for expected
1106 tokens because there are none.
1107 - The only way there can be no lookahead present (in yychar) is if
1108 this state is a consistent state with a default action. Thus,
1109 detecting the absence of a lookahead is sufficient to determine
1110 that there is no unexpected or expected token to report. In that
1111 case, just report a simple "syntax error".
1112 - Don't assume there isn't a lookahead just because this state is a
1113 consistent state with a default action. There might have been a
1114 previous inconsistent state, consistent state with a non-default
1115 action, or user semantic action that manipulated yychar.
1116 - Of course, the expected token list depends on states to have
1117 correct lookahead information, and it depends on the parser not
1118 to perform extra reductions after fetching a lookahead from the
1119 scanner and before detecting a syntax error. Thus, state merging
1120 (from LALR or IELR) and default reductions corrupt the expected
1121 token list. However, the list is correct for canonical LR with
1122 one exception: it will still contain any token that will not be
1123 accepted due to an error action in a later state.
1124 */
1125 if (yytoken != YYEMPTY)
David Gibsona4da2e32007-12-18 15:06:42 +11001126 {
Grant Likely2a6a08c2013-06-13 13:00:43 +01001127 int yyn = yypact[*yyssp];
1128 yyarg[yycount++] = yytname[yytoken];
1129 if (!yypact_value_is_default (yyn))
1130 {
1131 /* Start YYX at -YYN if negative to avoid negative indexes in
1132 YYCHECK. In other words, skip the first -YYN actions for
1133 this state because they are default actions. */
1134 int yyxbegin = yyn < 0 ? -yyn : 0;
1135 /* Stay within bounds of both yycheck and yytname. */
1136 int yychecklim = YYLAST - yyn + 1;
1137 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1138 int yyx;
David Gibsona4da2e32007-12-18 15:06:42 +11001139
Grant Likely2a6a08c2013-06-13 13:00:43 +01001140 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1141 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1142 && !yytable_value_is_error (yytable[yyx + yyn]))
1143 {
1144 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1145 {
1146 yycount = 1;
1147 yysize = yysize0;
1148 break;
1149 }
1150 yyarg[yycount++] = yytname[yyx];
1151 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1152 if (! (yysize <= yysize1
1153 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1154 return 2;
1155 yysize = yysize1;
1156 }
1157 }
David Gibsona4da2e32007-12-18 15:06:42 +11001158 }
Grant Likely2a6a08c2013-06-13 13:00:43 +01001159
1160 switch (yycount)
1161 {
1162# define YYCASE_(N, S) \
1163 case N: \
1164 yyformat = S; \
1165 break
1166 YYCASE_(0, YY_("syntax error"));
1167 YYCASE_(1, YY_("syntax error, unexpected %s"));
1168 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1169 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1170 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1171 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1172# undef YYCASE_
1173 }
1174
1175 yysize1 = yysize + yystrlen (yyformat);
1176 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1177 return 2;
1178 yysize = yysize1;
1179
1180 if (*yymsg_alloc < yysize)
1181 {
1182 *yymsg_alloc = 2 * yysize;
1183 if (! (yysize <= *yymsg_alloc
1184 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1185 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1186 return 1;
1187 }
1188
1189 /* Avoid sprintf, as that infringes on the user's name space.
1190 Don't have undefined behavior even if the translation
1191 produced a string with the wrong number of "%s"s. */
1192 {
1193 char *yyp = *yymsg;
1194 int yyi = 0;
1195 while ((*yyp = *yyformat) != '\0')
1196 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1197 {
1198 yyp += yytnamerr (yyp, yyarg[yyi++]);
1199 yyformat += 2;
1200 }
1201 else
1202 {
1203 yyp++;
1204 yyformat++;
1205 }
1206 }
1207 return 0;
David Gibsona4da2e32007-12-18 15:06:42 +11001208}
1209#endif /* YYERROR_VERBOSE */
David Gibsona4da2e32007-12-18 15:06:42 +11001210
1211/*-----------------------------------------------.
1212| Release the memory associated to this symbol. |
1213`-----------------------------------------------*/
1214
1215/*ARGSUSED*/
1216#if (defined __STDC__ || defined __C99__FUNC__ \
1217 || defined __cplusplus || defined _MSC_VER)
1218static void
John Bonesio658f29a2010-11-17 15:28:20 -08001219yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +11001220#else
1221static void
John Bonesio658f29a2010-11-17 15:28:20 -08001222yydestruct (yymsg, yytype, yyvaluep)
David Gibsona4da2e32007-12-18 15:06:42 +11001223 const char *yymsg;
1224 int yytype;
1225 YYSTYPE *yyvaluep;
David Gibsona4da2e32007-12-18 15:06:42 +11001226#endif
1227{
1228 YYUSE (yyvaluep);
David Gibsona4da2e32007-12-18 15:06:42 +11001229
1230 if (!yymsg)
1231 yymsg = "Deleting";
1232 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1233
1234 switch (yytype)
1235 {
1236
1237 default:
1238 break;
1239 }
1240}
David Gibsona4da2e32007-12-18 15:06:42 +11001241
Grant Likely2a6a08c2013-06-13 13:00:43 +01001242
David Gibsona4da2e32007-12-18 15:06:42 +11001243/* Prevent warnings from -Wmissing-prototypes. */
David Gibsona4da2e32007-12-18 15:06:42 +11001244#ifdef YYPARSE_PARAM
1245#if defined __STDC__ || defined __cplusplus
1246int yyparse (void *YYPARSE_PARAM);
1247#else
1248int yyparse ();
1249#endif
1250#else /* ! YYPARSE_PARAM */
1251#if defined __STDC__ || defined __cplusplus
1252int yyparse (void);
1253#else
1254int yyparse ();
1255#endif
1256#endif /* ! YYPARSE_PARAM */
1257
1258
John Bonesio658f29a2010-11-17 15:28:20 -08001259/* The lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001260int yychar;
1261
John Bonesio658f29a2010-11-17 15:28:20 -08001262/* The semantic value of the lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001263YYSTYPE yylval;
1264
1265/* Number of syntax errors so far. */
1266int yynerrs;
David Gibsona4da2e32007-12-18 15:06:42 +11001267
1268
Grant Likely2a6a08c2013-06-13 13:00:43 +01001269/*----------.
1270| yyparse. |
1271`----------*/
David Gibsona4da2e32007-12-18 15:06:42 +11001272
1273#ifdef YYPARSE_PARAM
1274#if (defined __STDC__ || defined __C99__FUNC__ \
1275 || defined __cplusplus || defined _MSC_VER)
1276int
1277yyparse (void *YYPARSE_PARAM)
1278#else
1279int
1280yyparse (YYPARSE_PARAM)
1281 void *YYPARSE_PARAM;
1282#endif
1283#else /* ! YYPARSE_PARAM */
1284#if (defined __STDC__ || defined __C99__FUNC__ \
1285 || defined __cplusplus || defined _MSC_VER)
1286int
1287yyparse (void)
1288#else
1289int
1290yyparse ()
1291
1292#endif
1293#endif
1294{
John Bonesio658f29a2010-11-17 15:28:20 -08001295 int yystate;
1296 /* Number of tokens to shift before error messages enabled. */
1297 int yyerrstatus;
1298
1299 /* The stacks and their tools:
1300 `yyss': related to states.
1301 `yyvs': related to semantic values.
1302
1303 Refer to the stacks thru separate pointers, to allow yyoverflow
1304 to reallocate them elsewhere. */
1305
1306 /* The state stack. */
1307 yytype_int16 yyssa[YYINITDEPTH];
1308 yytype_int16 *yyss;
1309 yytype_int16 *yyssp;
1310
1311 /* The semantic value stack. */
1312 YYSTYPE yyvsa[YYINITDEPTH];
1313 YYSTYPE *yyvs;
1314 YYSTYPE *yyvsp;
1315
1316 YYSIZE_T yystacksize;
1317
David Gibsona4da2e32007-12-18 15:06:42 +11001318 int yyn;
1319 int yyresult;
John Bonesio658f29a2010-11-17 15:28:20 -08001320 /* Lookahead token as an internal (translated) token number. */
1321 int yytoken;
1322 /* The variables used to return semantic value and location from the
1323 action routines. */
1324 YYSTYPE yyval;
1325
David Gibsona4da2e32007-12-18 15:06:42 +11001326#if YYERROR_VERBOSE
1327 /* Buffer for error messages, and its allocated size. */
1328 char yymsgbuf[128];
1329 char *yymsg = yymsgbuf;
1330 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1331#endif
1332
John Bonesio658f29a2010-11-17 15:28:20 -08001333#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
David Gibsona4da2e32007-12-18 15:06:42 +11001334
1335 /* The number of symbols on the RHS of the reduced rule.
1336 Keep to zero when no symbol should be popped. */
1337 int yylen = 0;
1338
John Bonesio658f29a2010-11-17 15:28:20 -08001339 yytoken = 0;
1340 yyss = yyssa;
1341 yyvs = yyvsa;
1342 yystacksize = YYINITDEPTH;
1343
David Gibsona4da2e32007-12-18 15:06:42 +11001344 YYDPRINTF ((stderr, "Starting parse\n"));
1345
1346 yystate = 0;
1347 yyerrstatus = 0;
1348 yynerrs = 0;
John Bonesio658f29a2010-11-17 15:28:20 -08001349 yychar = YYEMPTY; /* Cause a token to be read. */
David Gibsona4da2e32007-12-18 15:06:42 +11001350
1351 /* Initialize stack pointers.
1352 Waste one element of value and location stack
1353 so that they stay on the same level as the state stack.
1354 The wasted elements are never initialized. */
David Gibsona4da2e32007-12-18 15:06:42 +11001355 yyssp = yyss;
1356 yyvsp = yyvs;
David Gibsona4da2e32007-12-18 15:06:42 +11001357
1358 goto yysetstate;
1359
1360/*------------------------------------------------------------.
1361| yynewstate -- Push a new state, which is found in yystate. |
1362`------------------------------------------------------------*/
1363 yynewstate:
1364 /* In all cases, when you get here, the value and location stacks
1365 have just been pushed. So pushing a state here evens the stacks. */
1366 yyssp++;
1367
1368 yysetstate:
1369 *yyssp = yystate;
1370
1371 if (yyss + yystacksize - 1 <= yyssp)
1372 {
1373 /* Get the current used size of the three stacks, in elements. */
1374 YYSIZE_T yysize = yyssp - yyss + 1;
1375
1376#ifdef yyoverflow
1377 {
1378 /* Give user a chance to reallocate the stack. Use copies of
1379 these so that the &'s don't force the real ones into
1380 memory. */
1381 YYSTYPE *yyvs1 = yyvs;
1382 yytype_int16 *yyss1 = yyss;
David Gibsona4da2e32007-12-18 15:06:42 +11001383
1384 /* Each stack pointer address is followed by the size of the
1385 data in use in that stack, in bytes. This used to be a
1386 conditional around just the two extra args, but that might
1387 be undefined if yyoverflow is a macro. */
1388 yyoverflow (YY_("memory exhausted"),
1389 &yyss1, yysize * sizeof (*yyssp),
1390 &yyvs1, yysize * sizeof (*yyvsp),
David Gibsona4da2e32007-12-18 15:06:42 +11001391 &yystacksize);
John Bonesio658f29a2010-11-17 15:28:20 -08001392
David Gibsona4da2e32007-12-18 15:06:42 +11001393 yyss = yyss1;
1394 yyvs = yyvs1;
1395 }
1396#else /* no yyoverflow */
1397# ifndef YYSTACK_RELOCATE
1398 goto yyexhaustedlab;
1399# else
1400 /* Extend the stack our own way. */
1401 if (YYMAXDEPTH <= yystacksize)
1402 goto yyexhaustedlab;
1403 yystacksize *= 2;
1404 if (YYMAXDEPTH < yystacksize)
1405 yystacksize = YYMAXDEPTH;
1406
1407 {
1408 yytype_int16 *yyss1 = yyss;
1409 union yyalloc *yyptr =
1410 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1411 if (! yyptr)
1412 goto yyexhaustedlab;
John Bonesio658f29a2010-11-17 15:28:20 -08001413 YYSTACK_RELOCATE (yyss_alloc, yyss);
1414 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
David Gibsona4da2e32007-12-18 15:06:42 +11001415# undef YYSTACK_RELOCATE
1416 if (yyss1 != yyssa)
1417 YYSTACK_FREE (yyss1);
1418 }
1419# endif
1420#endif /* no yyoverflow */
1421
1422 yyssp = yyss + yysize - 1;
1423 yyvsp = yyvs + yysize - 1;
David Gibsona4da2e32007-12-18 15:06:42 +11001424
1425 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1426 (unsigned long int) yystacksize));
1427
1428 if (yyss + yystacksize - 1 <= yyssp)
1429 YYABORT;
1430 }
1431
1432 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1433
John Bonesio658f29a2010-11-17 15:28:20 -08001434 if (yystate == YYFINAL)
1435 YYACCEPT;
1436
David Gibsona4da2e32007-12-18 15:06:42 +11001437 goto yybackup;
1438
1439/*-----------.
1440| yybackup. |
1441`-----------*/
1442yybackup:
1443
1444 /* Do appropriate processing given the current state. Read a
John Bonesio658f29a2010-11-17 15:28:20 -08001445 lookahead token if we need one and don't already have one. */
David Gibsona4da2e32007-12-18 15:06:42 +11001446
John Bonesio658f29a2010-11-17 15:28:20 -08001447 /* First try to decide what to do without reference to lookahead token. */
David Gibsona4da2e32007-12-18 15:06:42 +11001448 yyn = yypact[yystate];
Grant Likely2a6a08c2013-06-13 13:00:43 +01001449 if (yypact_value_is_default (yyn))
David Gibsona4da2e32007-12-18 15:06:42 +11001450 goto yydefault;
1451
John Bonesio658f29a2010-11-17 15:28:20 -08001452 /* Not known => get a lookahead token if don't already have one. */
David Gibsona4da2e32007-12-18 15:06:42 +11001453
John Bonesio658f29a2010-11-17 15:28:20 -08001454 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
David Gibsona4da2e32007-12-18 15:06:42 +11001455 if (yychar == YYEMPTY)
1456 {
1457 YYDPRINTF ((stderr, "Reading a token: "));
1458 yychar = YYLEX;
1459 }
1460
1461 if (yychar <= YYEOF)
1462 {
1463 yychar = yytoken = YYEOF;
1464 YYDPRINTF ((stderr, "Now at end of input.\n"));
1465 }
1466 else
1467 {
1468 yytoken = YYTRANSLATE (yychar);
1469 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1470 }
1471
1472 /* If the proper action on seeing token YYTOKEN is to reduce or to
1473 detect an error, take that action. */
1474 yyn += yytoken;
1475 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1476 goto yydefault;
1477 yyn = yytable[yyn];
1478 if (yyn <= 0)
1479 {
Grant Likely2a6a08c2013-06-13 13:00:43 +01001480 if (yytable_value_is_error (yyn))
1481 goto yyerrlab;
David Gibsona4da2e32007-12-18 15:06:42 +11001482 yyn = -yyn;
1483 goto yyreduce;
1484 }
1485
David Gibsona4da2e32007-12-18 15:06:42 +11001486 /* Count tokens shifted since error; after three, turn off error
1487 status. */
1488 if (yyerrstatus)
1489 yyerrstatus--;
1490
John Bonesio658f29a2010-11-17 15:28:20 -08001491 /* Shift the lookahead token. */
David Gibsona4da2e32007-12-18 15:06:42 +11001492 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1493
John Bonesio658f29a2010-11-17 15:28:20 -08001494 /* Discard the shifted token. */
1495 yychar = YYEMPTY;
David Gibsona4da2e32007-12-18 15:06:42 +11001496
1497 yystate = yyn;
1498 *++yyvsp = yylval;
John Bonesio658f29a2010-11-17 15:28:20 -08001499
David Gibsona4da2e32007-12-18 15:06:42 +11001500 goto yynewstate;
1501
1502
1503/*-----------------------------------------------------------.
1504| yydefault -- do the default action for the current state. |
1505`-----------------------------------------------------------*/
1506yydefault:
1507 yyn = yydefact[yystate];
1508 if (yyn == 0)
1509 goto yyerrlab;
1510 goto yyreduce;
1511
1512
1513/*-----------------------------.
1514| yyreduce -- Do a reduction. |
1515`-----------------------------*/
1516yyreduce:
1517 /* yyn is the number of a rule to reduce with. */
1518 yylen = yyr2[yyn];
1519
1520 /* If YYLEN is nonzero, implement the default value of the action:
1521 `$$ = $1'.
1522
1523 Otherwise, the following line sets YYVAL to garbage.
1524 This behavior is undocumented and Bison
1525 users should not rely upon it. Assigning to YYVAL
1526 unconditionally makes the parser a bit smaller, and it avoids a
1527 GCC warning that YYVAL may be used uninitialized. */
1528 yyval = yyvsp[1-yylen];
1529
John Bonesio658f29a2010-11-17 15:28:20 -08001530
David Gibsona4da2e32007-12-18 15:06:42 +11001531 YY_REDUCE_PRINT (yyn);
1532 switch (yyn)
1533 {
1534 case 2:
John Bonesio658f29a2010-11-17 15:28:20 -08001535
Grant Likely2a6a08c2013-06-13 13:00:43 +01001536/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001537#line 110 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001538 {
John Bonesio658f29a2010-11-17 15:28:20 -08001539 the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node),
1540 guess_boot_cpuid((yyvsp[(4) - (4)].node)));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001541 }
David Gibsona4da2e32007-12-18 15:06:42 +11001542 break;
1543
1544 case 3:
John Bonesio658f29a2010-11-17 15:28:20 -08001545
Grant Likely2a6a08c2013-06-13 13:00:43 +01001546/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001547#line 118 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001548 {
John Bonesio658f29a2010-11-17 15:28:20 -08001549 (yyval.re) = NULL;
Grant Likely2a6a08c2013-06-13 13:00:43 +01001550 }
David Gibsona4da2e32007-12-18 15:06:42 +11001551 break;
1552
1553 case 4:
John Bonesio658f29a2010-11-17 15:28:20 -08001554
Grant Likely2a6a08c2013-06-13 13:00:43 +01001555/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001556#line 122 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001557 {
John Bonesio658f29a2010-11-17 15:28:20 -08001558 (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001559 }
David Gibsona4da2e32007-12-18 15:06:42 +11001560 break;
1561
1562 case 5:
John Bonesio658f29a2010-11-17 15:28:20 -08001563
Grant Likely2a6a08c2013-06-13 13:00:43 +01001564/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001565#line 129 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001566 {
Stephen Warrencd296722012-09-28 21:25:59 +00001567 (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001568 }
David Gibsona4da2e32007-12-18 15:06:42 +11001569 break;
1570
1571 case 6:
John Bonesio658f29a2010-11-17 15:28:20 -08001572
Grant Likely2a6a08c2013-06-13 13:00:43 +01001573/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001574#line 133 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001575 {
John Bonesio658f29a2010-11-17 15:28:20 -08001576 add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref));
1577 (yyval.re) = (yyvsp[(2) - (2)].re);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001578 }
David Gibsona4da2e32007-12-18 15:06:42 +11001579 break;
1580
1581 case 7:
David Gibsona4da2e32007-12-18 15:06:42 +11001582
Grant Likely2a6a08c2013-06-13 13:00:43 +01001583/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001584#line 141 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001585 {
John Bonesio658f29a2010-11-17 15:28:20 -08001586 (yyval.node) = name_node((yyvsp[(2) - (2)].node), "");
Grant Likely2a6a08c2013-06-13 13:00:43 +01001587 }
David Gibsona4da2e32007-12-18 15:06:42 +11001588 break;
1589
Stephen Warrencd296722012-09-28 21:25:59 +00001590 case 8:
John Bonesio658f29a2010-11-17 15:28:20 -08001591
Grant Likely2a6a08c2013-06-13 13:00:43 +01001592/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001593#line 145 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001594 {
John Bonesio658f29a2010-11-17 15:28:20 -08001595 (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001596 }
David Gibsona4da2e32007-12-18 15:06:42 +11001597 break;
1598
Stephen Warrencd296722012-09-28 21:25:59 +00001599 case 9:
John Bonesio658f29a2010-11-17 15:28:20 -08001600
Grant Likely2a6a08c2013-06-13 13:00:43 +01001601/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001602#line 149 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001603 {
1604 struct node *target = get_node_by_ref((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].labelref));
1605
1606 if (target)
1607 merge_nodes(target, (yyvsp[(3) - (3)].node));
1608 else
1609 print_error("label or path, '%s', not found", (yyvsp[(2) - (3)].labelref));
1610 (yyval.node) = (yyvsp[(1) - (3)].node);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001611 }
John Bonesio658f29a2010-11-17 15:28:20 -08001612 break;
1613
Stephen Warrencd296722012-09-28 21:25:59 +00001614 case 10:
1615
Grant Likely2a6a08c2013-06-13 13:00:43 +01001616/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001617#line 159 "dtc-parser.y"
1618 {
1619 struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref));
1620
1621 if (!target)
1622 print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref));
1623 else
1624 delete_node(target);
1625
1626 (yyval.node) = (yyvsp[(1) - (4)].node);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001627 }
Stephen Warrencd296722012-09-28 21:25:59 +00001628 break;
1629
John Bonesio658f29a2010-11-17 15:28:20 -08001630 case 11:
1631
Grant Likely2a6a08c2013-06-13 13:00:43 +01001632/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001633#line 173 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001634 {
1635 (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001636 }
David Gibsona4da2e32007-12-18 15:06:42 +11001637 break;
1638
John Bonesio658f29a2010-11-17 15:28:20 -08001639 case 12:
1640
Grant Likely2a6a08c2013-06-13 13:00:43 +01001641/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001642#line 180 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001643 {
1644 (yyval.proplist) = NULL;
Grant Likely2a6a08c2013-06-13 13:00:43 +01001645 }
David Gibsona4da2e32007-12-18 15:06:42 +11001646 break;
1647
John Bonesio658f29a2010-11-17 15:28:20 -08001648 case 13:
1649
Grant Likely2a6a08c2013-06-13 13:00:43 +01001650/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001651#line 184 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001652 {
1653 (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001654 }
David Gibsona4da2e32007-12-18 15:06:42 +11001655 break;
1656
John Bonesio658f29a2010-11-17 15:28:20 -08001657 case 14:
1658
Grant Likely2a6a08c2013-06-13 13:00:43 +01001659/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001660#line 191 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001661 {
1662 (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001663 }
John Bonesio658f29a2010-11-17 15:28:20 -08001664 break;
1665
1666 case 15:
1667
Grant Likely2a6a08c2013-06-13 13:00:43 +01001668/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001669#line 195 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001670 {
1671 (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001672 }
John Bonesio658f29a2010-11-17 15:28:20 -08001673 break;
1674
1675 case 16:
1676
Grant Likely2a6a08c2013-06-13 13:00:43 +01001677/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001678#line 199 "dtc-parser.y"
1679 {
1680 (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001681 }
Stephen Warrencd296722012-09-28 21:25:59 +00001682 break;
1683
1684 case 17:
1685
Grant Likely2a6a08c2013-06-13 13:00:43 +01001686/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001687#line 203 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001688 {
1689 add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref));
1690 (yyval.prop) = (yyvsp[(2) - (2)].prop);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001691 }
John Bonesio658f29a2010-11-17 15:28:20 -08001692 break;
1693
Stephen Warrencd296722012-09-28 21:25:59 +00001694 case 18:
David Gibsona4da2e32007-12-18 15:06:42 +11001695
Grant Likely2a6a08c2013-06-13 13:00:43 +01001696/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001697#line 211 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001698 {
1699 (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001700 }
David Gibsona4da2e32007-12-18 15:06:42 +11001701 break;
1702
John Bonesio658f29a2010-11-17 15:28:20 -08001703 case 19:
1704
Grant Likely2a6a08c2013-06-13 13:00:43 +01001705/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001706#line 215 "dtc-parser.y"
John Bonesio658f29a2010-11-17 15:28:20 -08001707 {
Stephen Warrencd296722012-09-28 21:25:59 +00001708 (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001709 }
John Bonesio658f29a2010-11-17 15:28:20 -08001710 break;
1711
David Gibsona4da2e32007-12-18 15:06:42 +11001712 case 20:
John Bonesio658f29a2010-11-17 15:28:20 -08001713
Grant Likely2a6a08c2013-06-13 13:00:43 +01001714/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001715#line 219 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001716 {
Stephen Warrencd296722012-09-28 21:25:59 +00001717 (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001718 }
David Gibsona4da2e32007-12-18 15:06:42 +11001719 break;
1720
John Bonesio658f29a2010-11-17 15:28:20 -08001721 case 21:
1722
Grant Likely2a6a08c2013-06-13 13:00:43 +01001723/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001724#line 223 "dtc-parser.y"
1725 {
1726 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001727 }
Stephen Warrencd296722012-09-28 21:25:59 +00001728 break;
1729
1730 case 22:
1731
Grant Likely2a6a08c2013-06-13 13:00:43 +01001732/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001733#line 227 "dtc-parser.y"
David Gibsoned95d742008-08-07 12:24:17 +10001734 {
John Bonesio658f29a2010-11-17 15:28:20 -08001735 FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL);
1736 struct data d;
David Gibsoned95d742008-08-07 12:24:17 +10001737
Stephen Warrencd296722012-09-28 21:25:59 +00001738 if ((yyvsp[(6) - (9)].integer) != 0)
1739 if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0)
John Bonesio658f29a2010-11-17 15:28:20 -08001740 print_error("Couldn't seek to offset %llu in \"%s\": %s",
Stephen Warrencd296722012-09-28 21:25:59 +00001741 (unsigned long long)(yyvsp[(6) - (9)].integer),
John Bonesio658f29a2010-11-17 15:28:20 -08001742 (yyvsp[(4) - (9)].data).val,
1743 strerror(errno));
David Gibsoned95d742008-08-07 12:24:17 +10001744
Stephen Warrencd296722012-09-28 21:25:59 +00001745 d = data_copy_file(f, (yyvsp[(8) - (9)].integer));
David Gibsoned95d742008-08-07 12:24:17 +10001746
1747 (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d);
John Bonesio658f29a2010-11-17 15:28:20 -08001748 fclose(f);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001749 }
David Gibsoned95d742008-08-07 12:24:17 +10001750 break;
1751
Stephen Warrencd296722012-09-28 21:25:59 +00001752 case 23:
John Bonesio658f29a2010-11-17 15:28:20 -08001753
Grant Likely2a6a08c2013-06-13 13:00:43 +01001754/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001755#line 244 "dtc-parser.y"
David Gibsoned95d742008-08-07 12:24:17 +10001756 {
John Bonesio658f29a2010-11-17 15:28:20 -08001757 FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL);
David Gibsoned95d742008-08-07 12:24:17 +10001758 struct data d = empty_data;
1759
John Bonesio658f29a2010-11-17 15:28:20 -08001760 d = data_copy_file(f, -1);
David Gibsoned95d742008-08-07 12:24:17 +10001761
1762 (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d);
John Bonesio658f29a2010-11-17 15:28:20 -08001763 fclose(f);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001764 }
David Gibsoned95d742008-08-07 12:24:17 +10001765 break;
1766
John Bonesio658f29a2010-11-17 15:28:20 -08001767 case 24:
1768
Grant Likely2a6a08c2013-06-13 13:00:43 +01001769/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001770#line 254 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001771 {
Stephen Warrencd296722012-09-28 21:25:59 +00001772 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001773 }
David Gibsona4da2e32007-12-18 15:06:42 +11001774 break;
1775
John Bonesio658f29a2010-11-17 15:28:20 -08001776 case 25:
1777
Grant Likely2a6a08c2013-06-13 13:00:43 +01001778/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001779#line 261 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001780 {
Stephen Warrencd296722012-09-28 21:25:59 +00001781 (yyval.data) = empty_data;
Grant Likely2a6a08c2013-06-13 13:00:43 +01001782 }
David Gibsona4da2e32007-12-18 15:06:42 +11001783 break;
1784
John Bonesio658f29a2010-11-17 15:28:20 -08001785 case 26:
1786
Grant Likely2a6a08c2013-06-13 13:00:43 +01001787/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001788#line 265 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001789 {
Stephen Warrencd296722012-09-28 21:25:59 +00001790 (yyval.data) = (yyvsp[(1) - (2)].data);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001791 }
David Gibsona4da2e32007-12-18 15:06:42 +11001792 break;
1793
John Bonesio658f29a2010-11-17 15:28:20 -08001794 case 27:
1795
Grant Likely2a6a08c2013-06-13 13:00:43 +01001796/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001797#line 269 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001798 {
Stephen Warrencd296722012-09-28 21:25:59 +00001799 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001800 }
David Gibsona4da2e32007-12-18 15:06:42 +11001801 break;
1802
John Bonesio658f29a2010-11-17 15:28:20 -08001803 case 28:
1804
Grant Likely2a6a08c2013-06-13 13:00:43 +01001805/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001806#line 276 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001807 {
Stephen Warrencd296722012-09-28 21:25:59 +00001808 (yyval.array).data = empty_data;
1809 (yyval.array).bits = eval_literal((yyvsp[(2) - (3)].literal), 0, 7);
1810
1811 if (((yyval.array).bits != 8) &&
1812 ((yyval.array).bits != 16) &&
1813 ((yyval.array).bits != 32) &&
1814 ((yyval.array).bits != 64))
1815 {
1816 print_error("Only 8, 16, 32 and 64-bit elements"
1817 " are currently supported");
1818 (yyval.array).bits = 32;
1819 }
Grant Likely2a6a08c2013-06-13 13:00:43 +01001820 }
David Gibsona4da2e32007-12-18 15:06:42 +11001821 break;
1822
John Bonesio658f29a2010-11-17 15:28:20 -08001823 case 29:
1824
Grant Likely2a6a08c2013-06-13 13:00:43 +01001825/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001826#line 291 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001827 {
Stephen Warrencd296722012-09-28 21:25:59 +00001828 (yyval.array).data = empty_data;
1829 (yyval.array).bits = 32;
Grant Likely2a6a08c2013-06-13 13:00:43 +01001830 }
David Gibsona4da2e32007-12-18 15:06:42 +11001831 break;
1832
John Bonesio658f29a2010-11-17 15:28:20 -08001833 case 30:
1834
Grant Likely2a6a08c2013-06-13 13:00:43 +01001835/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001836#line 296 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001837 {
Stephen Warrencd296722012-09-28 21:25:59 +00001838 if ((yyvsp[(1) - (2)].array).bits < 64) {
1839 uint64_t mask = (1ULL << (yyvsp[(1) - (2)].array).bits) - 1;
1840 /*
1841 * Bits above mask must either be all zero
1842 * (positive within range of mask) or all one
1843 * (negative and sign-extended). The second
1844 * condition is true if when we set all bits
1845 * within the mask to one (i.e. | in the
1846 * mask), all bits are one.
1847 */
1848 if (((yyvsp[(2) - (2)].integer) > mask) && (((yyvsp[(2) - (2)].integer) | mask) != -1ULL))
1849 print_error(
1850 "integer value out of range "
1851 "%016lx (%d bits)", (yyvsp[(1) - (2)].array).bits);
1852 }
1853
1854 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, (yyvsp[(2) - (2)].integer), (yyvsp[(1) - (2)].array).bits);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001855 }
David Gibsona4da2e32007-12-18 15:06:42 +11001856 break;
1857
John Bonesio658f29a2010-11-17 15:28:20 -08001858 case 31:
David Gibsona4da2e32007-12-18 15:06:42 +11001859
Grant Likely2a6a08c2013-06-13 13:00:43 +01001860/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001861#line 316 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001862 {
Stephen Warrencd296722012-09-28 21:25:59 +00001863 uint64_t val = ~0ULL >> (64 - (yyvsp[(1) - (2)].array).bits);
1864
1865 if ((yyvsp[(1) - (2)].array).bits == 32)
1866 (yyvsp[(1) - (2)].array).data = data_add_marker((yyvsp[(1) - (2)].array).data,
1867 REF_PHANDLE,
1868 (yyvsp[(2) - (2)].labelref));
1869 else
1870 print_error("References are only allowed in "
1871 "arrays with 32-bit elements.");
1872
1873 (yyval.array).data = data_append_integer((yyvsp[(1) - (2)].array).data, val, (yyvsp[(1) - (2)].array).bits);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001874 }
David Gibsona4da2e32007-12-18 15:06:42 +11001875 break;
1876
John Bonesio658f29a2010-11-17 15:28:20 -08001877 case 32:
David Gibsona4da2e32007-12-18 15:06:42 +11001878
Grant Likely2a6a08c2013-06-13 13:00:43 +01001879/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001880#line 330 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001881 {
Stephen Warrencd296722012-09-28 21:25:59 +00001882 (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001883 }
David Gibsona4da2e32007-12-18 15:06:42 +11001884 break;
1885
John Bonesio658f29a2010-11-17 15:28:20 -08001886 case 33:
1887
Grant Likely2a6a08c2013-06-13 13:00:43 +01001888/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001889#line 337 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001890 {
Stephen Warrencd296722012-09-28 21:25:59 +00001891 (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001892 }
David Gibsona4da2e32007-12-18 15:06:42 +11001893 break;
1894
John Bonesio658f29a2010-11-17 15:28:20 -08001895 case 34:
1896
Grant Likely2a6a08c2013-06-13 13:00:43 +01001897/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001898#line 341 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11001899 {
Stephen Warrencd296722012-09-28 21:25:59 +00001900 (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal));
Grant Likely2a6a08c2013-06-13 13:00:43 +01001901 }
David Gibsona4da2e32007-12-18 15:06:42 +11001902 break;
1903
John Bonesio658f29a2010-11-17 15:28:20 -08001904 case 35:
1905
Grant Likely2a6a08c2013-06-13 13:00:43 +01001906/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001907#line 345 "dtc-parser.y"
1908 {
1909 (yyval.integer) = (yyvsp[(2) - (3)].integer);
Grant Likely2a6a08c2013-06-13 13:00:43 +01001910 }
Stephen Warrencd296722012-09-28 21:25:59 +00001911 break;
1912
1913 case 38:
1914
Grant Likely2a6a08c2013-06-13 13:00:43 +01001915/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001916#line 356 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001917 { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001918 break;
1919
1920 case 40:
1921
Grant Likely2a6a08c2013-06-13 13:00:43 +01001922/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001923#line 361 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001924 { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001925 break;
1926
1927 case 42:
1928
Grant Likely2a6a08c2013-06-13 13:00:43 +01001929/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001930#line 366 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001931 { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001932 break;
1933
1934 case 44:
1935
Grant Likely2a6a08c2013-06-13 13:00:43 +01001936/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001937#line 371 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001938 { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001939 break;
1940
1941 case 46:
1942
Grant Likely2a6a08c2013-06-13 13:00:43 +01001943/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001944#line 376 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001945 { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001946 break;
1947
1948 case 48:
1949
Grant Likely2a6a08c2013-06-13 13:00:43 +01001950/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001951#line 381 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001952 { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001953 break;
1954
1955 case 50:
1956
Grant Likely2a6a08c2013-06-13 13:00:43 +01001957/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001958#line 386 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001959 { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001960 break;
1961
1962 case 51:
1963
Grant Likely2a6a08c2013-06-13 13:00:43 +01001964/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001965#line 387 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001966 { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001967 break;
1968
1969 case 53:
1970
Grant Likely2a6a08c2013-06-13 13:00:43 +01001971/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001972#line 392 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001973 { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001974 break;
1975
1976 case 54:
1977
Grant Likely2a6a08c2013-06-13 13:00:43 +01001978/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001979#line 393 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001980 { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001981 break;
1982
1983 case 55:
1984
Grant Likely2a6a08c2013-06-13 13:00:43 +01001985/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001986#line 394 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001987 { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001988 break;
1989
1990 case 56:
1991
Grant Likely2a6a08c2013-06-13 13:00:43 +01001992/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00001993#line 395 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01001994 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00001995 break;
1996
1997 case 57:
1998
Grant Likely2a6a08c2013-06-13 13:00:43 +01001999/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002000#line 399 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002001 { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002002 break;
2003
2004 case 58:
2005
Grant Likely2a6a08c2013-06-13 13:00:43 +01002006/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002007#line 400 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002008 { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002009 break;
2010
2011 case 60:
2012
Grant Likely2a6a08c2013-06-13 13:00:43 +01002013/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002014#line 405 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002015 { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002016 break;
2017
2018 case 61:
2019
Grant Likely2a6a08c2013-06-13 13:00:43 +01002020/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002021#line 406 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002022 { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002023 break;
2024
2025 case 63:
2026
Grant Likely2a6a08c2013-06-13 13:00:43 +01002027/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002028#line 411 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002029 { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002030 break;
2031
2032 case 64:
2033
Grant Likely2a6a08c2013-06-13 13:00:43 +01002034/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002035#line 412 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002036 { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002037 break;
2038
2039 case 65:
2040
Grant Likely2a6a08c2013-06-13 13:00:43 +01002041/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002042#line 413 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002043 { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002044 break;
2045
2046 case 68:
2047
Grant Likely2a6a08c2013-06-13 13:00:43 +01002048/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002049#line 419 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002050 { (yyval.integer) = -(yyvsp[(2) - (2)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002051 break;
2052
2053 case 69:
2054
Grant Likely2a6a08c2013-06-13 13:00:43 +01002055/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002056#line 420 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002057 { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002058 break;
2059
2060 case 70:
2061
Grant Likely2a6a08c2013-06-13 13:00:43 +01002062/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002063#line 421 "dtc-parser.y"
Grant Likely2a6a08c2013-06-13 13:00:43 +01002064 { (yyval.integer) = !(yyvsp[(2) - (2)].integer); }
Stephen Warrencd296722012-09-28 21:25:59 +00002065 break;
2066
2067 case 71:
2068
Grant Likely2a6a08c2013-06-13 13:00:43 +01002069/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002070#line 426 "dtc-parser.y"
2071 {
2072 (yyval.data) = empty_data;
Grant Likely2a6a08c2013-06-13 13:00:43 +01002073 }
Stephen Warrencd296722012-09-28 21:25:59 +00002074 break;
2075
2076 case 72:
2077
Grant Likely2a6a08c2013-06-13 13:00:43 +01002078/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002079#line 430 "dtc-parser.y"
2080 {
2081 (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte));
Grant Likely2a6a08c2013-06-13 13:00:43 +01002082 }
Stephen Warrencd296722012-09-28 21:25:59 +00002083 break;
2084
2085 case 73:
2086
Grant Likely2a6a08c2013-06-13 13:00:43 +01002087/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002088#line 434 "dtc-parser.y"
2089 {
2090 (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref));
Grant Likely2a6a08c2013-06-13 13:00:43 +01002091 }
Stephen Warrencd296722012-09-28 21:25:59 +00002092 break;
2093
2094 case 74:
2095
Grant Likely2a6a08c2013-06-13 13:00:43 +01002096/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002097#line 441 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002098 {
2099 (yyval.nodelist) = NULL;
Grant Likely2a6a08c2013-06-13 13:00:43 +01002100 }
David Gibsona4da2e32007-12-18 15:06:42 +11002101 break;
2102
Stephen Warrencd296722012-09-28 21:25:59 +00002103 case 75:
John Bonesio658f29a2010-11-17 15:28:20 -08002104
Grant Likely2a6a08c2013-06-13 13:00:43 +01002105/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002106#line 445 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002107 {
2108 (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist));
Grant Likely2a6a08c2013-06-13 13:00:43 +01002109 }
David Gibsona4da2e32007-12-18 15:06:42 +11002110 break;
2111
Stephen Warrencd296722012-09-28 21:25:59 +00002112 case 76:
John Bonesio658f29a2010-11-17 15:28:20 -08002113
Grant Likely2a6a08c2013-06-13 13:00:43 +01002114/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002115#line 449 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002116 {
John Bonesio658f29a2010-11-17 15:28:20 -08002117 print_error("syntax error: properties must precede subnodes");
David Gibsona4da2e32007-12-18 15:06:42 +11002118 YYERROR;
Grant Likely2a6a08c2013-06-13 13:00:43 +01002119 }
David Gibsona4da2e32007-12-18 15:06:42 +11002120 break;
2121
Stephen Warrencd296722012-09-28 21:25:59 +00002122 case 77:
John Bonesio658f29a2010-11-17 15:28:20 -08002123
Grant Likely2a6a08c2013-06-13 13:00:43 +01002124/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002125#line 457 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002126 {
John Bonesio658f29a2010-11-17 15:28:20 -08002127 (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename));
Grant Likely2a6a08c2013-06-13 13:00:43 +01002128 }
David Gibsona4da2e32007-12-18 15:06:42 +11002129 break;
2130
Stephen Warrencd296722012-09-28 21:25:59 +00002131 case 78:
David Gibsona4da2e32007-12-18 15:06:42 +11002132
Grant Likely2a6a08c2013-06-13 13:00:43 +01002133/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002134#line 461 "dtc-parser.y"
2135 {
2136 (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename));
Grant Likely2a6a08c2013-06-13 13:00:43 +01002137 }
Stephen Warrencd296722012-09-28 21:25:59 +00002138 break;
2139
2140 case 79:
2141
Grant Likely2a6a08c2013-06-13 13:00:43 +01002142/* Line 1806 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002143#line 465 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002144 {
John Bonesio658f29a2010-11-17 15:28:20 -08002145 add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref));
2146 (yyval.node) = (yyvsp[(2) - (2)].node);
Grant Likely2a6a08c2013-06-13 13:00:43 +01002147 }
David Gibsona4da2e32007-12-18 15:06:42 +11002148 break;
2149
2150
John Bonesio658f29a2010-11-17 15:28:20 -08002151
Grant Likely2a6a08c2013-06-13 13:00:43 +01002152/* Line 1806 of yacc.c */
2153#line 2154 "dtc-parser.tab.c"
David Gibsona4da2e32007-12-18 15:06:42 +11002154 default: break;
2155 }
Grant Likely2a6a08c2013-06-13 13:00:43 +01002156 /* User semantic actions sometimes alter yychar, and that requires
2157 that yytoken be updated with the new translation. We take the
2158 approach of translating immediately before every use of yytoken.
2159 One alternative is translating here after every semantic action,
2160 but that translation would be missed if the semantic action invokes
2161 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2162 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2163 incorrect destructor might then be invoked immediately. In the
2164 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2165 to an incorrect destructor call or verbose syntax error message
2166 before the lookahead is translated. */
David Gibsona4da2e32007-12-18 15:06:42 +11002167 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2168
2169 YYPOPSTACK (yylen);
2170 yylen = 0;
2171 YY_STACK_PRINT (yyss, yyssp);
2172
2173 *++yyvsp = yyval;
David Gibsona4da2e32007-12-18 15:06:42 +11002174
2175 /* Now `shift' the result of the reduction. Determine what state
2176 that goes to, based on the state we popped back to and the rule
2177 number reduced by. */
2178
2179 yyn = yyr1[yyn];
2180
2181 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
2182 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
2183 yystate = yytable[yystate];
2184 else
2185 yystate = yydefgoto[yyn - YYNTOKENS];
2186
2187 goto yynewstate;
2188
2189
2190/*------------------------------------.
2191| yyerrlab -- here on detecting error |
2192`------------------------------------*/
2193yyerrlab:
Grant Likely2a6a08c2013-06-13 13:00:43 +01002194 /* Make sure we have latest lookahead translation. See comments at
2195 user semantic actions for why this is necessary. */
2196 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2197
David Gibsona4da2e32007-12-18 15:06:42 +11002198 /* If not already recovering from an error, report this error. */
2199 if (!yyerrstatus)
2200 {
2201 ++yynerrs;
2202#if ! YYERROR_VERBOSE
2203 yyerror (YY_("syntax error"));
2204#else
Grant Likely2a6a08c2013-06-13 13:00:43 +01002205# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2206 yyssp, yytoken)
David Gibsona4da2e32007-12-18 15:06:42 +11002207 {
Grant Likely2a6a08c2013-06-13 13:00:43 +01002208 char const *yymsgp = YY_("syntax error");
2209 int yysyntax_error_status;
2210 yysyntax_error_status = YYSYNTAX_ERROR;
2211 if (yysyntax_error_status == 0)
2212 yymsgp = yymsg;
2213 else if (yysyntax_error_status == 1)
2214 {
2215 if (yymsg != yymsgbuf)
2216 YYSTACK_FREE (yymsg);
2217 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
2218 if (!yymsg)
2219 {
2220 yymsg = yymsgbuf;
2221 yymsg_alloc = sizeof yymsgbuf;
2222 yysyntax_error_status = 2;
2223 }
2224 else
2225 {
2226 yysyntax_error_status = YYSYNTAX_ERROR;
2227 yymsgp = yymsg;
2228 }
2229 }
2230 yyerror (yymsgp);
2231 if (yysyntax_error_status == 2)
2232 goto yyexhaustedlab;
David Gibsona4da2e32007-12-18 15:06:42 +11002233 }
Grant Likely2a6a08c2013-06-13 13:00:43 +01002234# undef YYSYNTAX_ERROR
David Gibsona4da2e32007-12-18 15:06:42 +11002235#endif
2236 }
2237
John Bonesio658f29a2010-11-17 15:28:20 -08002238
David Gibsona4da2e32007-12-18 15:06:42 +11002239
2240 if (yyerrstatus == 3)
2241 {
John Bonesio658f29a2010-11-17 15:28:20 -08002242 /* If just tried and failed to reuse lookahead token after an
David Gibsona4da2e32007-12-18 15:06:42 +11002243 error, discard it. */
2244
2245 if (yychar <= YYEOF)
2246 {
2247 /* Return failure if at end of input. */
2248 if (yychar == YYEOF)
2249 YYABORT;
2250 }
2251 else
2252 {
2253 yydestruct ("Error: discarding",
John Bonesio658f29a2010-11-17 15:28:20 -08002254 yytoken, &yylval);
David Gibsona4da2e32007-12-18 15:06:42 +11002255 yychar = YYEMPTY;
2256 }
2257 }
2258
John Bonesio658f29a2010-11-17 15:28:20 -08002259 /* Else will try to reuse lookahead token after shifting the error
David Gibsona4da2e32007-12-18 15:06:42 +11002260 token. */
2261 goto yyerrlab1;
2262
2263
2264/*---------------------------------------------------.
2265| yyerrorlab -- error raised explicitly by YYERROR. |
2266`---------------------------------------------------*/
2267yyerrorlab:
2268
2269 /* Pacify compilers like GCC when the user code never invokes
2270 YYERROR and the label yyerrorlab therefore never appears in user
2271 code. */
2272 if (/*CONSTCOND*/ 0)
2273 goto yyerrorlab;
2274
David Gibsona4da2e32007-12-18 15:06:42 +11002275 /* Do not reclaim the symbols of the rule which action triggered
2276 this YYERROR. */
2277 YYPOPSTACK (yylen);
2278 yylen = 0;
2279 YY_STACK_PRINT (yyss, yyssp);
2280 yystate = *yyssp;
2281 goto yyerrlab1;
2282
2283
2284/*-------------------------------------------------------------.
2285| yyerrlab1 -- common code for both syntax error and YYERROR. |
2286`-------------------------------------------------------------*/
2287yyerrlab1:
2288 yyerrstatus = 3; /* Each real token shifted decrements this. */
2289
2290 for (;;)
2291 {
2292 yyn = yypact[yystate];
Grant Likely2a6a08c2013-06-13 13:00:43 +01002293 if (!yypact_value_is_default (yyn))
David Gibsona4da2e32007-12-18 15:06:42 +11002294 {
2295 yyn += YYTERROR;
2296 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2297 {
2298 yyn = yytable[yyn];
2299 if (0 < yyn)
2300 break;
2301 }
2302 }
2303
2304 /* Pop the current state because it cannot handle the error token. */
2305 if (yyssp == yyss)
2306 YYABORT;
2307
John Bonesio658f29a2010-11-17 15:28:20 -08002308
David Gibsona4da2e32007-12-18 15:06:42 +11002309 yydestruct ("Error: popping",
John Bonesio658f29a2010-11-17 15:28:20 -08002310 yystos[yystate], yyvsp);
David Gibsona4da2e32007-12-18 15:06:42 +11002311 YYPOPSTACK (1);
2312 yystate = *yyssp;
2313 YY_STACK_PRINT (yyss, yyssp);
2314 }
2315
David Gibsona4da2e32007-12-18 15:06:42 +11002316 *++yyvsp = yylval;
2317
David Gibsona4da2e32007-12-18 15:06:42 +11002318
2319 /* Shift the error token. */
2320 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2321
2322 yystate = yyn;
2323 goto yynewstate;
2324
2325
2326/*-------------------------------------.
2327| yyacceptlab -- YYACCEPT comes here. |
2328`-------------------------------------*/
2329yyacceptlab:
2330 yyresult = 0;
2331 goto yyreturn;
2332
2333/*-----------------------------------.
2334| yyabortlab -- YYABORT comes here. |
2335`-----------------------------------*/
2336yyabortlab:
2337 yyresult = 1;
2338 goto yyreturn;
2339
John Bonesio658f29a2010-11-17 15:28:20 -08002340#if !defined(yyoverflow) || YYERROR_VERBOSE
David Gibsona4da2e32007-12-18 15:06:42 +11002341/*-------------------------------------------------.
2342| yyexhaustedlab -- memory exhaustion comes here. |
2343`-------------------------------------------------*/
2344yyexhaustedlab:
2345 yyerror (YY_("memory exhausted"));
2346 yyresult = 2;
2347 /* Fall through. */
2348#endif
2349
2350yyreturn:
John Bonesio658f29a2010-11-17 15:28:20 -08002351 if (yychar != YYEMPTY)
Grant Likely2a6a08c2013-06-13 13:00:43 +01002352 {
2353 /* Make sure we have latest lookahead translation. See comments at
2354 user semantic actions for why this is necessary. */
2355 yytoken = YYTRANSLATE (yychar);
2356 yydestruct ("Cleanup: discarding lookahead",
2357 yytoken, &yylval);
2358 }
David Gibsona4da2e32007-12-18 15:06:42 +11002359 /* Do not reclaim the symbols of the rule which action triggered
2360 this YYABORT or YYACCEPT. */
2361 YYPOPSTACK (yylen);
2362 YY_STACK_PRINT (yyss, yyssp);
2363 while (yyssp != yyss)
2364 {
2365 yydestruct ("Cleanup: popping",
John Bonesio658f29a2010-11-17 15:28:20 -08002366 yystos[*yyssp], yyvsp);
David Gibsona4da2e32007-12-18 15:06:42 +11002367 YYPOPSTACK (1);
2368 }
2369#ifndef yyoverflow
2370 if (yyss != yyssa)
2371 YYSTACK_FREE (yyss);
2372#endif
2373#if YYERROR_VERBOSE
2374 if (yymsg != yymsgbuf)
2375 YYSTACK_FREE (yymsg);
2376#endif
2377 /* Make sure YYID is used. */
2378 return YYID (yyresult);
2379}
2380
2381
John Bonesio658f29a2010-11-17 15:28:20 -08002382
Grant Likely2a6a08c2013-06-13 13:00:43 +01002383/* Line 2067 of yacc.c */
Stephen Warrencd296722012-09-28 21:25:59 +00002384#line 471 "dtc-parser.y"
David Gibsona4da2e32007-12-18 15:06:42 +11002385
2386
John Bonesio658f29a2010-11-17 15:28:20 -08002387void print_error(char const *fmt, ...)
David Gibsona4da2e32007-12-18 15:06:42 +11002388{
David Gibsoned95d742008-08-07 12:24:17 +10002389 va_list va;
David Gibsona4da2e32007-12-18 15:06:42 +11002390
John Bonesio658f29a2010-11-17 15:28:20 -08002391 va_start(va, fmt);
2392 srcpos_verror(&yylloc, fmt, va);
2393 va_end(va);
David Gibsoned95d742008-08-07 12:24:17 +10002394
2395 treesource_error = 1;
David Gibsona4da2e32007-12-18 15:06:42 +11002396}
2397
John Bonesio658f29a2010-11-17 15:28:20 -08002398void yyerror(char const *s) {
2399 print_error("%s", s);
David Gibsoned95d742008-08-07 12:24:17 +10002400}
2401
2402static unsigned long long eval_literal(const char *s, int base, int bits)
David Gibsona4da2e32007-12-18 15:06:42 +11002403{
2404 unsigned long long val;
2405 char *e;
2406
2407 errno = 0;
2408 val = strtoull(s, &e, base);
Stephen Warrencd296722012-09-28 21:25:59 +00002409 if (*e) {
2410 size_t uls = strspn(e, "UL");
2411 if (e[uls])
2412 print_error("bad characters in literal");
2413 }
2414 if ((errno == ERANGE)
David Gibsona4da2e32007-12-18 15:06:42 +11002415 || ((bits < 64) && (val >= (1ULL << bits))))
John Bonesio658f29a2010-11-17 15:28:20 -08002416 print_error("literal out of range");
David Gibsona4da2e32007-12-18 15:06:42 +11002417 else if (errno != 0)
John Bonesio658f29a2010-11-17 15:28:20 -08002418 print_error("bad literal");
David Gibsona4da2e32007-12-18 15:06:42 +11002419 return val;
2420}
2421
Stephen Warrencd296722012-09-28 21:25:59 +00002422static unsigned char eval_char_literal(const char *s)
2423{
2424 int i = 1;
2425 char c = s[0];
2426
2427 if (c == '\0')
2428 {
2429 print_error("empty character literal");
2430 return 0;
2431 }
2432
2433 /*
2434 * If the first character in the character literal is a \ then process
2435 * the remaining characters as an escape encoding. If the first
2436 * character is neither an escape or a terminator it should be the only
2437 * character in the literal and will be returned.
2438 */
2439 if (c == '\\')
2440 c = get_escape_char(s, &i);
2441
2442 if (s[i] != '\0')
2443 print_error("malformed character literal");
2444
2445 return c;
2446}
2447