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