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