dtc-parser.tab.c_shipped 64 KB

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