dtc-parser.tab.c_shipped 68 KB

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