dtc-parser.tab.c_shipped 68 KB

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