1 /* A Bison parser, made by GNU Bison 3.7. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output. */
49 #define YYBISON 1
50
51 /* Bison version. */
52 #define YYBISON_VERSION "3.7"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67
68
69 /* First part of user prologue. */
70
71 #include <stdio.h>
72 #include <inttypes.h>
73
74 #include "dtc.h"
75 #include "srcpos.h"
76
77 extern int yylex(void);
78 extern void yyerror(char const *s);
79 #define ERROR(loc, ...) \
80 do { \
81 srcpos_error((loc), "Error", __VA_ARGS__); \
82 treesource_error = true; \
83 } while (0)
84
85 #define YYERROR_CALL(msg) yyerror(msg)
86
87 extern struct dt_info *parser_output;
88 extern bool treesource_error;
89
90
91 # ifndef YY_CAST
92 # ifdef __cplusplus
93 # define YY_CAST(Type, Val) static_cast<Type> (Val)
94 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
95 # else
96 # define YY_CAST(Type, Val) ((Type) (Val))
97 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
98 # endif
99 # endif
100 # ifndef YY_NULLPTR
101 # if defined __cplusplus
102 # if 201103L <= __cplusplus
103 # define YY_NULLPTR nullptr
104 # else
105 # define YY_NULLPTR 0
106 # endif
107 # else
108 # define YY_NULLPTR ((void*)0)
109 # endif
110 # endif
111
112 #include "dtc-parser.tab.h"
113 /* Symbol kind. */
114 enum yysymbol_kind_t
115 {
116 YYSYMBOL_YYEMPTY = -2,
117 YYSYMBOL_YYEOF = 0, /* "end of file" */
118 YYSYMBOL_YYerror = 1, /* error */
119 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
120 YYSYMBOL_DT_V1 = 3, /* DT_V1 */
121 YYSYMBOL_DT_PLUGIN = 4, /* DT_PLUGIN */
122 YYSYMBOL_DT_MEMRESERVE = 5, /* DT_MEMRESERVE */
123 YYSYMBOL_DT_LSHIFT = 6, /* DT_LSHIFT */
124 YYSYMBOL_DT_RSHIFT = 7, /* DT_RSHIFT */
125 YYSYMBOL_DT_LE = 8, /* DT_LE */
126 YYSYMBOL_DT_GE = 9, /* DT_GE */
127 YYSYMBOL_DT_EQ = 10, /* DT_EQ */
128 YYSYMBOL_DT_NE = 11, /* DT_NE */
129 YYSYMBOL_DT_AND = 12, /* DT_AND */
130 YYSYMBOL_DT_OR = 13, /* DT_OR */
131 YYSYMBOL_DT_BITS = 14, /* DT_BITS */
132 YYSYMBOL_DT_DEL_PROP = 15, /* DT_DEL_PROP */
133 YYSYMBOL_DT_DEL_NODE = 16, /* DT_DEL_NODE */
134 YYSYMBOL_DT_OMIT_NO_REF = 17, /* DT_OMIT_NO_REF */
135 YYSYMBOL_DT_PROPNODENAME = 18, /* DT_PROPNODENAME */
136 YYSYMBOL_DT_LITERAL = 19, /* DT_LITERAL */
137 YYSYMBOL_DT_CHAR_LITERAL = 20, /* DT_CHAR_LITERAL */
138 YYSYMBOL_DT_BYTE = 21, /* DT_BYTE */
139 YYSYMBOL_DT_STRING = 22, /* DT_STRING */
140 YYSYMBOL_DT_LABEL = 23, /* DT_LABEL */
141 YYSYMBOL_DT_LABEL_REF = 24, /* DT_LABEL_REF */
142 YYSYMBOL_DT_PATH_REF = 25, /* DT_PATH_REF */
143 YYSYMBOL_DT_INCBIN = 26, /* DT_INCBIN */
144 YYSYMBOL_27_ = 27, /* ';' */
145 YYSYMBOL_28_ = 28, /* '/' */
146 YYSYMBOL_29_ = 29, /* '{' */
147 YYSYMBOL_30_ = 30, /* '}' */
148 YYSYMBOL_31_ = 31, /* '=' */
149 YYSYMBOL_32_ = 32, /* '>' */
150 YYSYMBOL_33_ = 33, /* '[' */
151 YYSYMBOL_34_ = 34, /* ']' */
152 YYSYMBOL_35_ = 35, /* '(' */
153 YYSYMBOL_36_ = 36, /* ',' */
154 YYSYMBOL_37_ = 37, /* ')' */
155 YYSYMBOL_38_ = 38, /* '<' */
156 YYSYMBOL_39_ = 39, /* '?' */
157 YYSYMBOL_40_ = 40, /* ':' */
158 YYSYMBOL_41_ = 41, /* '|' */
159 YYSYMBOL_42_ = 42, /* '^' */
160 YYSYMBOL_43_ = 43, /* '&' */
161 YYSYMBOL_44_ = 44, /* '+' */
162 YYSYMBOL_45_ = 45, /* '-' */
163 YYSYMBOL_46_ = 46, /* '*' */
164 YYSYMBOL_47_ = 47, /* '%' */
165 YYSYMBOL_48_ = 48, /* '~' */
166 YYSYMBOL_49_ = 49, /* '!' */
167 YYSYMBOL_YYACCEPT = 50, /* $accept */
168 YYSYMBOL_sourcefile = 51, /* sourcefile */
169 YYSYMBOL_header = 52, /* header */
170 YYSYMBOL_headers = 53, /* headers */
171 YYSYMBOL_memreserves = 54, /* memreserves */
172 YYSYMBOL_memreserve = 55, /* memreserve */
173 YYSYMBOL_dt_ref = 56, /* dt_ref */
174 YYSYMBOL_devicetree = 57, /* devicetree */
175 YYSYMBOL_nodedef = 58, /* nodedef */
176 YYSYMBOL_proplist = 59, /* proplist */
177 YYSYMBOL_propdef = 60, /* propdef */
178 YYSYMBOL_propdata = 61, /* propdata */
179 YYSYMBOL_propdataprefix = 62, /* propdataprefix */
180 YYSYMBOL_arrayprefix = 63, /* arrayprefix */
181 YYSYMBOL_integer_prim = 64, /* integer_prim */
182 YYSYMBOL_integer_expr = 65, /* integer_expr */
183 YYSYMBOL_integer_trinary = 66, /* integer_trinary */
184 YYSYMBOL_integer_or = 67, /* integer_or */
185 YYSYMBOL_integer_and = 68, /* integer_and */
186 YYSYMBOL_integer_bitor = 69, /* integer_bitor */
187 YYSYMBOL_integer_bitxor = 70, /* integer_bitxor */
188 YYSYMBOL_integer_bitand = 71, /* integer_bitand */
189 YYSYMBOL_integer_eq = 72, /* integer_eq */
190 YYSYMBOL_integer_rela = 73, /* integer_rela */
191 YYSYMBOL_integer_shift = 74, /* integer_shift */
192 YYSYMBOL_integer_add = 75, /* integer_add */
193 YYSYMBOL_integer_mul = 76, /* integer_mul */
194 YYSYMBOL_integer_unary = 77, /* integer_unary */
195 YYSYMBOL_bytestring = 78, /* bytestring */
196 YYSYMBOL_subnodes = 79, /* subnodes */
197 YYSYMBOL_subnode = 80 /* subnode */
198 };
199 typedef enum yysymbol_kind_t yysymbol_kind_t;
200
201
202
203
204 #ifdef short
205 # undef short
206 #endif
207
208 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
209 <limits.h> and (if available) <stdint.h> are included
210 so that the code can choose integer types of a good width. */
211
212 #ifndef __PTRDIFF_MAX__
213 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
214 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
215 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
216 # define YY_STDINT_H
217 # endif
218 #endif
219
220 /* Narrow types that promote to a signed type and that can represent a
221 signed or unsigned integer of at least N bits. In tables they can
222 save space and decrease cache pressure. Promoting to a signed type
223 helps avoid bugs in integer arithmetic. */
224
225 #ifdef __INT_LEAST8_MAX__
226 typedef __INT_LEAST8_TYPE__ yytype_int8;
227 #elif defined YY_STDINT_H
228 typedef int_least8_t yytype_int8;
229 #else
230 typedef signed char yytype_int8;
231 #endif
232
233 #ifdef __INT_LEAST16_MAX__
234 typedef __INT_LEAST16_TYPE__ yytype_int16;
235 #elif defined YY_STDINT_H
236 typedef int_least16_t yytype_int16;
237 #else
238 typedef short yytype_int16;
239 #endif
240
241 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
242 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
243 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
244 && UINT_LEAST8_MAX <= INT_MAX)
245 typedef uint_least8_t yytype_uint8;
246 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
247 typedef unsigned char yytype_uint8;
248 #else
249 typedef short yytype_uint8;
250 #endif
251
252 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
253 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
254 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
255 && UINT_LEAST16_MAX <= INT_MAX)
256 typedef uint_least16_t yytype_uint16;
257 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
258 typedef unsigned short yytype_uint16;
259 #else
260 typedef int yytype_uint16;
261 #endif
262
263 #ifndef YYPTRDIFF_T
264 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
265 # define YYPTRDIFF_T __PTRDIFF_TYPE__
266 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
267 # elif defined PTRDIFF_MAX
268 # ifndef ptrdiff_t
269 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
270 # endif
271 # define YYPTRDIFF_T ptrdiff_t
272 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
273 # else
274 # define YYPTRDIFF_T long
275 # define YYPTRDIFF_MAXIMUM LONG_MAX
276 # endif
277 #endif
278
279 #ifndef YYSIZE_T
280 # ifdef __SIZE_TYPE__
281 # define YYSIZE_T __SIZE_TYPE__
282 # elif defined size_t
283 # define YYSIZE_T size_t
284 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
285 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
286 # define YYSIZE_T size_t
287 # else
288 # define YYSIZE_T unsigned
289 # endif
290 #endif
291
292 #define YYSIZE_MAXIMUM \
293 YY_CAST (YYPTRDIFF_T, \
294 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
295 ? YYPTRDIFF_MAXIMUM \
296 : YY_CAST (YYSIZE_T, -1)))
297
298 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
299
300
301 /* Stored state numbers (used for stacks). */
302 typedef yytype_uint8 yy_state_t;
303
304 /* State numbers in computations. */
305 typedef int yy_state_fast_t;
306
307 #ifndef YY_
308 # if defined YYENABLE_NLS && YYENABLE_NLS
309 # if ENABLE_NLS
310 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
311 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
312 # endif
313 # endif
314 # ifndef YY_
315 # define YY_(Msgid) Msgid
316 # endif
317 #endif
318
319
320 #ifndef YY_ATTRIBUTE_PURE
321 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
322 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
323 # else
324 # define YY_ATTRIBUTE_PURE
325 # endif
326 #endif
327
328 #ifndef YY_ATTRIBUTE_UNUSED
329 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
330 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
331 # else
332 # define YY_ATTRIBUTE_UNUSED
333 # endif
334 #endif
335
336 /* Suppress unused-variable warnings by "using" E. */
337 #if ! defined lint || defined __GNUC__
338 # define YYUSE(E) ((void) (E))
339 #else
340 # define YYUSE(E) /* empty */
341 #endif
342
343 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
344 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
345 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
346 _Pragma ("GCC diagnostic push") \
347 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
348 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
349 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
350 _Pragma ("GCC diagnostic pop")
351 #else
352 # define YY_INITIAL_VALUE(Value) Value
353 #endif
354 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
355 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
356 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
357 #endif
358 #ifndef YY_INITIAL_VALUE
359 # define YY_INITIAL_VALUE(Value) /* Nothing. */
360 #endif
361
362 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
363 # define YY_IGNORE_USELESS_CAST_BEGIN \
364 _Pragma ("GCC diagnostic push") \
365 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
366 # define YY_IGNORE_USELESS_CAST_END \
367 _Pragma ("GCC diagnostic pop")
368 #endif
369 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
370 # define YY_IGNORE_USELESS_CAST_BEGIN
371 # define YY_IGNORE_USELESS_CAST_END
372 #endif
373
374
375 #define YY_ASSERT(E) ((void) (0 && (E)))
376
377 #if !defined yyoverflow
378
379 /* The parser invokes alloca or malloc; define the necessary symbols. */
380
381 # ifdef YYSTACK_USE_ALLOCA
382 # if YYSTACK_USE_ALLOCA
383 # ifdef __GNUC__
384 # define YYSTACK_ALLOC __builtin_alloca
385 # elif defined __BUILTIN_VA_ARG_INCR
386 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
387 # elif defined _AIX
388 # define YYSTACK_ALLOC __alloca
389 # elif defined _MSC_VER
390 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
391 # define alloca _alloca
392 # else
393 # define YYSTACK_ALLOC alloca
394 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
395 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
396 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
397 # ifndef EXIT_SUCCESS
398 # define EXIT_SUCCESS 0
399 # endif
400 # endif
401 # endif
402 # endif
403 # endif
404
405 # ifdef YYSTACK_ALLOC
406 /* Pacify GCC's 'empty if-body' warning. */
407 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
408 # ifndef YYSTACK_ALLOC_MAXIMUM
409 /* The OS might guarantee only one guard page at the bottom of the stack,
410 and a page size can be as small as 4096 bytes. So we cannot safely
411 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
412 to allow for a few compiler-allocated temporary stack slots. */
413 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
414 # endif
415 # else
416 # define YYSTACK_ALLOC YYMALLOC
417 # define YYSTACK_FREE YYFREE
418 # ifndef YYSTACK_ALLOC_MAXIMUM
419 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
420 # endif
421 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
422 && ! ((defined YYMALLOC || defined malloc) \
423 && (defined YYFREE || defined free)))
424 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
425 # ifndef EXIT_SUCCESS
426 # define EXIT_SUCCESS 0
427 # endif
428 # endif
429 # ifndef YYMALLOC
430 # define YYMALLOC malloc
431 # if ! defined malloc && ! defined EXIT_SUCCESS
432 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
433 # endif
434 # endif
435 # ifndef YYFREE
436 # define YYFREE free
437 # if ! defined free && ! defined EXIT_SUCCESS
438 void free (void *); /* INFRINGES ON USER NAME SPACE */
439 # endif
440 # endif
441 # endif
442 #endif /* !defined yyoverflow */
443
444 #if (! defined yyoverflow \
445 && (! defined __cplusplus \
446 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
447 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
448
449 /* A type that is properly aligned for any stack member. */
450 union yyalloc
451 {
452 yy_state_t yyss_alloc;
453 YYSTYPE yyvs_alloc;
454 YYLTYPE yyls_alloc;
455 };
456
457 /* The size of the maximum gap between one aligned stack and the next. */
458 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
459
460 /* The size of an array large to enough to hold all stacks, each with
461 N elements. */
462 # define YYSTACK_BYTES(N) \
463 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
464 + YYSIZEOF (YYLTYPE)) \
465 + 2 * YYSTACK_GAP_MAXIMUM)
466
467 # define YYCOPY_NEEDED 1
468
469 /* Relocate STACK from its old location to the new one. The
470 local variables YYSIZE and YYSTACKSIZE give the old and new number of
471 elements in the stack, and YYPTR gives the new location of the
472 stack. Advance YYPTR to a properly aligned location for the next
473 stack. */
474 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
475 do \
476 { \
477 YYPTRDIFF_T yynewbytes; \
478 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
479 Stack = &yyptr->Stack_alloc; \
480 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
481 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
482 } \
483 while (0)
484
485 #endif
486
487 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
488 /* Copy COUNT objects from SRC to DST. The source and destination do
489 not overlap. */
490 # ifndef YYCOPY
491 # if defined __GNUC__ && 1 < __GNUC__
492 # define YYCOPY(Dst, Src, Count) \
493 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
494 # else
495 # define YYCOPY(Dst, Src, Count) \
496 do \
497 { \
498 YYPTRDIFF_T yyi; \
499 for (yyi = 0; yyi < (Count); yyi++) \
500 (Dst)[yyi] = (Src)[yyi]; \
501 } \
502 while (0)
503 # endif
504 # endif
505 #endif /* !YYCOPY_NEEDED */
506
507 /* YYFINAL -- State number of the termination state. */
508 #define YYFINAL 6
509 /* YYLAST -- Last index in YYTABLE. */
510 #define YYLAST 151
511
512 /* YYNTOKENS -- Number of terminals. */
513 #define YYNTOKENS 50
514 /* YYNNTS -- Number of nonterminals. */
515 #define YYNNTS 31
516 /* YYNRULES -- Number of rules. */
517 #define YYNRULES 90
518 /* YYNSTATES -- Number of states. */
519 #define YYNSTATES 162
520
521 /* YYMAXUTOK -- Last valid token kind. */
522 #define YYMAXUTOK 281
523
524
525 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
526 as returned by yylex, with out-of-bounds checking. */
527 #define YYTRANSLATE(YYX) \
528 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
529 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
530 : YYSYMBOL_YYUNDEF)
531
532 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
533 as returned by yylex. */
534 static const yytype_int8 yytranslate[] =
535 {
536 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 49, 2, 2, 2, 47, 43, 2,
540 35, 37, 46, 44, 36, 45, 2, 28, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 40, 27,
542 38, 31, 32, 39, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 33, 2, 34, 42, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
548 2, 2, 2, 29, 41, 30, 48, 2, 2, 2,
549 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
550 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
551 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
552 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
553 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
562 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
563 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
564 25, 26
565 };
566
567 #if YYDEBUG
568 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
569 static const yytype_int16 yyrline[] =
570 {
571 0, 101, 101, 109, 113, 120, 121, 131, 134, 141,
572 145, 152, 152, 155, 159, 163, 177, 188, 207, 226,
573 238, 253, 261, 264, 271, 275, 279, 283, 291, 295,
574 299, 303, 308, 324, 334, 342, 345, 349, 356, 377,
575 382, 401, 415, 422, 423, 424, 431, 435, 436, 440,
576 441, 445, 446, 450, 451, 455, 456, 460, 461, 465,
577 466, 467, 471, 472, 473, 474, 475, 479, 480, 481,
578 485, 486, 487, 491, 492, 501, 510, 514, 515, 516,
579 517, 522, 525, 529, 537, 540, 544, 552, 556, 560,
580 564
581 };
582 #endif
583
584 /** Accessing symbol of state STATE. */
585 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
586
587 #if YYDEBUG || 0
588 /* The user-facing name of the symbol whose (internal) number is
589 YYSYMBOL. No bounds checking. */
590 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
591
592 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
593 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
594 static const char *const yytname[] =
595 {
596 "\"end of file\"", "error", "\"invalid token\"", "DT_V1", "DT_PLUGIN",
597 "DT_MEMRESERVE", "DT_LSHIFT", "DT_RSHIFT", "DT_LE", "DT_GE", "DT_EQ",
598 "DT_NE", "DT_AND", "DT_OR", "DT_BITS", "DT_DEL_PROP", "DT_DEL_NODE",
599 "DT_OMIT_NO_REF", "DT_PROPNODENAME", "DT_LITERAL", "DT_CHAR_LITERAL",
600 "DT_BYTE", "DT_STRING", "DT_LABEL", "DT_LABEL_REF", "DT_PATH_REF",
601 "DT_INCBIN", "';'", "'/'", "'{'", "'}'", "'='", "'>'", "'['", "']'",
602 "'('", "','", "')'", "'<'", "'?'", "':'", "'|'", "'^'", "'&'", "'+'",
603 "'-'", "'*'", "'%'", "'~'", "'!'", "$accept", "sourcefile", "header",
604 "headers", "memreserves", "memreserve", "dt_ref", "devicetree",
605 "nodedef", "proplist", "propdef", "propdata", "propdataprefix",
606 "arrayprefix", "integer_prim", "integer_expr", "integer_trinary",
607 "integer_or", "integer_and", "integer_bitor", "integer_bitxor",
608 "integer_bitand", "integer_eq", "integer_rela", "integer_shift",
609 "integer_add", "integer_mul", "integer_unary", "bytestring", "subnodes",
610 "subnode", YY_NULLPTR
611 };
612
613 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)614 yysymbol_name (yysymbol_kind_t yysymbol)
615 {
616 return yytname[yysymbol];
617 }
618 #endif
619
620 #ifdef YYPRINT
621 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
622 (internal) symbol number NUM (which must be that of a token). */
623 static const yytype_int16 yytoknum[] =
624 {
625 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
626 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
627 275, 276, 277, 278, 279, 280, 281, 59, 47, 123,
628 125, 61, 62, 91, 93, 40, 44, 41, 60, 63,
629 58, 124, 94, 38, 43, 45, 42, 37, 126, 33
630 };
631 #endif
632
633 #define YYPACT_NINF (-46)
634
635 #define yypact_value_is_default(Yyn) \
636 ((Yyn) == YYPACT_NINF)
637
638 #define YYTABLE_NINF (-1)
639
640 #define yytable_value_is_error(Yyn) \
641 0
642
643 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
644 STATE-NUM. */
645 static const yytype_int8 yypact[] =
646 {
647 16, 13, 21, 16, 15, 40, -46, -46, -3, 15,
648 26, 15, 25, -46, -46, -6, -3, -46, -46, -46,
649 38, 38, 59, -46, -46, -6, -6, -6, -46, 35,
650 -46, 2, 69, 44, 55, 52, 68, -2, 100, 64,
651 -19, -46, 75, -46, -46, -46, 86, 86, 86, 38,
652 38, 38, -46, -46, -46, -46, -6, -6, -6, -6,
653 -6, -6, -6, -6, -6, -6, -6, -6, -6, -6,
654 -6, -6, -6, -6, -6, -46, 73, 85, 92, 38,
655 -46, -46, -46, 69, 60, 44, 55, 52, 68, -2,
656 -2, 100, 100, 100, 100, 64, 64, -19, -19, -46,
657 -46, -46, 104, 105, 76, 74, 73, -46, 94, 73,
658 -46, -46, -46, -6, 98, 99, 38, 76, -46, -46,
659 -46, -46, -46, -46, 101, -46, -46, -46, -46, -46,
660 -5, 23, -46, -46, -46, -46, 108, -46, -46, 95,
661 -46, -46, -46, 45, 66, 107, 32, -46, -46, -46,
662 -46, -46, 77, -46, -46, -46, -3, -46, 96, -3,
663 97, -46
664 };
665
666 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
667 Performed when YYTABLE does not specify something else to do. Zero
668 means the default is an error. */
669 static const yytype_int8 yydefact[] =
670 {
671 0, 0, 0, 5, 7, 3, 1, 6, 0, 0,
672 0, 7, 0, 43, 44, 0, 0, 10, 11, 12,
673 0, 0, 2, 8, 4, 0, 0, 0, 77, 0,
674 46, 47, 49, 51, 53, 55, 57, 59, 62, 69,
675 72, 76, 0, 22, 13, 15, 0, 0, 0, 0,
676 0, 0, 78, 79, 80, 45, 0, 0, 0, 0,
677 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
678 0, 0, 0, 0, 0, 9, 84, 0, 0, 0,
679 18, 17, 14, 50, 0, 52, 54, 56, 58, 60,
680 61, 65, 66, 64, 63, 67, 68, 70, 71, 74,
681 73, 75, 0, 0, 0, 0, 0, 23, 0, 84,
682 19, 20, 16, 0, 0, 0, 0, 0, 89, 25,
683 35, 87, 27, 90, 0, 86, 85, 48, 26, 88,
684 0, 0, 21, 34, 24, 36, 0, 28, 37, 0,
685 81, 39, 31, 0, 0, 0, 0, 42, 29, 41,
686 40, 38, 0, 82, 83, 30, 0, 33, 0, 0,
687 0, 32
688 };
689
690 /* YYPGOTO[NTERM-NUM]. */
691 static const yytype_int16 yypgoto[] =
692 {
693 -46, -46, -46, 128, 122, 127, -45, -46, -16, -46,
694 -35, -46, -46, -46, -8, 80, 27, -46, 82, 81,
695 83, 84, 88, 53, -41, 49, 50, -15, -46, 34,
696 -44
697 };
698
699 /* YYDEFGOTO[NTERM-NUM]. */
700 static const yytype_int16 yydefgoto[] =
701 {
702 -1, 2, 3, 4, 10, 11, 21, 22, 121, 76,
703 107, 130, 131, 143, 28, 29, 30, 31, 32, 33,
704 34, 35, 36, 37, 38, 39, 40, 41, 146, 108,
705 109
706 };
707
708 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
709 positive, shift that token. If negative, reduce the rule whose
710 number is the opposite. If YYTABLE_NINF, syntax error. */
711 static const yytype_uint8 yytable[] =
712 {
713 16, 77, 78, 79, 44, 45, 64, 65, 42, 72,
714 52, 53, 54, 13, 14, 56, 13, 14, 133, 1,
715 8, 6, 134, 91, 92, 93, 94, 73, 74, 15,
716 66, 135, 15, 80, 81, 82, 67, 136, 9, 25,
717 5, 57, 26, 27, 12, 137, 138, 18, 19, 139,
718 18, 19, 24, 153, 20, 154, 140, 99, 100, 101,
719 118, 141, 123, 112, 13, 14, 155, 43, 147, 18,
720 19, 122, 55, 123, 125, 46, 47, 148, 62, 63,
721 15, 58, 48, 49, 50, 59, 142, 51, 102, 103,
722 104, 105, 103, 104, 116, 61, 106, 60, 149, 117,
723 113, 119, 75, 43, 151, 120, 68, 69, 70, 71,
724 18, 19, 110, 156, 157, 89, 90, 95, 96, 111,
725 97, 98, 114, 115, 124, 128, 129, 144, 132, 152,
726 145, 7, 159, 23, 161, 150, 17, 84, 83, 85,
727 127, 0, 86, 126, 87, 0, 0, 0, 158, 88,
728 0, 160
729 };
730
731 static const yytype_int16 yycheck[] =
732 {
733 8, 46, 47, 48, 20, 21, 8, 9, 16, 28,
734 25, 26, 27, 19, 20, 13, 19, 20, 23, 3,
735 5, 0, 27, 64, 65, 66, 67, 46, 47, 35,
736 32, 36, 35, 49, 50, 51, 38, 14, 23, 45,
737 27, 39, 48, 49, 4, 22, 23, 24, 25, 26,
738 24, 25, 27, 21, 28, 23, 33, 72, 73, 74,
739 104, 38, 106, 79, 19, 20, 34, 29, 23, 24,
740 25, 106, 37, 117, 109, 16, 17, 32, 10, 11,
741 35, 12, 23, 24, 25, 41, 131, 28, 15, 16,
742 17, 18, 16, 17, 18, 43, 23, 42, 143, 23,
743 40, 27, 27, 29, 38, 31, 6, 7, 44, 45,
744 24, 25, 27, 36, 37, 62, 63, 68, 69, 27,
745 70, 71, 18, 18, 30, 27, 27, 19, 27, 22,
746 35, 3, 36, 11, 37, 143, 9, 57, 56, 58,
747 113, -1, 59, 109, 60, -1, -1, -1, 156, 61,
748 -1, 159
749 };
750
751 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
752 symbol of state STATE-NUM. */
753 static const yytype_int8 yystos[] =
754 {
755 0, 3, 51, 52, 53, 27, 0, 53, 5, 23,
756 54, 55, 4, 19, 20, 35, 64, 55, 24, 25,
757 28, 56, 57, 54, 27, 45, 48, 49, 64, 65,
758 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
759 76, 77, 64, 29, 58, 58, 16, 17, 23, 24,
760 25, 28, 77, 77, 77, 37, 13, 39, 12, 41,
761 42, 43, 10, 11, 8, 9, 32, 38, 6, 7,
762 44, 45, 28, 46, 47, 27, 59, 56, 56, 56,
763 58, 58, 58, 68, 65, 69, 70, 71, 72, 73,
764 73, 74, 74, 74, 74, 75, 75, 76, 76, 77,
765 77, 77, 15, 16, 17, 18, 23, 60, 79, 80,
766 27, 27, 58, 40, 18, 18, 18, 23, 80, 27,
767 31, 58, 60, 80, 30, 60, 79, 66, 27, 27,
768 61, 62, 27, 23, 27, 36, 14, 22, 23, 26,
769 33, 38, 56, 63, 19, 35, 78, 23, 32, 56,
770 64, 38, 22, 21, 23, 34, 36, 37, 64, 36,
771 64, 37
772 };
773
774 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
775 static const yytype_int8 yyr1[] =
776 {
777 0, 50, 51, 52, 52, 53, 53, 54, 54, 55,
778 55, 56, 56, 57, 57, 57, 57, 57, 57, 57,
779 57, 58, 59, 59, 60, 60, 60, 60, 61, 61,
780 61, 61, 61, 61, 61, 62, 62, 62, 63, 63,
781 63, 63, 63, 64, 64, 64, 65, 66, 66, 67,
782 67, 68, 68, 69, 69, 70, 70, 71, 71, 72,
783 72, 72, 73, 73, 73, 73, 73, 74, 74, 74,
784 75, 75, 75, 76, 76, 76, 76, 77, 77, 77,
785 77, 78, 78, 78, 79, 79, 79, 80, 80, 80,
786 80
787 };
788
789 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
790 static const yytype_int8 yyr2[] =
791 {
792 0, 2, 3, 2, 4, 1, 2, 0, 2, 4,
793 2, 1, 1, 2, 3, 2, 4, 3, 3, 4,
794 4, 5, 0, 2, 4, 2, 3, 2, 2, 3,
795 4, 2, 9, 5, 2, 0, 2, 2, 3, 1,
796 2, 2, 2, 1, 1, 3, 1, 1, 5, 1,
797 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
798 3, 3, 1, 3, 3, 3, 3, 3, 3, 1,
799 3, 3, 1, 3, 3, 3, 1, 1, 2, 2,
800 2, 0, 2, 2, 0, 2, 2, 2, 3, 2,
801 2
802 };
803
804
805 enum { YYENOMEM = -2 };
806
807 #define yyerrok (yyerrstatus = 0)
808 #define yyclearin (yychar = YYEMPTY)
809
810 #define YYACCEPT goto yyacceptlab
811 #define YYABORT goto yyabortlab
812 #define YYERROR goto yyerrorlab
813
814
815 #define YYRECOVERING() (!!yyerrstatus)
816
817 #define YYBACKUP(Token, Value) \
818 do \
819 if (yychar == YYEMPTY) \
820 { \
821 yychar = (Token); \
822 yylval = (Value); \
823 YYPOPSTACK (yylen); \
824 yystate = *yyssp; \
825 goto yybackup; \
826 } \
827 else \
828 { \
829 yyerror (YY_("syntax error: cannot back up")); \
830 YYERROR; \
831 } \
832 while (0)
833
834 /* Backward compatibility with an undocumented macro.
835 Use YYerror or YYUNDEF. */
836 #define YYERRCODE YYUNDEF
837
838 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
839 If N is 0, then set CURRENT to the empty location which ends
840 the previous symbol: RHS[0] (always defined). */
841
842 #ifndef YYLLOC_DEFAULT
843 # define YYLLOC_DEFAULT(Current, Rhs, N) \
844 do \
845 if (N) \
846 { \
847 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
848 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
849 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
850 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
851 } \
852 else \
853 { \
854 (Current).first_line = (Current).last_line = \
855 YYRHSLOC (Rhs, 0).last_line; \
856 (Current).first_column = (Current).last_column = \
857 YYRHSLOC (Rhs, 0).last_column; \
858 } \
859 while (0)
860 #endif
861
862 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
863
864
865 /* Enable debugging if requested. */
866 #if YYDEBUG
867
868 # ifndef YYFPRINTF
869 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
870 # define YYFPRINTF fprintf
871 # endif
872
873 # define YYDPRINTF(Args) \
874 do { \
875 if (yydebug) \
876 YYFPRINTF Args; \
877 } while (0)
878
879
880 /* YY_LOCATION_PRINT -- Print the location on the stream.
881 This macro was not mandated originally: define only if we know
882 we won't break user code: when these are the locations we know. */
883
884 # ifndef YY_LOCATION_PRINT
885 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
886
887 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
888
889 YY_ATTRIBUTE_UNUSED
890 static int
yy_location_print_(FILE * yyo,YYLTYPE const * const yylocp)891 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
892 {
893 int res = 0;
894 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
895 if (0 <= yylocp->first_line)
896 {
897 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
898 if (0 <= yylocp->first_column)
899 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
900 }
901 if (0 <= yylocp->last_line)
902 {
903 if (yylocp->first_line < yylocp->last_line)
904 {
905 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
906 if (0 <= end_col)
907 res += YYFPRINTF (yyo, ".%d", end_col);
908 }
909 else if (0 <= end_col && yylocp->first_column < end_col)
910 res += YYFPRINTF (yyo, "-%d", end_col);
911 }
912 return res;
913 }
914
915 # define YY_LOCATION_PRINT(File, Loc) \
916 yy_location_print_ (File, &(Loc))
917
918 # else
919 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
920 # endif
921 # endif /* !defined YY_LOCATION_PRINT */
922
923
924 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
925 do { \
926 if (yydebug) \
927 { \
928 YYFPRINTF (stderr, "%s ", Title); \
929 yy_symbol_print (stderr, \
930 Kind, Value, Location); \
931 YYFPRINTF (stderr, "\n"); \
932 } \
933 } while (0)
934
935
936 /*-----------------------------------.
937 | Print this symbol's value on YYO. |
938 `-----------------------------------*/
939
940 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp)941 yy_symbol_value_print (FILE *yyo,
942 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
943 {
944 FILE *yyoutput = yyo;
945 YYUSE (yyoutput);
946 YYUSE (yylocationp);
947 if (!yyvaluep)
948 return;
949 # ifdef YYPRINT
950 if (yykind < YYNTOKENS)
951 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
952 # endif
953 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
954 YYUSE (yykind);
955 YY_IGNORE_MAYBE_UNINITIALIZED_END
956 }
957
958
959 /*---------------------------.
960 | Print this symbol on YYO. |
961 `---------------------------*/
962
963 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp)964 yy_symbol_print (FILE *yyo,
965 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
966 {
967 YYFPRINTF (yyo, "%s %s (",
968 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
969
970 YY_LOCATION_PRINT (yyo, *yylocationp);
971 YYFPRINTF (yyo, ": ");
972 yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp);
973 YYFPRINTF (yyo, ")");
974 }
975
976 /*------------------------------------------------------------------.
977 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
978 | TOP (included). |
979 `------------------------------------------------------------------*/
980
981 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)982 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
983 {
984 YYFPRINTF (stderr, "Stack now");
985 for (; yybottom <= yytop; yybottom++)
986 {
987 int yybot = *yybottom;
988 YYFPRINTF (stderr, " %d", yybot);
989 }
990 YYFPRINTF (stderr, "\n");
991 }
992
993 # define YY_STACK_PRINT(Bottom, Top) \
994 do { \
995 if (yydebug) \
996 yy_stack_print ((Bottom), (Top)); \
997 } while (0)
998
999
1000 /*------------------------------------------------.
1001 | Report that the YYRULE is going to be reduced. |
1002 `------------------------------------------------*/
1003
1004 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,YYLTYPE * yylsp,int yyrule)1005 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
1006 int yyrule)
1007 {
1008 int yylno = yyrline[yyrule];
1009 int yynrhs = yyr2[yyrule];
1010 int yyi;
1011 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1012 yyrule - 1, yylno);
1013 /* The symbols being reduced. */
1014 for (yyi = 0; yyi < yynrhs; yyi++)
1015 {
1016 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1017 yy_symbol_print (stderr,
1018 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1019 &yyvsp[(yyi + 1) - (yynrhs)],
1020 &(yylsp[(yyi + 1) - (yynrhs)]));
1021 YYFPRINTF (stderr, "\n");
1022 }
1023 }
1024
1025 # define YY_REDUCE_PRINT(Rule) \
1026 do { \
1027 if (yydebug) \
1028 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1029 } while (0)
1030
1031 /* Nonzero means print parse trace. It is left uninitialized so that
1032 multiple parsers can coexist. */
1033 int yydebug;
1034 #else /* !YYDEBUG */
1035 # define YYDPRINTF(Args) ((void) 0)
1036 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1037 # define YY_STACK_PRINT(Bottom, Top)
1038 # define YY_REDUCE_PRINT(Rule)
1039 #endif /* !YYDEBUG */
1040
1041
1042 /* YYINITDEPTH -- initial size of the parser's stacks. */
1043 #ifndef YYINITDEPTH
1044 # define YYINITDEPTH 200
1045 #endif
1046
1047 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1048 if the built-in stack extension method is used).
1049
1050 Do not make this value too large; the results are undefined if
1051 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1052 evaluated with infinite-precision integer arithmetic. */
1053
1054 #ifndef YYMAXDEPTH
1055 # define YYMAXDEPTH 10000
1056 #endif
1057
1058
1059
1060
1061
1062
1063 /*-----------------------------------------------.
1064 | Release the memory associated to this symbol. |
1065 `-----------------------------------------------*/
1066
1067 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep,YYLTYPE * yylocationp)1068 yydestruct (const char *yymsg,
1069 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1070 {
1071 YYUSE (yyvaluep);
1072 YYUSE (yylocationp);
1073 if (!yymsg)
1074 yymsg = "Deleting";
1075 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1076
1077 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1078 YYUSE (yykind);
1079 YY_IGNORE_MAYBE_UNINITIALIZED_END
1080 }
1081
1082
1083 /* Lookahead token kind. */
1084 int yychar;
1085
1086 /* The semantic value of the lookahead symbol. */
1087 YYSTYPE yylval;
1088 /* Location data for the lookahead symbol. */
1089 YYLTYPE yylloc
1090 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1091 = { 1, 1, 1, 1 }
1092 # endif
1093 ;
1094 /* Number of syntax errors so far. */
1095 int yynerrs;
1096
1097
1098
1099
1100 /*----------.
1101 | yyparse. |
1102 `----------*/
1103
1104 int
yyparse(void)1105 yyparse (void)
1106 {
1107 yy_state_fast_t yystate = 0;
1108 /* Number of tokens to shift before error messages enabled. */
1109 int yyerrstatus = 0;
1110
1111 /* Refer to the stacks through separate pointers, to allow yyoverflow
1112 to reallocate them elsewhere. */
1113
1114 /* Their size. */
1115 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1116
1117 /* The state stack: array, bottom, top. */
1118 yy_state_t yyssa[YYINITDEPTH];
1119 yy_state_t *yyss = yyssa;
1120 yy_state_t *yyssp = yyss;
1121
1122 /* The semantic value stack: array, bottom, top. */
1123 YYSTYPE yyvsa[YYINITDEPTH];
1124 YYSTYPE *yyvs = yyvsa;
1125 YYSTYPE *yyvsp = yyvs;
1126
1127 /* The location stack: array, bottom, top. */
1128 YYLTYPE yylsa[YYINITDEPTH];
1129 YYLTYPE *yyls = yylsa;
1130 YYLTYPE *yylsp = yyls;
1131
1132 int yyn;
1133 /* The return value of yyparse. */
1134 int yyresult;
1135 /* Lookahead symbol kind. */
1136 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1137 /* The variables used to return semantic value and location from the
1138 action routines. */
1139 YYSTYPE yyval;
1140 YYLTYPE yyloc;
1141
1142 /* The locations where the error started and ended. */
1143 YYLTYPE yyerror_range[3];
1144
1145
1146
1147 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1148
1149 /* The number of symbols on the RHS of the reduced rule.
1150 Keep to zero when no symbol should be popped. */
1151 int yylen = 0;
1152
1153 YYDPRINTF ((stderr, "Starting parse\n"));
1154
1155 yychar = YYEMPTY; /* Cause a token to be read. */
1156 yylsp[0] = yylloc;
1157 goto yysetstate;
1158
1159
1160 /*------------------------------------------------------------.
1161 | yynewstate -- push a new state, which is found in yystate. |
1162 `------------------------------------------------------------*/
1163 yynewstate:
1164 /* In all cases, when you get here, the value and location stacks
1165 have just been pushed. So pushing a state here evens the stacks. */
1166 yyssp++;
1167
1168
1169 /*--------------------------------------------------------------------.
1170 | yysetstate -- set current state (the top of the stack) to yystate. |
1171 `--------------------------------------------------------------------*/
1172 yysetstate:
1173 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1174 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1175 YY_IGNORE_USELESS_CAST_BEGIN
1176 *yyssp = YY_CAST (yy_state_t, yystate);
1177 YY_IGNORE_USELESS_CAST_END
1178 YY_STACK_PRINT (yyss, yyssp);
1179
1180 if (yyss + yystacksize - 1 <= yyssp)
1181 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1182 goto yyexhaustedlab;
1183 #else
1184 {
1185 /* Get the current used size of the three stacks, in elements. */
1186 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1187
1188 # if defined yyoverflow
1189 {
1190 /* Give user a chance to reallocate the stack. Use copies of
1191 these so that the &'s don't force the real ones into
1192 memory. */
1193 yy_state_t *yyss1 = yyss;
1194 YYSTYPE *yyvs1 = yyvs;
1195 YYLTYPE *yyls1 = yyls;
1196
1197 /* Each stack pointer address is followed by the size of the
1198 data in use in that stack, in bytes. This used to be a
1199 conditional around just the two extra args, but that might
1200 be undefined if yyoverflow is a macro. */
1201 yyoverflow (YY_("memory exhausted"),
1202 &yyss1, yysize * YYSIZEOF (*yyssp),
1203 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1204 &yyls1, yysize * YYSIZEOF (*yylsp),
1205 &yystacksize);
1206 yyss = yyss1;
1207 yyvs = yyvs1;
1208 yyls = yyls1;
1209 }
1210 # else /* defined YYSTACK_RELOCATE */
1211 /* Extend the stack our own way. */
1212 if (YYMAXDEPTH <= yystacksize)
1213 goto yyexhaustedlab;
1214 yystacksize *= 2;
1215 if (YYMAXDEPTH < yystacksize)
1216 yystacksize = YYMAXDEPTH;
1217
1218 {
1219 yy_state_t *yyss1 = yyss;
1220 union yyalloc *yyptr =
1221 YY_CAST (union yyalloc *,
1222 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1223 if (! yyptr)
1224 goto yyexhaustedlab;
1225 YYSTACK_RELOCATE (yyss_alloc, yyss);
1226 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1227 YYSTACK_RELOCATE (yyls_alloc, yyls);
1228 # undef YYSTACK_RELOCATE
1229 if (yyss1 != yyssa)
1230 YYSTACK_FREE (yyss1);
1231 }
1232 # endif
1233
1234 yyssp = yyss + yysize - 1;
1235 yyvsp = yyvs + yysize - 1;
1236 yylsp = yyls + yysize - 1;
1237
1238 YY_IGNORE_USELESS_CAST_BEGIN
1239 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1240 YY_CAST (long, yystacksize)));
1241 YY_IGNORE_USELESS_CAST_END
1242
1243 if (yyss + yystacksize - 1 <= yyssp)
1244 YYABORT;
1245 }
1246 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1247
1248 if (yystate == YYFINAL)
1249 YYACCEPT;
1250
1251 goto yybackup;
1252
1253
1254 /*-----------.
1255 | yybackup. |
1256 `-----------*/
1257 yybackup:
1258 /* Do appropriate processing given the current state. Read a
1259 lookahead token if we need one and don't already have one. */
1260
1261 /* First try to decide what to do without reference to lookahead token. */
1262 yyn = yypact[yystate];
1263 if (yypact_value_is_default (yyn))
1264 goto yydefault;
1265
1266 /* Not known => get a lookahead token if don't already have one. */
1267
1268 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1269 if (yychar == YYEMPTY)
1270 {
1271 YYDPRINTF ((stderr, "Reading a token\n"));
1272 yychar = yylex ();
1273 }
1274
1275 if (yychar <= YYEOF)
1276 {
1277 yychar = YYEOF;
1278 yytoken = YYSYMBOL_YYEOF;
1279 YYDPRINTF ((stderr, "Now at end of input.\n"));
1280 }
1281 else if (yychar == YYerror)
1282 {
1283 /* The scanner already issued an error message, process directly
1284 to error recovery. But do not keep the error token as
1285 lookahead, it is too special and may lead us to an endless
1286 loop in error recovery. */
1287 yychar = YYUNDEF;
1288 yytoken = YYSYMBOL_YYerror;
1289 yyerror_range[1] = yylloc;
1290 goto yyerrlab1;
1291 }
1292 else
1293 {
1294 yytoken = YYTRANSLATE (yychar);
1295 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1296 }
1297
1298 /* If the proper action on seeing token YYTOKEN is to reduce or to
1299 detect an error, take that action. */
1300 yyn += yytoken;
1301 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1302 goto yydefault;
1303 yyn = yytable[yyn];
1304 if (yyn <= 0)
1305 {
1306 if (yytable_value_is_error (yyn))
1307 goto yyerrlab;
1308 yyn = -yyn;
1309 goto yyreduce;
1310 }
1311
1312 /* Count tokens shifted since error; after three, turn off error
1313 status. */
1314 if (yyerrstatus)
1315 yyerrstatus--;
1316
1317 /* Shift the lookahead token. */
1318 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1319 yystate = yyn;
1320 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1321 *++yyvsp = yylval;
1322 YY_IGNORE_MAYBE_UNINITIALIZED_END
1323 *++yylsp = yylloc;
1324
1325 /* Discard the shifted token. */
1326 yychar = YYEMPTY;
1327 goto yynewstate;
1328
1329
1330 /*-----------------------------------------------------------.
1331 | yydefault -- do the default action for the current state. |
1332 `-----------------------------------------------------------*/
1333 yydefault:
1334 yyn = yydefact[yystate];
1335 if (yyn == 0)
1336 goto yyerrlab;
1337 goto yyreduce;
1338
1339
1340 /*-----------------------------.
1341 | yyreduce -- do a reduction. |
1342 `-----------------------------*/
1343 yyreduce:
1344 /* yyn is the number of a rule to reduce with. */
1345 yylen = yyr2[yyn];
1346
1347 /* If YYLEN is nonzero, implement the default value of the action:
1348 '$$ = $1'.
1349
1350 Otherwise, the following line sets YYVAL to garbage.
1351 This behavior is undocumented and Bison
1352 users should not rely upon it. Assigning to YYVAL
1353 unconditionally makes the parser a bit smaller, and it avoids a
1354 GCC warning that YYVAL may be used uninitialized. */
1355 yyval = yyvsp[1-yylen];
1356
1357 /* Default location. */
1358 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1359 yyerror_range[1] = yyloc;
1360 YY_REDUCE_PRINT (yyn);
1361 switch (yyn)
1362 {
1363 case 2: /* sourcefile: headers memreserves devicetree */
1364 {
1365 parser_output = build_dt_info((yyvsp[-2].flags), (yyvsp[-1].re), (yyvsp[0].node),
1366 guess_boot_cpuid((yyvsp[0].node)));
1367 }
1368 break;
1369
1370 case 3: /* header: DT_V1 ';' */
1371 {
1372 (yyval.flags) = DTSF_V1;
1373 }
1374 break;
1375
1376 case 4: /* header: DT_V1 ';' DT_PLUGIN ';' */
1377 {
1378 (yyval.flags) = DTSF_V1 | DTSF_PLUGIN;
1379 }
1380 break;
1381
1382 case 6: /* headers: header headers */
1383 {
1384 if ((yyvsp[0].flags) != (yyvsp[-1].flags))
1385 ERROR(&(yylsp[0]), "Header flags don't match earlier ones");
1386 (yyval.flags) = (yyvsp[-1].flags);
1387 }
1388 break;
1389
1390 case 7: /* memreserves: %empty */
1391 {
1392 (yyval.re) = NULL;
1393 }
1394 break;
1395
1396 case 8: /* memreserves: memreserve memreserves */
1397 {
1398 (yyval.re) = chain_reserve_entry((yyvsp[-1].re), (yyvsp[0].re));
1399 }
1400 break;
1401
1402 case 9: /* memreserve: DT_MEMRESERVE integer_prim integer_prim ';' */
1403 {
1404 (yyval.re) = build_reserve_entry((yyvsp[-2].integer), (yyvsp[-1].integer));
1405 }
1406 break;
1407
1408 case 10: /* memreserve: DT_LABEL memreserve */
1409 {
1410 add_label(&(yyvsp[0].re)->labels, (yyvsp[-1].labelref));
1411 (yyval.re) = (yyvsp[0].re);
1412 }
1413 break;
1414
1415 case 13: /* devicetree: '/' nodedef */
1416 {
1417 (yyval.node) = name_node((yyvsp[0].node), "");
1418 }
1419 break;
1420
1421 case 14: /* devicetree: devicetree '/' nodedef */
1422 {
1423 (yyval.node) = merge_nodes((yyvsp[-2].node), (yyvsp[0].node));
1424 }
1425 break;
1426
1427 case 15: /* devicetree: dt_ref nodedef */
1428 {
1429 /*
1430 * We rely on the rule being always:
1431 * versioninfo plugindecl memreserves devicetree
1432 * so $-1 is what we want (plugindecl)
1433 */
1434 if (!((yyvsp[(-1) - (2)].flags) & DTSF_PLUGIN))
1435 ERROR(&(yylsp[0]), "Label or path %s not found", (yyvsp[-1].labelref));
1436 (yyval.node) = add_orphan_node(
1437 name_node(build_node(NULL, NULL, NULL),
1438 ""),
1439 (yyvsp[0].node), (yyvsp[-1].labelref));
1440 }
1441 break;
1442
1443 case 16: /* devicetree: devicetree DT_LABEL dt_ref nodedef */
1444 {
1445 struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
1446
1447 if (target) {
1448 add_label(&target->labels, (yyvsp[-2].labelref));
1449 merge_nodes(target, (yyvsp[0].node));
1450 } else
1451 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
1452 (yyval.node) = (yyvsp[-3].node);
1453 }
1454 break;
1455
1456 case 17: /* devicetree: devicetree DT_PATH_REF nodedef */
1457 {
1458 /*
1459 * We rely on the rule being always:
1460 * versioninfo plugindecl memreserves devicetree
1461 * so $-1 is what we want (plugindecl)
1462 */
1463 if ((yyvsp[(-1) - (3)].flags) & DTSF_PLUGIN) {
1464 add_orphan_node((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].labelref));
1465 } else {
1466 struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
1467
1468 if (target)
1469 merge_nodes(target, (yyvsp[0].node));
1470 else
1471 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
1472 }
1473 (yyval.node) = (yyvsp[-2].node);
1474 }
1475 break;
1476
1477 case 18: /* devicetree: devicetree DT_LABEL_REF nodedef */
1478 {
1479 struct node *target = get_node_by_ref((yyvsp[-2].node), (yyvsp[-1].labelref));
1480
1481 if (target) {
1482 merge_nodes(target, (yyvsp[0].node));
1483 } else {
1484 /*
1485 * We rely on the rule being always:
1486 * versioninfo plugindecl memreserves devicetree
1487 * so $-1 is what we want (plugindecl)
1488 */
1489 if ((yyvsp[(-1) - (3)].flags) & DTSF_PLUGIN)
1490 add_orphan_node((yyvsp[-2].node), (yyvsp[0].node), (yyvsp[-1].labelref));
1491 else
1492 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
1493 }
1494 (yyval.node) = (yyvsp[-2].node);
1495 }
1496 break;
1497
1498 case 19: /* devicetree: devicetree DT_DEL_NODE dt_ref ';' */
1499 {
1500 struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
1501
1502 if (target)
1503 delete_node(target);
1504 else
1505 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
1506
1507
1508 (yyval.node) = (yyvsp[-3].node);
1509 }
1510 break;
1511
1512 case 20: /* devicetree: devicetree DT_OMIT_NO_REF dt_ref ';' */
1513 {
1514 struct node *target = get_node_by_ref((yyvsp[-3].node), (yyvsp[-1].labelref));
1515
1516 if (target)
1517 omit_node_if_unused(target);
1518 else
1519 ERROR(&(yylsp[-1]), "Label or path %s not found", (yyvsp[-1].labelref));
1520
1521
1522 (yyval.node) = (yyvsp[-3].node);
1523 }
1524 break;
1525
1526 case 21: /* nodedef: '{' proplist subnodes '}' ';' */
1527 {
1528 (yyval.node) = build_node((yyvsp[-3].proplist), (yyvsp[-2].nodelist), &(yyloc));
1529 }
1530 break;
1531
1532 case 22: /* proplist: %empty */
1533 {
1534 (yyval.proplist) = NULL;
1535 }
1536 break;
1537
1538 case 23: /* proplist: proplist propdef */
1539 {
1540 (yyval.proplist) = chain_property((yyvsp[0].prop), (yyvsp[-1].proplist));
1541 }
1542 break;
1543
1544 case 24: /* propdef: DT_PROPNODENAME '=' propdata ';' */
1545 {
1546 (yyval.prop) = build_property((yyvsp[-3].propnodename), (yyvsp[-1].data), &(yyloc));
1547 }
1548 break;
1549
1550 case 25: /* propdef: DT_PROPNODENAME ';' */
1551 {
1552 (yyval.prop) = build_property((yyvsp[-1].propnodename), empty_data, &(yyloc));
1553 }
1554 break;
1555
1556 case 26: /* propdef: DT_DEL_PROP DT_PROPNODENAME ';' */
1557 {
1558 (yyval.prop) = build_property_delete((yyvsp[-1].propnodename));
1559 }
1560 break;
1561
1562 case 27: /* propdef: DT_LABEL propdef */
1563 {
1564 add_label(&(yyvsp[0].prop)->labels, (yyvsp[-1].labelref));
1565 (yyval.prop) = (yyvsp[0].prop);
1566 }
1567 break;
1568
1569 case 28: /* propdata: propdataprefix DT_STRING */
1570 {
1571 (yyval.data) = data_merge((yyvsp[-1].data), (yyvsp[0].data));
1572 }
1573 break;
1574
1575 case 29: /* propdata: propdataprefix arrayprefix '>' */
1576 {
1577 (yyval.data) = data_merge((yyvsp[-2].data), (yyvsp[-1].array).data);
1578 }
1579 break;
1580
1581 case 30: /* propdata: propdataprefix '[' bytestring ']' */
1582 {
1583 (yyval.data) = data_merge((yyvsp[-3].data), (yyvsp[-1].data));
1584 }
1585 break;
1586
1587 case 31: /* propdata: propdataprefix dt_ref */
1588 {
1589 (yyvsp[-1].data) = data_add_marker((yyvsp[-1].data), TYPE_STRING, (yyvsp[0].labelref));
1590 (yyval.data) = data_add_marker((yyvsp[-1].data), REF_PATH, (yyvsp[0].labelref));
1591 }
1592 break;
1593
1594 case 32: /* propdata: propdataprefix DT_INCBIN '(' DT_STRING ',' integer_prim ',' integer_prim ')' */
1595 {
1596 FILE *f = srcfile_relative_open((yyvsp[-5].data).val, NULL);
1597 struct data d;
1598
1599 if ((yyvsp[-3].integer) != 0)
1600 if (fseek(f, (yyvsp[-3].integer), SEEK_SET) != 0)
1601 die("Couldn't seek to offset %llu in \"%s\": %s",
1602 (unsigned long long)(yyvsp[-3].integer), (yyvsp[-5].data).val,
1603 strerror(errno));
1604
1605 d = data_copy_file(f, (yyvsp[-1].integer));
1606
1607 (yyval.data) = data_merge((yyvsp[-8].data), d);
1608 fclose(f);
1609 }
1610 break;
1611
1612 case 33: /* propdata: propdataprefix DT_INCBIN '(' DT_STRING ')' */
1613 {
1614 FILE *f = srcfile_relative_open((yyvsp[-1].data).val, NULL);
1615 struct data d = empty_data;
1616
1617 d = data_copy_file(f, -1);
1618
1619 (yyval.data) = data_merge((yyvsp[-4].data), d);
1620 fclose(f);
1621 }
1622 break;
1623
1624 case 34: /* propdata: propdata DT_LABEL */
1625 {
1626 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
1627 }
1628 break;
1629
1630 case 35: /* propdataprefix: %empty */
1631 {
1632 (yyval.data) = empty_data;
1633 }
1634 break;
1635
1636 case 36: /* propdataprefix: propdata ',' */
1637 {
1638 (yyval.data) = (yyvsp[-1].data);
1639 }
1640 break;
1641
1642 case 37: /* propdataprefix: propdataprefix DT_LABEL */
1643 {
1644 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
1645 }
1646 break;
1647
1648 case 38: /* arrayprefix: DT_BITS DT_LITERAL '<' */
1649 {
1650 unsigned long long bits;
1651 enum markertype type = TYPE_UINT32;
1652
1653 bits = (yyvsp[-1].integer);
1654
1655 switch (bits) {
1656 case 8: type = TYPE_UINT8; break;
1657 case 16: type = TYPE_UINT16; break;
1658 case 32: type = TYPE_UINT32; break;
1659 case 64: type = TYPE_UINT64; break;
1660 default:
1661 ERROR(&(yylsp[-1]), "Array elements must be"
1662 " 8, 16, 32 or 64-bits");
1663 bits = 32;
1664 }
1665
1666 (yyval.array).data = data_add_marker(empty_data, type, NULL);
1667 (yyval.array).bits = bits;
1668 }
1669 break;
1670
1671 case 39: /* arrayprefix: '<' */
1672 {
1673 (yyval.array).data = data_add_marker(empty_data, TYPE_UINT32, NULL);
1674 (yyval.array).bits = 32;
1675 }
1676 break;
1677
1678 case 40: /* arrayprefix: arrayprefix integer_prim */
1679 {
1680 if ((yyvsp[-1].array).bits < 64) {
1681 uint64_t mask = (1ULL << (yyvsp[-1].array).bits) - 1;
1682 /*
1683 * Bits above mask must either be all zero
1684 * (positive within range of mask) or all one
1685 * (negative and sign-extended). The second
1686 * condition is true if when we set all bits
1687 * within the mask to one (i.e. | in the
1688 * mask), all bits are one.
1689 */
1690 if (((yyvsp[0].integer) > mask) && (((yyvsp[0].integer) | mask) != -1ULL))
1691 ERROR(&(yylsp[0]), "Value out of range for"
1692 " %d-bit array element", (yyvsp[-1].array).bits);
1693 }
1694
1695 (yyval.array).data = data_append_integer((yyvsp[-1].array).data, (yyvsp[0].integer), (yyvsp[-1].array).bits);
1696 }
1697 break;
1698
1699 case 41: /* arrayprefix: arrayprefix dt_ref */
1700 {
1701 uint64_t val = ~0ULL >> (64 - (yyvsp[-1].array).bits);
1702
1703 if ((yyvsp[-1].array).bits == 32)
1704 (yyvsp[-1].array).data = data_add_marker((yyvsp[-1].array).data,
1705 REF_PHANDLE,
1706 (yyvsp[0].labelref));
1707 else
1708 ERROR(&(yylsp[0]), "References are only allowed in "
1709 "arrays with 32-bit elements.");
1710
1711 (yyval.array).data = data_append_integer((yyvsp[-1].array).data, val, (yyvsp[-1].array).bits);
1712 }
1713 break;
1714
1715 case 42: /* arrayprefix: arrayprefix DT_LABEL */
1716 {
1717 (yyval.array).data = data_add_marker((yyvsp[-1].array).data, LABEL, (yyvsp[0].labelref));
1718 }
1719 break;
1720
1721 case 45: /* integer_prim: '(' integer_expr ')' */
1722 {
1723 (yyval.integer) = (yyvsp[-1].integer);
1724 }
1725 break;
1726
1727 case 48: /* integer_trinary: integer_or '?' integer_expr ':' integer_trinary */
1728 { (yyval.integer) = (yyvsp[-4].integer) ? (yyvsp[-2].integer) : (yyvsp[0].integer); }
1729 break;
1730
1731 case 50: /* integer_or: integer_or DT_OR integer_and */
1732 { (yyval.integer) = (yyvsp[-2].integer) || (yyvsp[0].integer); }
1733 break;
1734
1735 case 52: /* integer_and: integer_and DT_AND integer_bitor */
1736 { (yyval.integer) = (yyvsp[-2].integer) && (yyvsp[0].integer); }
1737 break;
1738
1739 case 54: /* integer_bitor: integer_bitor '|' integer_bitxor */
1740 { (yyval.integer) = (yyvsp[-2].integer) | (yyvsp[0].integer); }
1741 break;
1742
1743 case 56: /* integer_bitxor: integer_bitxor '^' integer_bitand */
1744 { (yyval.integer) = (yyvsp[-2].integer) ^ (yyvsp[0].integer); }
1745 break;
1746
1747 case 58: /* integer_bitand: integer_bitand '&' integer_eq */
1748 { (yyval.integer) = (yyvsp[-2].integer) & (yyvsp[0].integer); }
1749 break;
1750
1751 case 60: /* integer_eq: integer_eq DT_EQ integer_rela */
1752 { (yyval.integer) = (yyvsp[-2].integer) == (yyvsp[0].integer); }
1753 break;
1754
1755 case 61: /* integer_eq: integer_eq DT_NE integer_rela */
1756 { (yyval.integer) = (yyvsp[-2].integer) != (yyvsp[0].integer); }
1757 break;
1758
1759 case 63: /* integer_rela: integer_rela '<' integer_shift */
1760 { (yyval.integer) = (yyvsp[-2].integer) < (yyvsp[0].integer); }
1761 break;
1762
1763 case 64: /* integer_rela: integer_rela '>' integer_shift */
1764 { (yyval.integer) = (yyvsp[-2].integer) > (yyvsp[0].integer); }
1765 break;
1766
1767 case 65: /* integer_rela: integer_rela DT_LE integer_shift */
1768 { (yyval.integer) = (yyvsp[-2].integer) <= (yyvsp[0].integer); }
1769 break;
1770
1771 case 66: /* integer_rela: integer_rela DT_GE integer_shift */
1772 { (yyval.integer) = (yyvsp[-2].integer) >= (yyvsp[0].integer); }
1773 break;
1774
1775 case 67: /* integer_shift: integer_shift DT_LSHIFT integer_add */
1776 { (yyval.integer) = ((yyvsp[0].integer) < 64) ? ((yyvsp[-2].integer) << (yyvsp[0].integer)) : 0; }
1777 break;
1778
1779 case 68: /* integer_shift: integer_shift DT_RSHIFT integer_add */
1780 { (yyval.integer) = ((yyvsp[0].integer) < 64) ? ((yyvsp[-2].integer) >> (yyvsp[0].integer)) : 0; }
1781 break;
1782
1783 case 70: /* integer_add: integer_add '+' integer_mul */
1784 { (yyval.integer) = (yyvsp[-2].integer) + (yyvsp[0].integer); }
1785 break;
1786
1787 case 71: /* integer_add: integer_add '-' integer_mul */
1788 { (yyval.integer) = (yyvsp[-2].integer) - (yyvsp[0].integer); }
1789 break;
1790
1791 case 73: /* integer_mul: integer_mul '*' integer_unary */
1792 { (yyval.integer) = (yyvsp[-2].integer) * (yyvsp[0].integer); }
1793 break;
1794
1795 case 74: /* integer_mul: integer_mul '/' integer_unary */
1796 {
1797 if ((yyvsp[0].integer) != 0) {
1798 (yyval.integer) = (yyvsp[-2].integer) / (yyvsp[0].integer);
1799 } else {
1800 ERROR(&(yyloc), "Division by zero");
1801 (yyval.integer) = 0;
1802 }
1803 }
1804 break;
1805
1806 case 75: /* integer_mul: integer_mul '%' integer_unary */
1807 {
1808 if ((yyvsp[0].integer) != 0) {
1809 (yyval.integer) = (yyvsp[-2].integer) % (yyvsp[0].integer);
1810 } else {
1811 ERROR(&(yyloc), "Division by zero");
1812 (yyval.integer) = 0;
1813 }
1814 }
1815 break;
1816
1817 case 78: /* integer_unary: '-' integer_unary */
1818 { (yyval.integer) = -(yyvsp[0].integer); }
1819 break;
1820
1821 case 79: /* integer_unary: '~' integer_unary */
1822 { (yyval.integer) = ~(yyvsp[0].integer); }
1823 break;
1824
1825 case 80: /* integer_unary: '!' integer_unary */
1826 { (yyval.integer) = !(yyvsp[0].integer); }
1827 break;
1828
1829 case 81: /* bytestring: %empty */
1830 {
1831 (yyval.data) = data_add_marker(empty_data, TYPE_UINT8, NULL);
1832 }
1833 break;
1834
1835 case 82: /* bytestring: bytestring DT_BYTE */
1836 {
1837 (yyval.data) = data_append_byte((yyvsp[-1].data), (yyvsp[0].byte));
1838 }
1839 break;
1840
1841 case 83: /* bytestring: bytestring DT_LABEL */
1842 {
1843 (yyval.data) = data_add_marker((yyvsp[-1].data), LABEL, (yyvsp[0].labelref));
1844 }
1845 break;
1846
1847 case 84: /* subnodes: %empty */
1848 {
1849 (yyval.nodelist) = NULL;
1850 }
1851 break;
1852
1853 case 85: /* subnodes: subnode subnodes */
1854 {
1855 (yyval.nodelist) = chain_node((yyvsp[-1].node), (yyvsp[0].nodelist));
1856 }
1857 break;
1858
1859 case 86: /* subnodes: subnode propdef */
1860 {
1861 ERROR(&(yylsp[0]), "Properties must precede subnodes");
1862 YYERROR;
1863 }
1864 break;
1865
1866 case 87: /* subnode: DT_PROPNODENAME nodedef */
1867 {
1868 (yyval.node) = name_node((yyvsp[0].node), (yyvsp[-1].propnodename));
1869 }
1870 break;
1871
1872 case 88: /* subnode: DT_DEL_NODE DT_PROPNODENAME ';' */
1873 {
1874 (yyval.node) = name_node(build_node_delete(&(yyloc)), (yyvsp[-1].propnodename));
1875 }
1876 break;
1877
1878 case 89: /* subnode: DT_OMIT_NO_REF subnode */
1879 {
1880 (yyval.node) = omit_node_if_unused((yyvsp[0].node));
1881 }
1882 break;
1883
1884 case 90: /* subnode: DT_LABEL subnode */
1885 {
1886 add_label(&(yyvsp[0].node)->labels, (yyvsp[-1].labelref));
1887 (yyval.node) = (yyvsp[0].node);
1888 }
1889 break;
1890
1891
1892
1893 default: break;
1894 }
1895 /* User semantic actions sometimes alter yychar, and that requires
1896 that yytoken be updated with the new translation. We take the
1897 approach of translating immediately before every use of yytoken.
1898 One alternative is translating here after every semantic action,
1899 but that translation would be missed if the semantic action invokes
1900 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1901 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1902 incorrect destructor might then be invoked immediately. In the
1903 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1904 to an incorrect destructor call or verbose syntax error message
1905 before the lookahead is translated. */
1906 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1907
1908 YYPOPSTACK (yylen);
1909 yylen = 0;
1910
1911 *++yyvsp = yyval;
1912 *++yylsp = yyloc;
1913
1914 /* Now 'shift' the result of the reduction. Determine what state
1915 that goes to, based on the state we popped back to and the rule
1916 number reduced by. */
1917 {
1918 const int yylhs = yyr1[yyn] - YYNTOKENS;
1919 const int yyi = yypgoto[yylhs] + *yyssp;
1920 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1921 ? yytable[yyi]
1922 : yydefgoto[yylhs]);
1923 }
1924
1925 goto yynewstate;
1926
1927
1928 /*--------------------------------------.
1929 | yyerrlab -- here on detecting error. |
1930 `--------------------------------------*/
1931 yyerrlab:
1932 /* Make sure we have latest lookahead translation. See comments at
1933 user semantic actions for why this is necessary. */
1934 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1935 /* If not already recovering from an error, report this error. */
1936 if (!yyerrstatus)
1937 {
1938 ++yynerrs;
1939 yyerror (YY_("syntax error"));
1940 }
1941
1942 yyerror_range[1] = yylloc;
1943 if (yyerrstatus == 3)
1944 {
1945 /* If just tried and failed to reuse lookahead token after an
1946 error, discard it. */
1947
1948 if (yychar <= YYEOF)
1949 {
1950 /* Return failure if at end of input. */
1951 if (yychar == YYEOF)
1952 YYABORT;
1953 }
1954 else
1955 {
1956 yydestruct ("Error: discarding",
1957 yytoken, &yylval, &yylloc);
1958 yychar = YYEMPTY;
1959 }
1960 }
1961
1962 /* Else will try to reuse lookahead token after shifting the error
1963 token. */
1964 goto yyerrlab1;
1965
1966
1967 /*---------------------------------------------------.
1968 | yyerrorlab -- error raised explicitly by YYERROR. |
1969 `---------------------------------------------------*/
1970 yyerrorlab:
1971 /* Pacify compilers when the user code never invokes YYERROR and the
1972 label yyerrorlab therefore never appears in user code. */
1973 if (0)
1974 YYERROR;
1975
1976 /* Do not reclaim the symbols of the rule whose action triggered
1977 this YYERROR. */
1978 YYPOPSTACK (yylen);
1979 yylen = 0;
1980 YY_STACK_PRINT (yyss, yyssp);
1981 yystate = *yyssp;
1982 goto yyerrlab1;
1983
1984
1985 /*-------------------------------------------------------------.
1986 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1987 `-------------------------------------------------------------*/
1988 yyerrlab1:
1989 yyerrstatus = 3; /* Each real token shifted decrements this. */
1990
1991 /* Pop stack until we find a state that shifts the error token. */
1992 for (;;)
1993 {
1994 yyn = yypact[yystate];
1995 if (!yypact_value_is_default (yyn))
1996 {
1997 yyn += YYSYMBOL_YYerror;
1998 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1999 {
2000 yyn = yytable[yyn];
2001 if (0 < yyn)
2002 break;
2003 }
2004 }
2005
2006 /* Pop the current state because it cannot handle the error token. */
2007 if (yyssp == yyss)
2008 YYABORT;
2009
2010 yyerror_range[1] = *yylsp;
2011 yydestruct ("Error: popping",
2012 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp);
2013 YYPOPSTACK (1);
2014 yystate = *yyssp;
2015 YY_STACK_PRINT (yyss, yyssp);
2016 }
2017
2018 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2019 *++yyvsp = yylval;
2020 YY_IGNORE_MAYBE_UNINITIALIZED_END
2021
2022 yyerror_range[2] = yylloc;
2023 ++yylsp;
2024 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
2025
2026 /* Shift the error token. */
2027 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2028
2029 yystate = yyn;
2030 goto yynewstate;
2031
2032
2033 /*-------------------------------------.
2034 | yyacceptlab -- YYACCEPT comes here. |
2035 `-------------------------------------*/
2036 yyacceptlab:
2037 yyresult = 0;
2038 goto yyreturn;
2039
2040
2041 /*-----------------------------------.
2042 | yyabortlab -- YYABORT comes here. |
2043 `-----------------------------------*/
2044 yyabortlab:
2045 yyresult = 1;
2046 goto yyreturn;
2047
2048
2049 #if !defined yyoverflow
2050 /*-------------------------------------------------.
2051 | yyexhaustedlab -- memory exhaustion comes here. |
2052 `-------------------------------------------------*/
2053 yyexhaustedlab:
2054 yyerror (YY_("memory exhausted"));
2055 yyresult = 2;
2056 goto yyreturn;
2057 #endif
2058
2059
2060 /*-------------------------------------------------------.
2061 | yyreturn -- parsing is finished, clean up and return. |
2062 `-------------------------------------------------------*/
2063 yyreturn:
2064 if (yychar != YYEMPTY)
2065 {
2066 /* Make sure we have latest lookahead translation. See comments at
2067 user semantic actions for why this is necessary. */
2068 yytoken = YYTRANSLATE (yychar);
2069 yydestruct ("Cleanup: discarding lookahead",
2070 yytoken, &yylval, &yylloc);
2071 }
2072 /* Do not reclaim the symbols of the rule whose action triggered
2073 this YYABORT or YYACCEPT. */
2074 YYPOPSTACK (yylen);
2075 YY_STACK_PRINT (yyss, yyssp);
2076 while (yyssp != yyss)
2077 {
2078 yydestruct ("Cleanup: popping",
2079 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp);
2080 YYPOPSTACK (1);
2081 }
2082 #ifndef yyoverflow
2083 if (yyss != yyssa)
2084 YYSTACK_FREE (yyss);
2085 #endif
2086
2087 return yyresult;
2088 }
2089
2090
2091
yyerror(char const * s)2092 void yyerror(char const *s)
2093 {
2094 ERROR(&yylloc, "%s", s);
2095 }
2096