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