Commit | Line | Data |
---|---|---|
2a6a08ca | 1 | /* A Bison parser, made by GNU Bison 2.5. */ |
cd296721 | 2 | |
2a6a08ca | 3 | /* Bison implementation for Yacc-like parsers in C |
658f29a5 | 4 | |
2a6a08ca | 5 | Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. |
658f29a5 JB |
6 | |
7 | This program is free software: you can redistribute it and/or modify | |
a4da2e3e | 8 | it under the terms of the GNU General Public License as published by |
658f29a5 JB |
9 | the Free Software Foundation, either version 3 of the License, or |
10 | (at your option) any later version. | |
11 | ||
a4da2e3e DG |
12 | 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. | |
658f29a5 | 16 | |
a4da2e3e | 17 | You should have received a copy of the GNU General Public License |
658f29a5 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
a4da2e3e DG |
19 | |
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. | |
658f29a5 | 29 | |
a4da2e3e DG |
30 | 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. */ | |
2a6a08ca | 47 | #define YYBISON_VERSION "2.5" |
a4da2e3e DG |
48 | |
49 | /* Skeleton name. */ | |
50 | #define YYSKELETON_NAME "yacc.c" | |
51 | ||
52 | /* Pure parsers. */ | |
53 | #define YYPURE 0 | |
54 | ||
658f29a5 JB |
55 | /* Push parsers. */ |
56 | #define YYPUSH 0 | |
a4da2e3e | 57 | |
658f29a5 JB |
58 | /* Pull parsers. */ |
59 | #define YYPULL 1 | |
a4da2e3e | 60 | |
658f29a5 JB |
61 | /* Using locations. */ |
62 | #define YYLSP_NEEDED 0 | |
a4da2e3e DG |
63 | |
64 | ||
65 | ||
66 | /* Copy the first part of user declarations. */ | |
658f29a5 | 67 | |
2a6a08ca | 68 | /* Line 268 of yacc.c */ |
cd296721 | 69 | #line 21 "dtc-parser.y" |
a4da2e3e | 70 | |
ed95d745 DG |
71 | #include <stdio.h> |
72 | ||
a4da2e3e DG |
73 | #include "dtc.h" |
74 | #include "srcpos.h" | |
75 | ||
658f29a5 JB |
76 | YYLTYPE yylloc; |
77 | ||
ed95d745 | 78 | extern int yylex(void); |
658f29a5 JB |
79 | extern void print_error(char const *fmt, ...); |
80 | extern void yyerror(char const *s); | |
a4da2e3e DG |
81 | |
82 | extern struct boot_info *the_boot_info; | |
ed95d745 | 83 | extern int treesource_error; |
a4da2e3e | 84 | |
ed95d745 | 85 | static unsigned long long eval_literal(const char *s, int base, int bits); |
cd296721 | 86 | static unsigned char eval_char_literal(const char *s); |
a4da2e3e DG |
87 | |
88 | ||
2a6a08ca GL |
89 | /* Line 268 of yacc.c */ |
90 | #line 91 "dtc-parser.tab.c" | |
658f29a5 | 91 | |
a4da2e3e DG |
92 | /* Enabling traces. */ |
93 | #ifndef YYDEBUG | |
cd296721 | 94 | # define YYDEBUG 0 |
a4da2e3e DG |
95 | #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 | ||
658f29a5 JB |
110 | |
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, | |
cd296721 SW |
119 | 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 | |
658f29a5 JB |
139 | }; |
140 | #endif | |
141 | ||
142 | ||
143 | ||
a4da2e3e DG |
144 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
145 | typedef union YYSTYPE | |
a4da2e3e | 146 | { |
658f29a5 | 147 | |
2a6a08ca | 148 | /* Line 293 of yacc.c */ |
cd296721 | 149 | #line 40 "dtc-parser.y" |
658f29a5 | 150 | |
a4da2e3e DG |
151 | char *propnodename; |
152 | char *literal; | |
153 | char *labelref; | |
154 | unsigned int cbase; | |
ed95d745 | 155 | uint8_t byte; |
a4da2e3e DG |
156 | struct data data; |
157 | ||
cd296721 SW |
158 | struct { |
159 | struct data data; | |
160 | int bits; | |
161 | } array; | |
162 | ||
a4da2e3e DG |
163 | struct property *prop; |
164 | struct property *proplist; | |
165 | struct node *node; | |
166 | struct node *nodelist; | |
167 | struct reserve_info *re; | |
cd296721 | 168 | uint64_t integer; |
658f29a5 JB |
169 | |
170 | ||
171 | ||
2a6a08ca GL |
172 | /* Line 293 of yacc.c */ |
173 | #line 174 "dtc-parser.tab.c" | |
658f29a5 JB |
174 | } YYSTYPE; |
175 | # define YYSTYPE_IS_TRIVIAL 1 | |
a4da2e3e DG |
176 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
177 | # define YYSTYPE_IS_DECLARED 1 | |
a4da2e3e DG |
178 | #endif |
179 | ||
180 | ||
181 | /* Copy the second part of user declarations. */ | |
182 | ||
183 | ||
2a6a08ca GL |
184 | /* Line 343 of yacc.c */ |
185 | #line 186 "dtc-parser.tab.c" | |
a4da2e3e DG |
186 | |
187 | #ifdef short | |
188 | # undef short | |
189 | #endif | |
190 | ||
191 | #ifdef YYTYPE_UINT8 | |
192 | typedef YYTYPE_UINT8 yytype_uint8; | |
193 | #else | |
194 | typedef unsigned char yytype_uint8; | |
195 | #endif | |
196 | ||
197 | #ifdef YYTYPE_INT8 | |
198 | typedef YYTYPE_INT8 yytype_int8; | |
199 | #elif (defined __STDC__ || defined __C99__FUNC__ \ | |
200 | || defined __cplusplus || defined _MSC_VER) | |
201 | typedef signed char yytype_int8; | |
202 | #else | |
203 | typedef short int yytype_int8; | |
204 | #endif | |
205 | ||
206 | #ifdef YYTYPE_UINT16 | |
207 | typedef YYTYPE_UINT16 yytype_uint16; | |
208 | #else | |
209 | typedef unsigned short int yytype_uint16; | |
210 | #endif | |
211 | ||
212 | #ifdef YYTYPE_INT16 | |
213 | typedef YYTYPE_INT16 yytype_int16; | |
214 | #else | |
215 | typedef 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_ | |
2a6a08ca | 235 | # if defined YYENABLE_NLS && YYENABLE_NLS |
a4da2e3e DG |
236 | # 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) | |
259 | static int | |
658f29a5 | 260 | YYID (int yyi) |
a4da2e3e DG |
261 | #else |
262 | static int | |
658f29a5 JB |
263 | YYID (yyi) |
264 | int yyi; | |
a4da2e3e DG |
265 | #endif |
266 | { | |
658f29a5 | 267 | return yyi; |
a4da2e3e DG |
268 | } |
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 | |
2a6a08ca | 288 | # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
a4da2e3e DG |
289 | || defined __cplusplus || defined _MSC_VER) |
290 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
2a6a08ca GL |
291 | # ifndef EXIT_SUCCESS |
292 | # define EXIT_SUCCESS 0 | |
a4da2e3e DG |
293 | # 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 | |
2a6a08ca | 315 | # if (defined __cplusplus && ! defined EXIT_SUCCESS \ |
a4da2e3e DG |
316 | && ! ((defined YYMALLOC || defined malloc) \ |
317 | && (defined YYFREE || defined free))) | |
318 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | |
2a6a08ca GL |
319 | # ifndef EXIT_SUCCESS |
320 | # define EXIT_SUCCESS 0 | |
a4da2e3e DG |
321 | # endif |
322 | # endif | |
323 | # ifndef YYMALLOC | |
324 | # define YYMALLOC malloc | |
2a6a08ca | 325 | # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
a4da2e3e DG |
326 | || defined __cplusplus || defined _MSC_VER) |
327 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | |
328 | # endif | |
329 | # endif | |
330 | # ifndef YYFREE | |
331 | # define YYFREE free | |
2a6a08ca | 332 | # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ |
a4da2e3e DG |
333 | || defined __cplusplus || defined _MSC_VER) |
334 | void 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 \ | |
658f29a5 | 343 | || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
a4da2e3e DG |
344 | |
345 | /* A type that is properly aligned for any stack member. */ | |
346 | union yyalloc | |
347 | { | |
658f29a5 JB |
348 | yytype_int16 yyss_alloc; |
349 | YYSTYPE yyvs_alloc; | |
a4da2e3e DG |
350 | }; |
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) \ | |
658f29a5 JB |
358 | ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ |
359 | + YYSTACK_GAP_MAXIMUM) | |
a4da2e3e | 360 | |
2a6a08ca | 361 | # define YYCOPY_NEEDED 1 |
a4da2e3e DG |
362 | |
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. */ | |
658f29a5 | 368 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
a4da2e3e DG |
369 | do \ |
370 | { \ | |
371 | YYSIZE_T yynewbytes; \ | |
658f29a5 JB |
372 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
373 | Stack = &yyptr->Stack_alloc; \ | |
a4da2e3e DG |
374 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
375 | yyptr += yynewbytes / sizeof (*yyptr); \ | |
376 | } \ | |
377 | while (YYID (0)) | |
378 | ||
379 | #endif | |
380 | ||
2a6a08ca GL |
381 | #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 | ||
a4da2e3e | 401 | /* YYFINAL -- State number of the termination state. */ |
658f29a5 | 402 | #define YYFINAL 4 |
a4da2e3e | 403 | /* YYLAST -- Last index in YYTABLE. */ |
cd296721 | 404 | #define YYLAST 133 |
a4da2e3e DG |
405 | |
406 | /* YYNTOKENS -- Number of terminals. */ | |
cd296721 | 407 | #define YYNTOKENS 48 |
a4da2e3e | 408 | /* YYNNTS -- Number of nonterminals. */ |
cd296721 | 409 | #define YYNNTS 28 |
a4da2e3e | 410 | /* YYNRULES -- Number of rules. */ |
cd296721 | 411 | #define YYNRULES 79 |
a4da2e3e | 412 | /* YYNRULES -- Number of states. */ |
cd296721 | 413 | #define YYNSTATES 141 |
a4da2e3e DG |
414 | |
415 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | |
416 | #define YYUNDEFTOK 2 | |
cd296721 | 417 | #define YYMAXUTOK 279 |
a4da2e3e DG |
418 | |
419 | #define YYTRANSLATE(YYX) \ | |
420 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | |
421 | ||
422 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | |
423 | static 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, | |
cd296721 SW |
428 | 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, | |
a4da2e3e DG |
432 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
433 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
cd296721 | 434 | 2, 31, 2, 32, 40, 2, 2, 2, 2, 2, |
a4da2e3e DG |
435 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
436 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
cd296721 | 437 | 2, 2, 2, 27, 39, 28, 46, 2, 2, 2, |
a4da2e3e DG |
438 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
439 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
440 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
441 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
442 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
443 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
444 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
445 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
446 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
447 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | |
448 | 2, 2, 2, 2, 2, 2, 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, | |
cd296721 SW |
451 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
452 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 | |
a4da2e3e DG |
453 | }; |
454 | ||
455 | #if YYDEBUG | |
456 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | |
457 | YYRHS. */ | |
cd296721 | 458 | static const yytype_uint16 yyprhs[] = |
a4da2e3e | 459 | { |
cd296721 SW |
460 | 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 | |
a4da2e3e DG |
468 | }; |
469 | ||
470 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | |
471 | static const yytype_int8 yyrhs[] = | |
472 | { | |
cd296721 SW |
473 | 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 | |
a4da2e3e DG |
500 | }; |
501 | ||
502 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | |
503 | static const yytype_uint16 yyrline[] = | |
504 | { | |
cd296721 SW |
505 | 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 | |
a4da2e3e DG |
513 | }; |
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. */ | |
519 | static const char *const yytname[] = | |
520 | { | |
cd296721 SW |
521 | "$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 | |
a4da2e3e DG |
534 | }; |
535 | #endif | |
536 | ||
537 | # ifdef YYPRINT | |
538 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | |
539 | token YYLEX-NUM. */ | |
540 | static const yytype_uint16 yytoknum[] = | |
541 | { | |
542 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | |
cd296721 SW |
543 | 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 | |
a4da2e3e DG |
547 | }; |
548 | # endif | |
549 | ||
550 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | |
551 | static const yytype_uint8 yyr1[] = | |
552 | { | |
cd296721 SW |
553 | 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 | |
a4da2e3e DG |
561 | }; |
562 | ||
563 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | |
564 | static const yytype_uint8 yyr2[] = | |
565 | { | |
cd296721 SW |
566 | 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 | |
a4da2e3e DG |
574 | }; |
575 | ||
2a6a08ca GL |
576 | /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. |
577 | Performed when YYTABLE doesn't specify something else to do. Zero | |
a4da2e3e DG |
578 | means the default is an error. */ |
579 | static const yytype_uint8 yydefact[] = | |
580 | { | |
cd296721 SW |
581 | 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 | |
a4da2e3e DG |
596 | }; |
597 | ||
598 | /* YYDEFGOTO[NTERM-NUM]. */ | |
599 | static const yytype_int8 yydefgoto[] = | |
600 | { | |
cd296721 SW |
601 | -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 | |
a4da2e3e DG |
604 | }; |
605 | ||
606 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | |
607 | STATE-NUM. */ | |
cd296721 | 608 | #define YYPACT_NINF -78 |
a4da2e3e DG |
609 | static const yytype_int8 yypact[] = |
610 | { | |
cd296721 SW |
611 | 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 | |
a4da2e3e DG |
626 | }; |
627 | ||
628 | /* YYPGOTO[NTERM-NUM]. */ | |
629 | static const yytype_int8 yypgoto[] = | |
630 | { | |
cd296721 SW |
631 | -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 | |
a4da2e3e DG |
634 | }; |
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 | |
2a6a08ca | 638 | number is the opposite. If YYTABLE_NINF, syntax error. */ |
658f29a5 JB |
639 | #define YYTABLE_NINF -1 |
640 | static const yytype_uint8 yytable[] = | |
a4da2e3e | 641 | { |
cd296721 SW |
642 | 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 | |
a4da2e3e DG |
656 | }; |
657 | ||
2a6a08ca GL |
658 | #define yypact_value_is_default(yystate) \ |
659 | ((yystate) == (-78)) | |
660 | ||
661 | #define yytable_value_is_error(yytable_value) \ | |
662 | YYID (0) | |
663 | ||
cd296721 | 664 | static const yytype_int16 yycheck[] = |
a4da2e3e | 665 | { |
cd296721 SW |
666 | 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 | |
a4da2e3e DG |
680 | }; |
681 | ||
682 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | |
683 | symbol of state STATE-NUM. */ | |
684 | static const yytype_uint8 yystos[] = | |
685 | { | |
cd296721 SW |
686 | 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 | |
a4da2e3e DG |
701 | }; |
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. | |
2a6a08ca GL |
715 | 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. */ | |
a4da2e3e DG |
719 | |
720 | #define YYFAIL goto yyerrlab | |
2a6a08ca GL |
721 | #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 | |
a4da2e3e DG |
727 | |
728 | #define YYRECOVERING() (!!yyerrstatus) | |
729 | ||
730 | #define YYBACKUP(Token, Value) \ | |
731 | do \ | |
732 | if (yychar == YYEMPTY && yylen == 1) \ | |
733 | { \ | |
734 | yychar = (Token); \ | |
735 | yylval = (Value); \ | |
a4da2e3e DG |
736 | YYPOPSTACK (1); \ |
737 | goto yybackup; \ | |
738 | } \ | |
739 | else \ | |
740 | { \ | |
741 | yyerror (YY_("syntax error: cannot back up")); \ | |
742 | YYERROR; \ | |
743 | } \ | |
744 | while (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 | ||
2a6a08ca | 777 | /* This macro is provided for backward compatibility. */ |
a4da2e3e DG |
778 | |
779 | #ifndef YY_LOCATION_PRINT | |
2a6a08ca | 780 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) |
a4da2e3e DG |
781 | #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) \ | |
801 | do { \ | |
802 | if (yydebug) \ | |
803 | YYFPRINTF Args; \ | |
804 | } while (YYID (0)) | |
805 | ||
806 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | |
807 | do { \ | |
808 | if (yydebug) \ | |
809 | { \ | |
810 | YYFPRINTF (stderr, "%s ", Title); \ | |
811 | yy_symbol_print (stderr, \ | |
658f29a5 | 812 | Type, Value); \ |
a4da2e3e DG |
813 | 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) | |
825 | static void | |
658f29a5 | 826 | yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
a4da2e3e DG |
827 | #else |
828 | static void | |
658f29a5 | 829 | yy_symbol_value_print (yyoutput, yytype, yyvaluep) |
a4da2e3e DG |
830 | FILE *yyoutput; |
831 | int yytype; | |
832 | YYSTYPE const * const yyvaluep; | |
a4da2e3e DG |
833 | #endif |
834 | { | |
835 | if (!yyvaluep) | |
836 | return; | |
a4da2e3e DG |
837 | # 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) | |
857 | static void | |
658f29a5 | 858 | yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) |
a4da2e3e DG |
859 | #else |
860 | static void | |
658f29a5 | 861 | yy_symbol_print (yyoutput, yytype, yyvaluep) |
a4da2e3e DG |
862 | FILE *yyoutput; |
863 | int yytype; | |
864 | YYSTYPE const * const yyvaluep; | |
a4da2e3e DG |
865 | #endif |
866 | { | |
867 | if (yytype < YYNTOKENS) | |
868 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | |
869 | else | |
870 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | |
871 | ||
658f29a5 | 872 | yy_symbol_value_print (yyoutput, yytype, yyvaluep); |
a4da2e3e DG |
873 | 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) | |
883 | static void | |
658f29a5 | 884 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
a4da2e3e DG |
885 | #else |
886 | static void | |
658f29a5 JB |
887 | yy_stack_print (yybottom, yytop) |
888 | yytype_int16 *yybottom; | |
889 | yytype_int16 *yytop; | |
a4da2e3e DG |
890 | #endif |
891 | { | |
892 | YYFPRINTF (stderr, "Stack now"); | |
658f29a5 JB |
893 | for (; yybottom <= yytop; yybottom++) |
894 | { | |
895 | int yybot = *yybottom; | |
896 | YYFPRINTF (stderr, " %d", yybot); | |
897 | } | |
a4da2e3e DG |
898 | YYFPRINTF (stderr, "\n"); |
899 | } | |
900 | ||
901 | # define YY_STACK_PRINT(Bottom, Top) \ | |
902 | do { \ | |
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) | |
914 | static void | |
658f29a5 | 915 | yy_reduce_print (YYSTYPE *yyvsp, int yyrule) |
a4da2e3e DG |
916 | #else |
917 | static void | |
658f29a5 | 918 | yy_reduce_print (yyvsp, yyrule) |
a4da2e3e | 919 | YYSTYPE *yyvsp; |
a4da2e3e DG |
920 | 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 | { | |
658f29a5 | 931 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
a4da2e3e DG |
932 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
933 | &(yyvsp[(yyi + 1) - (yynrhs)]) | |
658f29a5 JB |
934 | ); |
935 | YYFPRINTF (stderr, "\n"); | |
a4da2e3e DG |
936 | } |
937 | } | |
938 | ||
939 | # define YY_REDUCE_PRINT(Rule) \ | |
940 | do { \ | |
941 | if (yydebug) \ | |
658f29a5 | 942 | yy_reduce_print (yyvsp, Rule); \ |
a4da2e3e DG |
943 | } while (YYID (0)) |
944 | ||
945 | /* Nonzero means print parse trace. It is left uninitialized so that | |
946 | multiple parsers can coexist. */ | |
947 | int 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 | ||
a4da2e3e DG |
972 | |
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) | |
982 | static YYSIZE_T | |
983 | yystrlen (const char *yystr) | |
984 | #else | |
985 | static YYSIZE_T | |
986 | yystrlen (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) | |
1006 | static char * | |
1007 | yystpcpy (char *yydest, const char *yysrc) | |
1008 | #else | |
1009 | static char * | |
1010 | yystpcpy (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. */ | |
1034 | static YYSIZE_T | |
1035 | yytnamerr (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 | ||
2a6a08ca GL |
1074 | /* 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. | |
a4da2e3e | 1077 | |
2a6a08ca GL |
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. */ | |
1082 | static int | |
1083 | yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | |
1084 | yytype_int16 *yyssp, int yytoken) | |
1085 | { | |
1086 | 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; | |
1097 | ||
1098 | /* 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) | |
a4da2e3e | 1126 | { |
2a6a08ca GL |
1127 | 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; | |
1139 | ||
1140 | 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 | } | |
1158 | } | |
a4da2e3e | 1159 | |
2a6a08ca GL |
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 | } | |
a4da2e3e | 1174 | |
2a6a08ca GL |
1175 | yysize1 = yysize + yystrlen (yyformat); |
1176 | if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) | |
1177 | return 2; | |
1178 | yysize = yysize1; | |
a4da2e3e | 1179 | |
2a6a08ca GL |
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; | |
a4da2e3e | 1187 | } |
2a6a08ca GL |
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; | |
a4da2e3e DG |
1208 | } |
1209 | #endif /* YYERROR_VERBOSE */ | |
a4da2e3e DG |
1210 | |
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) | |
1218 | static void | |
658f29a5 | 1219 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) |
a4da2e3e DG |
1220 | #else |
1221 | static void | |
658f29a5 | 1222 | yydestruct (yymsg, yytype, yyvaluep) |
a4da2e3e DG |
1223 | const char *yymsg; |
1224 | int yytype; | |
1225 | YYSTYPE *yyvaluep; | |
a4da2e3e DG |
1226 | #endif |
1227 | { | |
1228 | YYUSE (yyvaluep); | |
a4da2e3e DG |
1229 | |
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 | } | |
a4da2e3e | 1241 | |
2a6a08ca | 1242 | |
a4da2e3e | 1243 | /* Prevent warnings from -Wmissing-prototypes. */ |
a4da2e3e DG |
1244 | #ifdef YYPARSE_PARAM |
1245 | #if defined __STDC__ || defined __cplusplus | |
1246 | int yyparse (void *YYPARSE_PARAM); | |
1247 | #else | |
1248 | int yyparse (); | |
1249 | #endif | |
1250 | #else /* ! YYPARSE_PARAM */ | |
1251 | #if defined __STDC__ || defined __cplusplus | |
1252 | int yyparse (void); | |
1253 | #else | |
1254 | int yyparse (); | |
1255 | #endif | |
1256 | #endif /* ! YYPARSE_PARAM */ | |
1257 | ||
1258 | ||
658f29a5 | 1259 | /* The lookahead symbol. */ |
a4da2e3e DG |
1260 | int yychar; |
1261 | ||
658f29a5 | 1262 | /* The semantic value of the lookahead symbol. */ |
a4da2e3e DG |
1263 | YYSTYPE yylval; |
1264 | ||
1265 | /* Number of syntax errors so far. */ | |
1266 | int yynerrs; | |
a4da2e3e DG |
1267 | |
1268 | ||
2a6a08ca GL |
1269 | /*----------. |
1270 | | yyparse. | | |
1271 | `----------*/ | |
a4da2e3e DG |
1272 | |
1273 | #ifdef YYPARSE_PARAM | |
1274 | #if (defined __STDC__ || defined __C99__FUNC__ \ | |
1275 | || defined __cplusplus || defined _MSC_VER) | |
1276 | int | |
1277 | yyparse (void *YYPARSE_PARAM) | |
1278 | #else | |
1279 | int | |
1280 | yyparse (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) | |
1286 | int | |
1287 | yyparse (void) | |
1288 | #else | |
1289 | int | |
1290 | yyparse () | |
1291 | ||
1292 | #endif | |
1293 | #endif | |
1294 | { | |
658f29a5 JB |
1295 | int yystate; |
1296 | /* Number of tokens to shift before error messages enabled. */ | |
1297 | int yyerrstatus; | |
a4da2e3e | 1298 | |
658f29a5 JB |
1299 | /* The stacks and their tools: |
1300 | `yyss': related to states. | |
1301 | `yyvs': related to semantic values. | |
a4da2e3e | 1302 | |
658f29a5 JB |
1303 | Refer to the stacks thru separate pointers, to allow yyoverflow |
1304 | to reallocate them elsewhere. */ | |
a4da2e3e | 1305 | |
658f29a5 JB |
1306 | /* The state stack. */ |
1307 | yytype_int16 yyssa[YYINITDEPTH]; | |
1308 | yytype_int16 *yyss; | |
1309 | yytype_int16 *yyssp; | |
a4da2e3e | 1310 | |
658f29a5 JB |
1311 | /* The semantic value stack. */ |
1312 | YYSTYPE yyvsa[YYINITDEPTH]; | |
1313 | YYSTYPE *yyvs; | |
1314 | YYSTYPE *yyvsp; | |
a4da2e3e | 1315 | |
658f29a5 | 1316 | YYSIZE_T yystacksize; |
a4da2e3e | 1317 | |
658f29a5 JB |
1318 | int yyn; |
1319 | int yyresult; | |
1320 | /* Lookahead token as an internal (translated) token number. */ | |
1321 | int yytoken; | |
a4da2e3e DG |
1322 | /* The variables used to return semantic value and location from the |
1323 | action routines. */ | |
1324 | YYSTYPE yyval; | |
658f29a5 JB |
1325 | |
1326 | #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 | ||
1333 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | |
a4da2e3e DG |
1334 | |
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 | ||
658f29a5 JB |
1339 | yytoken = 0; |
1340 | yyss = yyssa; | |
1341 | yyvs = yyvsa; | |
1342 | yystacksize = YYINITDEPTH; | |
1343 | ||
a4da2e3e DG |
1344 | YYDPRINTF ((stderr, "Starting parse\n")); |
1345 | ||
1346 | yystate = 0; | |
1347 | yyerrstatus = 0; | |
1348 | yynerrs = 0; | |
658f29a5 | 1349 | yychar = YYEMPTY; /* Cause a token to be read. */ |
a4da2e3e DG |
1350 | |
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. */ | |
a4da2e3e DG |
1355 | yyssp = yyss; |
1356 | yyvsp = yyvs; | |
a4da2e3e DG |
1357 | |
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; | |
a4da2e3e DG |
1383 | |
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), | |
a4da2e3e | 1391 | &yystacksize); |
658f29a5 | 1392 | |
a4da2e3e DG |
1393 | 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; | |
658f29a5 JB |
1413 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1414 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); | |
a4da2e3e DG |
1415 | # 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; | |
a4da2e3e DG |
1424 | |
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 | ||
658f29a5 JB |
1434 | if (yystate == YYFINAL) |
1435 | YYACCEPT; | |
1436 | ||
a4da2e3e DG |
1437 | goto yybackup; |
1438 | ||
1439 | /*-----------. | |
1440 | | yybackup. | | |
1441 | `-----------*/ | |
1442 | yybackup: | |
1443 | ||
1444 | /* Do appropriate processing given the current state. Read a | |
658f29a5 | 1445 | lookahead token if we need one and don't already have one. */ |
a4da2e3e | 1446 | |
658f29a5 | 1447 | /* First try to decide what to do without reference to lookahead token. */ |
a4da2e3e | 1448 | yyn = yypact[yystate]; |
2a6a08ca | 1449 | if (yypact_value_is_default (yyn)) |
a4da2e3e DG |
1450 | goto yydefault; |
1451 | ||
658f29a5 | 1452 | /* Not known => get a lookahead token if don't already have one. */ |
a4da2e3e | 1453 | |
658f29a5 | 1454 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
a4da2e3e DG |
1455 | 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 | { | |
2a6a08ca GL |
1480 | if (yytable_value_is_error (yyn)) |
1481 | goto yyerrlab; | |
a4da2e3e DG |
1482 | yyn = -yyn; |
1483 | goto yyreduce; | |
1484 | } | |
1485 | ||
a4da2e3e DG |
1486 | /* Count tokens shifted since error; after three, turn off error |
1487 | status. */ | |
1488 | if (yyerrstatus) | |
1489 | yyerrstatus--; | |
1490 | ||
658f29a5 | 1491 | /* Shift the lookahead token. */ |
a4da2e3e DG |
1492 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1493 | ||
658f29a5 JB |
1494 | /* Discard the shifted token. */ |
1495 | yychar = YYEMPTY; | |
a4da2e3e DG |
1496 | |
1497 | yystate = yyn; | |
1498 | *++yyvsp = yylval; | |
658f29a5 | 1499 | |
a4da2e3e DG |
1500 | goto yynewstate; |
1501 | ||
1502 | ||
1503 | /*-----------------------------------------------------------. | |
1504 | | yydefault -- do the default action for the current state. | | |
1505 | `-----------------------------------------------------------*/ | |
1506 | yydefault: | |
1507 | yyn = yydefact[yystate]; | |
1508 | if (yyn == 0) | |
1509 | goto yyerrlab; | |
1510 | goto yyreduce; | |
1511 | ||
1512 | ||
1513 | /*-----------------------------. | |
1514 | | yyreduce -- Do a reduction. | | |
1515 | `-----------------------------*/ | |
1516 | yyreduce: | |
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 | ||
658f29a5 | 1530 | |
a4da2e3e DG |
1531 | YY_REDUCE_PRINT (yyn); |
1532 | switch (yyn) | |
1533 | { | |
1534 | case 2: | |
658f29a5 | 1535 | |
2a6a08ca | 1536 | /* Line 1806 of yacc.c */ |
cd296721 | 1537 | #line 110 "dtc-parser.y" |
a4da2e3e | 1538 | { |
658f29a5 JB |
1539 | the_boot_info = build_boot_info((yyvsp[(3) - (4)].re), (yyvsp[(4) - (4)].node), |
1540 | guess_boot_cpuid((yyvsp[(4) - (4)].node))); | |
2a6a08ca | 1541 | } |
a4da2e3e DG |
1542 | break; |
1543 | ||
1544 | case 3: | |
658f29a5 | 1545 | |
2a6a08ca | 1546 | /* Line 1806 of yacc.c */ |
cd296721 | 1547 | #line 118 "dtc-parser.y" |
a4da2e3e | 1548 | { |
658f29a5 | 1549 | (yyval.re) = NULL; |
2a6a08ca | 1550 | } |
a4da2e3e DG |
1551 | break; |
1552 | ||
1553 | case 4: | |
658f29a5 | 1554 | |
2a6a08ca | 1555 | /* Line 1806 of yacc.c */ |
cd296721 | 1556 | #line 122 "dtc-parser.y" |
a4da2e3e | 1557 | { |
658f29a5 | 1558 | (yyval.re) = chain_reserve_entry((yyvsp[(1) - (2)].re), (yyvsp[(2) - (2)].re)); |
2a6a08ca | 1559 | } |
a4da2e3e DG |
1560 | break; |
1561 | ||
1562 | case 5: | |
658f29a5 | 1563 | |
2a6a08ca | 1564 | /* Line 1806 of yacc.c */ |
cd296721 | 1565 | #line 129 "dtc-parser.y" |
a4da2e3e | 1566 | { |
cd296721 | 1567 | (yyval.re) = build_reserve_entry((yyvsp[(2) - (4)].integer), (yyvsp[(3) - (4)].integer)); |
2a6a08ca | 1568 | } |
a4da2e3e DG |
1569 | break; |
1570 | ||
1571 | case 6: | |
658f29a5 | 1572 | |
2a6a08ca | 1573 | /* Line 1806 of yacc.c */ |
cd296721 | 1574 | #line 133 "dtc-parser.y" |
a4da2e3e | 1575 | { |
658f29a5 JB |
1576 | add_label(&(yyvsp[(2) - (2)].re)->labels, (yyvsp[(1) - (2)].labelref)); |
1577 | (yyval.re) = (yyvsp[(2) - (2)].re); | |
2a6a08ca | 1578 | } |
a4da2e3e DG |
1579 | break; |
1580 | ||
1581 | case 7: | |
658f29a5 | 1582 | |
2a6a08ca | 1583 | /* Line 1806 of yacc.c */ |
cd296721 | 1584 | #line 141 "dtc-parser.y" |
a4da2e3e | 1585 | { |
cd296721 | 1586 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), ""); |
2a6a08ca | 1587 | } |
a4da2e3e DG |
1588 | break; |
1589 | ||
1590 | case 8: | |
658f29a5 | 1591 | |
2a6a08ca | 1592 | /* Line 1806 of yacc.c */ |
cd296721 | 1593 | #line 145 "dtc-parser.y" |
a4da2e3e | 1594 | { |
cd296721 | 1595 | (yyval.node) = merge_nodes((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); |
2a6a08ca | 1596 | } |
a4da2e3e DG |
1597 | break; |
1598 | ||
1599 | case 9: | |
658f29a5 | 1600 | |
2a6a08ca | 1601 | /* Line 1806 of yacc.c */ |
cd296721 | 1602 | #line 149 "dtc-parser.y" |
a4da2e3e | 1603 | { |
cd296721 SW |
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); | |
2a6a08ca | 1611 | } |
a4da2e3e DG |
1612 | break; |
1613 | ||
1614 | case 10: | |
658f29a5 | 1615 | |
2a6a08ca | 1616 | /* Line 1806 of yacc.c */ |
cd296721 | 1617 | #line 159 "dtc-parser.y" |
a4da2e3e | 1618 | { |
cd296721 | 1619 | struct node *target = get_node_by_ref((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].labelref)); |
658f29a5 | 1620 | |
cd296721 SW |
1621 | if (!target) |
1622 | print_error("label or path, '%s', not found", (yyvsp[(3) - (4)].labelref)); | |
658f29a5 | 1623 | else |
cd296721 SW |
1624 | delete_node(target); |
1625 | ||
1626 | (yyval.node) = (yyvsp[(1) - (4)].node); | |
2a6a08ca | 1627 | } |
a4da2e3e DG |
1628 | break; |
1629 | ||
1630 | case 11: | |
658f29a5 | 1631 | |
2a6a08ca | 1632 | /* Line 1806 of yacc.c */ |
cd296721 | 1633 | #line 173 "dtc-parser.y" |
a4da2e3e | 1634 | { |
658f29a5 | 1635 | (yyval.node) = build_node((yyvsp[(2) - (5)].proplist), (yyvsp[(3) - (5)].nodelist)); |
2a6a08ca | 1636 | } |
a4da2e3e DG |
1637 | break; |
1638 | ||
1639 | case 12: | |
658f29a5 | 1640 | |
2a6a08ca | 1641 | /* Line 1806 of yacc.c */ |
cd296721 | 1642 | #line 180 "dtc-parser.y" |
a4da2e3e | 1643 | { |
658f29a5 | 1644 | (yyval.proplist) = NULL; |
2a6a08ca | 1645 | } |
a4da2e3e DG |
1646 | break; |
1647 | ||
1648 | case 13: | |
658f29a5 | 1649 | |
2a6a08ca | 1650 | /* Line 1806 of yacc.c */ |
cd296721 | 1651 | #line 184 "dtc-parser.y" |
a4da2e3e | 1652 | { |
658f29a5 | 1653 | (yyval.proplist) = chain_property((yyvsp[(2) - (2)].prop), (yyvsp[(1) - (2)].proplist)); |
2a6a08ca | 1654 | } |
a4da2e3e DG |
1655 | break; |
1656 | ||
1657 | case 14: | |
658f29a5 | 1658 | |
2a6a08ca | 1659 | /* Line 1806 of yacc.c */ |
cd296721 | 1660 | #line 191 "dtc-parser.y" |
a4da2e3e | 1661 | { |
658f29a5 | 1662 | (yyval.prop) = build_property((yyvsp[(1) - (4)].propnodename), (yyvsp[(3) - (4)].data)); |
2a6a08ca | 1663 | } |
a4da2e3e DG |
1664 | break; |
1665 | ||
1666 | case 15: | |
658f29a5 | 1667 | |
2a6a08ca | 1668 | /* Line 1806 of yacc.c */ |
cd296721 | 1669 | #line 195 "dtc-parser.y" |
a4da2e3e | 1670 | { |
658f29a5 | 1671 | (yyval.prop) = build_property((yyvsp[(1) - (2)].propnodename), empty_data); |
2a6a08ca | 1672 | } |
a4da2e3e DG |
1673 | break; |
1674 | ||
1675 | case 16: | |
658f29a5 | 1676 | |
2a6a08ca | 1677 | /* Line 1806 of yacc.c */ |
cd296721 | 1678 | #line 199 "dtc-parser.y" |
a4da2e3e | 1679 | { |
cd296721 | 1680 | (yyval.prop) = build_property_delete((yyvsp[(2) - (3)].propnodename)); |
2a6a08ca | 1681 | } |
a4da2e3e DG |
1682 | break; |
1683 | ||
1684 | case 17: | |
658f29a5 | 1685 | |
2a6a08ca | 1686 | /* Line 1806 of yacc.c */ |
cd296721 | 1687 | #line 203 "dtc-parser.y" |
a4da2e3e | 1688 | { |
cd296721 SW |
1689 | add_label(&(yyvsp[(2) - (2)].prop)->labels, (yyvsp[(1) - (2)].labelref)); |
1690 | (yyval.prop) = (yyvsp[(2) - (2)].prop); | |
2a6a08ca | 1691 | } |
a4da2e3e DG |
1692 | break; |
1693 | ||
1694 | case 18: | |
658f29a5 | 1695 | |
2a6a08ca | 1696 | /* Line 1806 of yacc.c */ |
cd296721 | 1697 | #line 211 "dtc-parser.y" |
a4da2e3e | 1698 | { |
cd296721 | 1699 | (yyval.data) = data_merge((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].data)); |
2a6a08ca | 1700 | } |
a4da2e3e DG |
1701 | break; |
1702 | ||
1703 | case 19: | |
658f29a5 | 1704 | |
2a6a08ca | 1705 | /* Line 1806 of yacc.c */ |
cd296721 | 1706 | #line 215 "dtc-parser.y" |
a4da2e3e | 1707 | { |
cd296721 | 1708 | (yyval.data) = data_merge((yyvsp[(1) - (3)].data), (yyvsp[(2) - (3)].array).data); |
2a6a08ca | 1709 | } |
a4da2e3e DG |
1710 | break; |
1711 | ||
1712 | case 20: | |
658f29a5 | 1713 | |
2a6a08ca | 1714 | /* Line 1806 of yacc.c */ |
cd296721 | 1715 | #line 219 "dtc-parser.y" |
a4da2e3e | 1716 | { |
cd296721 | 1717 | (yyval.data) = data_merge((yyvsp[(1) - (4)].data), (yyvsp[(3) - (4)].data)); |
2a6a08ca | 1718 | } |
a4da2e3e DG |
1719 | break; |
1720 | ||
1721 | case 21: | |
a4da2e3e | 1722 | |
2a6a08ca | 1723 | /* Line 1806 of yacc.c */ |
cd296721 SW |
1724 | #line 223 "dtc-parser.y" |
1725 | { | |
1726 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), REF_PATH, (yyvsp[(2) - (2)].labelref)); | |
2a6a08ca | 1727 | } |
cd296721 SW |
1728 | break; |
1729 | ||
1730 | case 22: | |
1731 | ||
2a6a08ca | 1732 | /* Line 1806 of yacc.c */ |
cd296721 | 1733 | #line 227 "dtc-parser.y" |
a4da2e3e | 1734 | { |
658f29a5 JB |
1735 | FILE *f = srcfile_relative_open((yyvsp[(4) - (9)].data).val, NULL); |
1736 | struct data d; | |
ed95d745 | 1737 | |
cd296721 SW |
1738 | if ((yyvsp[(6) - (9)].integer) != 0) |
1739 | if (fseek(f, (yyvsp[(6) - (9)].integer), SEEK_SET) != 0) | |
658f29a5 | 1740 | print_error("Couldn't seek to offset %llu in \"%s\": %s", |
cd296721 | 1741 | (unsigned long long)(yyvsp[(6) - (9)].integer), |
658f29a5 JB |
1742 | (yyvsp[(4) - (9)].data).val, |
1743 | strerror(errno)); | |
ed95d745 | 1744 | |
cd296721 | 1745 | d = data_copy_file(f, (yyvsp[(8) - (9)].integer)); |
ed95d745 DG |
1746 | |
1747 | (yyval.data) = data_merge((yyvsp[(1) - (9)].data), d); | |
658f29a5 | 1748 | fclose(f); |
2a6a08ca | 1749 | } |
a4da2e3e DG |
1750 | break; |
1751 | ||
cd296721 | 1752 | case 23: |
658f29a5 | 1753 | |
2a6a08ca | 1754 | /* Line 1806 of yacc.c */ |
cd296721 | 1755 | #line 244 "dtc-parser.y" |
a4da2e3e | 1756 | { |
658f29a5 | 1757 | FILE *f = srcfile_relative_open((yyvsp[(4) - (5)].data).val, NULL); |
ed95d745 DG |
1758 | struct data d = empty_data; |
1759 | ||
658f29a5 | 1760 | d = data_copy_file(f, -1); |
ed95d745 DG |
1761 | |
1762 | (yyval.data) = data_merge((yyvsp[(1) - (5)].data), d); | |
658f29a5 | 1763 | fclose(f); |
2a6a08ca | 1764 | } |
a4da2e3e DG |
1765 | break; |
1766 | ||
658f29a5 JB |
1767 | case 24: |
1768 | ||
2a6a08ca | 1769 | /* Line 1806 of yacc.c */ |
cd296721 | 1770 | #line 254 "dtc-parser.y" |
a4da2e3e | 1771 | { |
cd296721 | 1772 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
2a6a08ca | 1773 | } |
a4da2e3e DG |
1774 | break; |
1775 | ||
658f29a5 JB |
1776 | case 25: |
1777 | ||
2a6a08ca | 1778 | /* Line 1806 of yacc.c */ |
cd296721 | 1779 | #line 261 "dtc-parser.y" |
a4da2e3e | 1780 | { |
cd296721 | 1781 | (yyval.data) = empty_data; |
2a6a08ca | 1782 | } |
a4da2e3e DG |
1783 | break; |
1784 | ||
658f29a5 JB |
1785 | case 26: |
1786 | ||
2a6a08ca | 1787 | /* Line 1806 of yacc.c */ |
cd296721 | 1788 | #line 265 "dtc-parser.y" |
a4da2e3e | 1789 | { |
cd296721 | 1790 | (yyval.data) = (yyvsp[(1) - (2)].data); |
2a6a08ca | 1791 | } |
a4da2e3e DG |
1792 | break; |
1793 | ||
658f29a5 JB |
1794 | case 27: |
1795 | ||
2a6a08ca | 1796 | /* Line 1806 of yacc.c */ |
cd296721 | 1797 | #line 269 "dtc-parser.y" |
ed95d745 | 1798 | { |
cd296721 | 1799 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); |
2a6a08ca | 1800 | } |
ed95d745 DG |
1801 | break; |
1802 | ||
658f29a5 JB |
1803 | case 28: |
1804 | ||
2a6a08ca | 1805 | /* Line 1806 of yacc.c */ |
cd296721 | 1806 | #line 276 "dtc-parser.y" |
ed95d745 | 1807 | { |
cd296721 SW |
1808 | (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 | } | |
2a6a08ca | 1820 | } |
ed95d745 DG |
1821 | break; |
1822 | ||
658f29a5 JB |
1823 | case 29: |
1824 | ||
2a6a08ca | 1825 | /* Line 1806 of yacc.c */ |
cd296721 | 1826 | #line 291 "dtc-parser.y" |
a4da2e3e | 1827 | { |
cd296721 SW |
1828 | (yyval.array).data = empty_data; |
1829 | (yyval.array).bits = 32; | |
2a6a08ca | 1830 | } |
a4da2e3e DG |
1831 | break; |
1832 | ||
658f29a5 JB |
1833 | case 30: |
1834 | ||
2a6a08ca | 1835 | /* Line 1806 of yacc.c */ |
cd296721 | 1836 | #line 296 "dtc-parser.y" |
a4da2e3e | 1837 | { |
cd296721 SW |
1838 | 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); | |
2a6a08ca | 1855 | } |
a4da2e3e DG |
1856 | break; |
1857 | ||
658f29a5 | 1858 | case 31: |
a4da2e3e | 1859 | |
2a6a08ca | 1860 | /* Line 1806 of yacc.c */ |
cd296721 | 1861 | #line 316 "dtc-parser.y" |
a4da2e3e | 1862 | { |
cd296721 SW |
1863 | 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); | |
2a6a08ca | 1874 | } |
a4da2e3e DG |
1875 | break; |
1876 | ||
658f29a5 | 1877 | case 32: |
a4da2e3e | 1878 | |
2a6a08ca | 1879 | /* Line 1806 of yacc.c */ |
cd296721 | 1880 | #line 330 "dtc-parser.y" |
a4da2e3e | 1881 | { |
cd296721 | 1882 | (yyval.array).data = data_add_marker((yyvsp[(1) - (2)].array).data, LABEL, (yyvsp[(2) - (2)].labelref)); |
2a6a08ca | 1883 | } |
a4da2e3e DG |
1884 | break; |
1885 | ||
658f29a5 JB |
1886 | case 33: |
1887 | ||
2a6a08ca | 1888 | /* Line 1806 of yacc.c */ |
cd296721 | 1889 | #line 337 "dtc-parser.y" |
a4da2e3e | 1890 | { |
cd296721 | 1891 | (yyval.integer) = eval_literal((yyvsp[(1) - (1)].literal), 0, 64); |
2a6a08ca | 1892 | } |
a4da2e3e DG |
1893 | break; |
1894 | ||
658f29a5 JB |
1895 | case 34: |
1896 | ||
2a6a08ca | 1897 | /* Line 1806 of yacc.c */ |
cd296721 | 1898 | #line 341 "dtc-parser.y" |
a4da2e3e | 1899 | { |
cd296721 | 1900 | (yyval.integer) = eval_char_literal((yyvsp[(1) - (1)].literal)); |
2a6a08ca | 1901 | } |
a4da2e3e DG |
1902 | break; |
1903 | ||
658f29a5 JB |
1904 | case 35: |
1905 | ||
2a6a08ca | 1906 | /* Line 1806 of yacc.c */ |
cd296721 SW |
1907 | #line 345 "dtc-parser.y" |
1908 | { | |
1909 | (yyval.integer) = (yyvsp[(2) - (3)].integer); | |
2a6a08ca | 1910 | } |
cd296721 SW |
1911 | break; |
1912 | ||
1913 | case 38: | |
1914 | ||
2a6a08ca | 1915 | /* Line 1806 of yacc.c */ |
cd296721 | 1916 | #line 356 "dtc-parser.y" |
2a6a08ca | 1917 | { (yyval.integer) = (yyvsp[(1) - (5)].integer) ? (yyvsp[(3) - (5)].integer) : (yyvsp[(5) - (5)].integer); } |
cd296721 SW |
1918 | break; |
1919 | ||
1920 | case 40: | |
1921 | ||
2a6a08ca | 1922 | /* Line 1806 of yacc.c */ |
cd296721 | 1923 | #line 361 "dtc-parser.y" |
2a6a08ca | 1924 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) || (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1925 | break; |
1926 | ||
1927 | case 42: | |
1928 | ||
2a6a08ca | 1929 | /* Line 1806 of yacc.c */ |
cd296721 | 1930 | #line 366 "dtc-parser.y" |
2a6a08ca | 1931 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) && (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1932 | break; |
1933 | ||
1934 | case 44: | |
1935 | ||
2a6a08ca | 1936 | /* Line 1806 of yacc.c */ |
cd296721 | 1937 | #line 371 "dtc-parser.y" |
2a6a08ca | 1938 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) | (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1939 | break; |
1940 | ||
1941 | case 46: | |
1942 | ||
2a6a08ca | 1943 | /* Line 1806 of yacc.c */ |
cd296721 | 1944 | #line 376 "dtc-parser.y" |
2a6a08ca | 1945 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) ^ (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1946 | break; |
1947 | ||
1948 | case 48: | |
1949 | ||
2a6a08ca | 1950 | /* Line 1806 of yacc.c */ |
cd296721 | 1951 | #line 381 "dtc-parser.y" |
2a6a08ca | 1952 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) & (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1953 | break; |
1954 | ||
1955 | case 50: | |
1956 | ||
2a6a08ca | 1957 | /* Line 1806 of yacc.c */ |
cd296721 | 1958 | #line 386 "dtc-parser.y" |
2a6a08ca | 1959 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) == (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1960 | break; |
1961 | ||
1962 | case 51: | |
1963 | ||
2a6a08ca | 1964 | /* Line 1806 of yacc.c */ |
cd296721 | 1965 | #line 387 "dtc-parser.y" |
2a6a08ca | 1966 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) != (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1967 | break; |
1968 | ||
1969 | case 53: | |
1970 | ||
2a6a08ca | 1971 | /* Line 1806 of yacc.c */ |
cd296721 | 1972 | #line 392 "dtc-parser.y" |
2a6a08ca | 1973 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) < (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1974 | break; |
1975 | ||
1976 | case 54: | |
1977 | ||
2a6a08ca | 1978 | /* Line 1806 of yacc.c */ |
cd296721 | 1979 | #line 393 "dtc-parser.y" |
2a6a08ca | 1980 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) > (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1981 | break; |
1982 | ||
1983 | case 55: | |
1984 | ||
2a6a08ca | 1985 | /* Line 1806 of yacc.c */ |
cd296721 | 1986 | #line 394 "dtc-parser.y" |
2a6a08ca | 1987 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) <= (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1988 | break; |
1989 | ||
1990 | case 56: | |
1991 | ||
2a6a08ca | 1992 | /* Line 1806 of yacc.c */ |
cd296721 | 1993 | #line 395 "dtc-parser.y" |
2a6a08ca | 1994 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >= (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
1995 | break; |
1996 | ||
1997 | case 57: | |
1998 | ||
2a6a08ca | 1999 | /* Line 1806 of yacc.c */ |
cd296721 | 2000 | #line 399 "dtc-parser.y" |
2a6a08ca | 2001 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) << (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2002 | break; |
2003 | ||
2004 | case 58: | |
2005 | ||
2a6a08ca | 2006 | /* Line 1806 of yacc.c */ |
cd296721 | 2007 | #line 400 "dtc-parser.y" |
2a6a08ca | 2008 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) >> (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2009 | break; |
2010 | ||
2011 | case 60: | |
2012 | ||
2a6a08ca | 2013 | /* Line 1806 of yacc.c */ |
cd296721 | 2014 | #line 405 "dtc-parser.y" |
2a6a08ca | 2015 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) + (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2016 | break; |
2017 | ||
2018 | case 61: | |
2019 | ||
2a6a08ca | 2020 | /* Line 1806 of yacc.c */ |
cd296721 | 2021 | #line 406 "dtc-parser.y" |
2a6a08ca | 2022 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) - (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2023 | break; |
2024 | ||
2025 | case 63: | |
2026 | ||
2a6a08ca | 2027 | /* Line 1806 of yacc.c */ |
cd296721 | 2028 | #line 411 "dtc-parser.y" |
2a6a08ca | 2029 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) * (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2030 | break; |
2031 | ||
2032 | case 64: | |
2033 | ||
2a6a08ca | 2034 | /* Line 1806 of yacc.c */ |
cd296721 | 2035 | #line 412 "dtc-parser.y" |
2a6a08ca | 2036 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) / (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2037 | break; |
2038 | ||
2039 | case 65: | |
2040 | ||
2a6a08ca | 2041 | /* Line 1806 of yacc.c */ |
cd296721 | 2042 | #line 413 "dtc-parser.y" |
2a6a08ca | 2043 | { (yyval.integer) = (yyvsp[(1) - (3)].integer) % (yyvsp[(3) - (3)].integer); } |
cd296721 SW |
2044 | break; |
2045 | ||
2046 | case 68: | |
2047 | ||
2a6a08ca | 2048 | /* Line 1806 of yacc.c */ |
cd296721 | 2049 | #line 419 "dtc-parser.y" |
2a6a08ca | 2050 | { (yyval.integer) = -(yyvsp[(2) - (2)].integer); } |
cd296721 SW |
2051 | break; |
2052 | ||
2053 | case 69: | |
2054 | ||
2a6a08ca | 2055 | /* Line 1806 of yacc.c */ |
cd296721 | 2056 | #line 420 "dtc-parser.y" |
2a6a08ca | 2057 | { (yyval.integer) = ~(yyvsp[(2) - (2)].integer); } |
cd296721 SW |
2058 | break; |
2059 | ||
2060 | case 70: | |
2061 | ||
2a6a08ca | 2062 | /* Line 1806 of yacc.c */ |
cd296721 | 2063 | #line 421 "dtc-parser.y" |
2a6a08ca | 2064 | { (yyval.integer) = !(yyvsp[(2) - (2)].integer); } |
cd296721 SW |
2065 | break; |
2066 | ||
2067 | case 71: | |
2068 | ||
2a6a08ca | 2069 | /* Line 1806 of yacc.c */ |
cd296721 SW |
2070 | #line 426 "dtc-parser.y" |
2071 | { | |
2072 | (yyval.data) = empty_data; | |
2a6a08ca | 2073 | } |
cd296721 SW |
2074 | break; |
2075 | ||
2076 | case 72: | |
2077 | ||
2a6a08ca | 2078 | /* Line 1806 of yacc.c */ |
cd296721 SW |
2079 | #line 430 "dtc-parser.y" |
2080 | { | |
2081 | (yyval.data) = data_append_byte((yyvsp[(1) - (2)].data), (yyvsp[(2) - (2)].byte)); | |
2a6a08ca | 2082 | } |
cd296721 SW |
2083 | break; |
2084 | ||
2085 | case 73: | |
2086 | ||
2a6a08ca | 2087 | /* Line 1806 of yacc.c */ |
cd296721 SW |
2088 | #line 434 "dtc-parser.y" |
2089 | { | |
2090 | (yyval.data) = data_add_marker((yyvsp[(1) - (2)].data), LABEL, (yyvsp[(2) - (2)].labelref)); | |
2a6a08ca | 2091 | } |
cd296721 SW |
2092 | break; |
2093 | ||
2094 | case 74: | |
2095 | ||
2a6a08ca | 2096 | /* Line 1806 of yacc.c */ |
cd296721 | 2097 | #line 441 "dtc-parser.y" |
a4da2e3e DG |
2098 | { |
2099 | (yyval.nodelist) = NULL; | |
2a6a08ca | 2100 | } |
a4da2e3e DG |
2101 | break; |
2102 | ||
cd296721 | 2103 | case 75: |
658f29a5 | 2104 | |
2a6a08ca | 2105 | /* Line 1806 of yacc.c */ |
cd296721 | 2106 | #line 445 "dtc-parser.y" |
a4da2e3e DG |
2107 | { |
2108 | (yyval.nodelist) = chain_node((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].nodelist)); | |
2a6a08ca | 2109 | } |
a4da2e3e DG |
2110 | break; |
2111 | ||
cd296721 | 2112 | case 76: |
658f29a5 | 2113 | |
2a6a08ca | 2114 | /* Line 1806 of yacc.c */ |
cd296721 | 2115 | #line 449 "dtc-parser.y" |
a4da2e3e | 2116 | { |
658f29a5 | 2117 | print_error("syntax error: properties must precede subnodes"); |
a4da2e3e | 2118 | YYERROR; |
2a6a08ca | 2119 | } |
a4da2e3e DG |
2120 | break; |
2121 | ||
cd296721 | 2122 | case 77: |
a4da2e3e | 2123 | |
2a6a08ca | 2124 | /* Line 1806 of yacc.c */ |
cd296721 | 2125 | #line 457 "dtc-parser.y" |
a4da2e3e | 2126 | { |
658f29a5 | 2127 | (yyval.node) = name_node((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].propnodename)); |
2a6a08ca | 2128 | } |
a4da2e3e DG |
2129 | break; |
2130 | ||
cd296721 SW |
2131 | case 78: |
2132 | ||
2a6a08ca | 2133 | /* Line 1806 of yacc.c */ |
cd296721 SW |
2134 | #line 461 "dtc-parser.y" |
2135 | { | |
2136 | (yyval.node) = name_node(build_node_delete(), (yyvsp[(2) - (3)].propnodename)); | |
2a6a08ca | 2137 | } |
cd296721 SW |
2138 | break; |
2139 | ||
2140 | case 79: | |
658f29a5 | 2141 | |
2a6a08ca | 2142 | /* Line 1806 of yacc.c */ |
cd296721 | 2143 | #line 465 "dtc-parser.y" |
a4da2e3e | 2144 | { |
658f29a5 JB |
2145 | add_label(&(yyvsp[(2) - (2)].node)->labels, (yyvsp[(1) - (2)].labelref)); |
2146 | (yyval.node) = (yyvsp[(2) - (2)].node); | |
2a6a08ca | 2147 | } |
a4da2e3e DG |
2148 | break; |
2149 | ||
2150 | ||
658f29a5 | 2151 | |
2a6a08ca GL |
2152 | /* Line 1806 of yacc.c */ |
2153 | #line 2154 "dtc-parser.tab.c" | |
a4da2e3e DG |
2154 | default: break; |
2155 | } | |
2a6a08ca GL |
2156 | /* 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. */ | |
a4da2e3e DG |
2167 | YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); |
2168 | ||
2169 | YYPOPSTACK (yylen); | |
2170 | yylen = 0; | |
2171 | YY_STACK_PRINT (yyss, yyssp); | |
2172 | ||
2173 | *++yyvsp = yyval; | |
a4da2e3e DG |
2174 | |
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 | `------------------------------------*/ | |
2193 | yyerrlab: | |
2a6a08ca GL |
2194 | /* 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 | ||
a4da2e3e DG |
2198 | /* 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 | |
2a6a08ca GL |
2205 | # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ |
2206 | yyssp, yytoken) | |
a4da2e3e | 2207 | { |
2a6a08ca GL |
2208 | 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; | |
a4da2e3e | 2233 | } |
2a6a08ca | 2234 | # undef YYSYNTAX_ERROR |
a4da2e3e DG |
2235 | #endif |
2236 | } | |
2237 | ||
658f29a5 | 2238 | |
a4da2e3e DG |
2239 | |
2240 | if (yyerrstatus == 3) | |
2241 | { | |
658f29a5 | 2242 | /* If just tried and failed to reuse lookahead token after an |
a4da2e3e DG |
2243 | 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", | |
658f29a5 | 2254 | yytoken, &yylval); |
a4da2e3e DG |
2255 | yychar = YYEMPTY; |
2256 | } | |
2257 | } | |
2258 | ||
658f29a5 | 2259 | /* Else will try to reuse lookahead token after shifting the error |
a4da2e3e DG |
2260 | token. */ |
2261 | goto yyerrlab1; | |
2262 | ||
2263 | ||
2264 | /*---------------------------------------------------. | |
2265 | | yyerrorlab -- error raised explicitly by YYERROR. | | |
2266 | `---------------------------------------------------*/ | |
2267 | yyerrorlab: | |
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 | ||
a4da2e3e DG |
2275 | /* 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 | `-------------------------------------------------------------*/ | |
2287 | yyerrlab1: | |
2288 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | |
2289 | ||
2290 | for (;;) | |
2291 | { | |
2292 | yyn = yypact[yystate]; | |
2a6a08ca | 2293 | if (!yypact_value_is_default (yyn)) |
a4da2e3e DG |
2294 | { |
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 | ||
658f29a5 | 2308 | |
a4da2e3e | 2309 | yydestruct ("Error: popping", |
658f29a5 | 2310 | yystos[yystate], yyvsp); |
a4da2e3e DG |
2311 | YYPOPSTACK (1); |
2312 | yystate = *yyssp; | |
2313 | YY_STACK_PRINT (yyss, yyssp); | |
2314 | } | |
2315 | ||
a4da2e3e DG |
2316 | *++yyvsp = yylval; |
2317 | ||
a4da2e3e DG |
2318 | |
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 | `-------------------------------------*/ | |
2329 | yyacceptlab: | |
2330 | yyresult = 0; | |
2331 | goto yyreturn; | |
2332 | ||
2333 | /*-----------------------------------. | |
2334 | | yyabortlab -- YYABORT comes here. | | |
2335 | `-----------------------------------*/ | |
2336 | yyabortlab: | |
2337 | yyresult = 1; | |
2338 | goto yyreturn; | |
2339 | ||
658f29a5 | 2340 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
a4da2e3e DG |
2341 | /*-------------------------------------------------. |
2342 | | yyexhaustedlab -- memory exhaustion comes here. | | |
2343 | `-------------------------------------------------*/ | |
2344 | yyexhaustedlab: | |
2345 | yyerror (YY_("memory exhausted")); | |
2346 | yyresult = 2; | |
2347 | /* Fall through. */ | |
2348 | #endif | |
2349 | ||
2350 | yyreturn: | |
658f29a5 | 2351 | if (yychar != YYEMPTY) |
2a6a08ca GL |
2352 | { |
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 | } | |
a4da2e3e DG |
2359 | /* 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", | |
658f29a5 | 2366 | yystos[*yyssp], yyvsp); |
a4da2e3e DG |
2367 | 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 | ||
658f29a5 | 2382 | |
2a6a08ca | 2383 | /* Line 2067 of yacc.c */ |
cd296721 | 2384 | #line 471 "dtc-parser.y" |
a4da2e3e DG |
2385 | |
2386 | ||
658f29a5 | 2387 | void print_error(char const *fmt, ...) |
a4da2e3e | 2388 | { |
ed95d745 | 2389 | va_list va; |
a4da2e3e | 2390 | |
658f29a5 JB |
2391 | va_start(va, fmt); |
2392 | srcpos_verror(&yylloc, fmt, va); | |
2393 | va_end(va); | |
ed95d745 DG |
2394 | |
2395 | treesource_error = 1; | |
ed95d745 DG |
2396 | } |
2397 | ||
658f29a5 JB |
2398 | void yyerror(char const *s) { |
2399 | print_error("%s", s); | |
a4da2e3e DG |
2400 | } |
2401 | ||
ed95d745 | 2402 | static unsigned long long eval_literal(const char *s, int base, int bits) |
a4da2e3e DG |
2403 | { |
2404 | unsigned long long val; | |
2405 | char *e; | |
2406 | ||
2407 | errno = 0; | |
2408 | val = strtoull(s, &e, base); | |
cd296721 SW |
2409 | 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) | |
a4da2e3e | 2415 | || ((bits < 64) && (val >= (1ULL << bits)))) |
658f29a5 | 2416 | print_error("literal out of range"); |
a4da2e3e | 2417 | else if (errno != 0) |
658f29a5 | 2418 | print_error("bad literal"); |
a4da2e3e DG |
2419 | return val; |
2420 | } | |
2421 | ||
cd296721 SW |
2422 | static 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 |