dtc-parser.tab.c_shipped 52 KB

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