dtc-lexer.lex.c_shipped 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255
  1. #line 2 "dtc-lexer.lex.c"
  2. #line 4 "dtc-lexer.lex.c"
  3. #define YY_INT_ALIGNED short int
  4. /* A lexical scanner generated by flex */
  5. #define FLEX_SCANNER
  6. #define YY_FLEX_MAJOR_VERSION 2
  7. #define YY_FLEX_MINOR_VERSION 5
  8. #define YY_FLEX_SUBMINOR_VERSION 35
  9. #if YY_FLEX_SUBMINOR_VERSION > 0
  10. #define FLEX_BETA
  11. #endif
  12. /* First, we deal with platform-specific or compiler-specific issues. */
  13. /* begin standard C headers. */
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <errno.h>
  17. #include <stdlib.h>
  18. /* end standard C headers. */
  19. /* flex integer type definitions */
  20. #ifndef FLEXINT_H
  21. #define FLEXINT_H
  22. /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
  23. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  24. /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
  25. * if you want the limit (max/min) macros for int types.
  26. */
  27. #ifndef __STDC_LIMIT_MACROS
  28. #define __STDC_LIMIT_MACROS 1
  29. #endif
  30. #include <inttypes.h>
  31. typedef int8_t flex_int8_t;
  32. typedef uint8_t flex_uint8_t;
  33. typedef int16_t flex_int16_t;
  34. typedef uint16_t flex_uint16_t;
  35. typedef int32_t flex_int32_t;
  36. typedef uint32_t flex_uint32_t;
  37. #else
  38. typedef signed char flex_int8_t;
  39. typedef short int flex_int16_t;
  40. typedef int flex_int32_t;
  41. typedef unsigned char flex_uint8_t;
  42. typedef unsigned short int flex_uint16_t;
  43. typedef unsigned int flex_uint32_t;
  44. /* Limits of integral types. */
  45. #ifndef INT8_MIN
  46. #define INT8_MIN (-128)
  47. #endif
  48. #ifndef INT16_MIN
  49. #define INT16_MIN (-32767-1)
  50. #endif
  51. #ifndef INT32_MIN
  52. #define INT32_MIN (-2147483647-1)
  53. #endif
  54. #ifndef INT8_MAX
  55. #define INT8_MAX (127)
  56. #endif
  57. #ifndef INT16_MAX
  58. #define INT16_MAX (32767)
  59. #endif
  60. #ifndef INT32_MAX
  61. #define INT32_MAX (2147483647)
  62. #endif
  63. #ifndef UINT8_MAX
  64. #define UINT8_MAX (255U)
  65. #endif
  66. #ifndef UINT16_MAX
  67. #define UINT16_MAX (65535U)
  68. #endif
  69. #ifndef UINT32_MAX
  70. #define UINT32_MAX (4294967295U)
  71. #endif
  72. #endif /* ! C99 */
  73. #endif /* ! FLEXINT_H */
  74. #ifdef __cplusplus
  75. /* The "const" storage-class-modifier is valid. */
  76. #define YY_USE_CONST
  77. #else /* ! __cplusplus */
  78. /* C99 requires __STDC__ to be defined as 1. */
  79. #if defined (__STDC__)
  80. #define YY_USE_CONST
  81. #endif /* defined (__STDC__) */
  82. #endif /* ! __cplusplus */
  83. #ifdef YY_USE_CONST
  84. #define yyconst const
  85. #else
  86. #define yyconst
  87. #endif
  88. /* Returned upon end-of-file. */
  89. #define YY_NULL 0
  90. /* Promotes a possibly negative, possibly signed char to an unsigned
  91. * integer for use as an array index. If the signed char is negative,
  92. * we want to instead treat it as an 8-bit unsigned char, hence the
  93. * double cast.
  94. */
  95. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  96. /* Enter a start condition. This macro really ought to take a parameter,
  97. * but we do it the disgusting crufty way forced on us by the ()-less
  98. * definition of BEGIN.
  99. */
  100. #define BEGIN (yy_start) = 1 + 2 *
  101. /* Translate the current start state into a value that can be later handed
  102. * to BEGIN to return to the state. The YYSTATE alias is for lex
  103. * compatibility.
  104. */
  105. #define YY_START (((yy_start) - 1) / 2)
  106. #define YYSTATE YY_START
  107. /* Action number for EOF rule of a given start state. */
  108. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  109. /* Special action meaning "start processing a new file". */
  110. #define YY_NEW_FILE yyrestart(yyin )
  111. #define YY_END_OF_BUFFER_CHAR 0
  112. /* Size of default input buffer. */
  113. #ifndef YY_BUF_SIZE
  114. #ifdef __ia64__
  115. /* On IA-64, the buffer size is 16k, not 8k.
  116. * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
  117. * Ditto for the __ia64__ case accordingly.
  118. */
  119. #define YY_BUF_SIZE 32768
  120. #else
  121. #define YY_BUF_SIZE 16384
  122. #endif /* __ia64__ */
  123. #endif
  124. /* The state buf must be large enough to hold one state per character in the main buffer.
  125. */
  126. #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
  127. #ifndef YY_TYPEDEF_YY_BUFFER_STATE
  128. #define YY_TYPEDEF_YY_BUFFER_STATE
  129. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  130. #endif
  131. extern int yyleng;
  132. extern FILE *yyin, *yyout;
  133. #define EOB_ACT_CONTINUE_SCAN 0
  134. #define EOB_ACT_END_OF_FILE 1
  135. #define EOB_ACT_LAST_MATCH 2
  136. #define YY_LESS_LINENO(n)
  137. /* Return all but the first "n" matched characters back to the input stream. */
  138. #define yyless(n) \
  139. do \
  140. { \
  141. /* Undo effects of setting up yytext. */ \
  142. int yyless_macro_arg = (n); \
  143. YY_LESS_LINENO(yyless_macro_arg);\
  144. *yy_cp = (yy_hold_char); \
  145. YY_RESTORE_YY_MORE_OFFSET \
  146. (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
  147. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  148. } \
  149. while ( 0 )
  150. #define unput(c) yyunput( c, (yytext_ptr) )
  151. #ifndef YY_TYPEDEF_YY_SIZE_T
  152. #define YY_TYPEDEF_YY_SIZE_T
  153. typedef size_t yy_size_t;
  154. #endif
  155. #ifndef YY_STRUCT_YY_BUFFER_STATE
  156. #define YY_STRUCT_YY_BUFFER_STATE
  157. struct yy_buffer_state
  158. {
  159. FILE *yy_input_file;
  160. char *yy_ch_buf; /* input buffer */
  161. char *yy_buf_pos; /* current position in input buffer */
  162. /* Size of input buffer in bytes, not including room for EOB
  163. * characters.
  164. */
  165. yy_size_t yy_buf_size;
  166. /* Number of characters read into yy_ch_buf, not including EOB
  167. * characters.
  168. */
  169. int yy_n_chars;
  170. /* Whether we "own" the buffer - i.e., we know we created it,
  171. * and can realloc() it to grow it, and should free() it to
  172. * delete it.
  173. */
  174. int yy_is_our_buffer;
  175. /* Whether this is an "interactive" input source; if so, and
  176. * if we're using stdio for input, then we want to use getc()
  177. * instead of fread(), to make sure we stop fetching input after
  178. * each newline.
  179. */
  180. int yy_is_interactive;
  181. /* Whether we're considered to be at the beginning of a line.
  182. * If so, '^' rules will be active on the next match, otherwise
  183. * not.
  184. */
  185. int yy_at_bol;
  186. int yy_bs_lineno; /**< The line count. */
  187. int yy_bs_column; /**< The column count. */
  188. /* Whether to try to fill the input buffer when we reach the
  189. * end of it.
  190. */
  191. int yy_fill_buffer;
  192. int yy_buffer_status;
  193. #define YY_BUFFER_NEW 0
  194. #define YY_BUFFER_NORMAL 1
  195. /* When an EOF's been seen but there's still some text to process
  196. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  197. * shouldn't try reading from the input source any more. We might
  198. * still have a bunch of tokens to match, though, because of
  199. * possible backing-up.
  200. *
  201. * When we actually see the EOF, we change the status to "new"
  202. * (via yyrestart()), so that the user can continue scanning by
  203. * just pointing yyin at a new input file.
  204. */
  205. #define YY_BUFFER_EOF_PENDING 2
  206. };
  207. #endif /* !YY_STRUCT_YY_BUFFER_STATE */
  208. /* Stack of input buffers. */
  209. static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
  210. static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
  211. static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
  212. /* We provide macros for accessing buffer states in case in the
  213. * future we want to put the buffer states in a more general
  214. * "scanner state".
  215. *
  216. * Returns the top of the stack, or NULL.
  217. */
  218. #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
  219. ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
  220. : NULL)
  221. /* Same as previous macro, but useful when we know that the buffer stack is not
  222. * NULL or when we need an lvalue. For internal use only.
  223. */
  224. #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
  225. /* yy_hold_char holds the character lost when yytext is formed. */
  226. static char yy_hold_char;
  227. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  228. int yyleng;
  229. /* Points to current character in buffer. */
  230. static char *yy_c_buf_p = (char *) 0;
  231. static int yy_init = 0; /* whether we need to initialize */
  232. static int yy_start = 0; /* start state number */
  233. /* Flag which is used to allow yywrap()'s to do buffer switches
  234. * instead of setting up a fresh yyin. A bit of a hack ...
  235. */
  236. static int yy_did_buffer_switch_on_eof;
  237. void yyrestart (FILE *input_file );
  238. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
  239. YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
  240. void yy_delete_buffer (YY_BUFFER_STATE b );
  241. void yy_flush_buffer (YY_BUFFER_STATE b );
  242. void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
  243. void yypop_buffer_state (void );
  244. static void yyensure_buffer_stack (void );
  245. static void yy_load_buffer_state (void );
  246. static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
  247. #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
  248. YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
  249. YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
  250. YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
  251. void *yyalloc (yy_size_t );
  252. void *yyrealloc (void *,yy_size_t );
  253. void yyfree (void * );
  254. #define yy_new_buffer yy_create_buffer
  255. #define yy_set_interactive(is_interactive) \
  256. { \
  257. if ( ! YY_CURRENT_BUFFER ){ \
  258. yyensure_buffer_stack (); \
  259. YY_CURRENT_BUFFER_LVALUE = \
  260. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  261. } \
  262. YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
  263. }
  264. #define yy_set_bol(at_bol) \
  265. { \
  266. if ( ! YY_CURRENT_BUFFER ){\
  267. yyensure_buffer_stack (); \
  268. YY_CURRENT_BUFFER_LVALUE = \
  269. yy_create_buffer(yyin,YY_BUF_SIZE ); \
  270. } \
  271. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
  272. }
  273. #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
  274. /* Begin user sect3 */
  275. #define yywrap(n) 1
  276. #define YY_SKIP_YYWRAP
  277. typedef unsigned char YY_CHAR;
  278. FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
  279. typedef int yy_state_type;
  280. extern int yylineno;
  281. int yylineno = 1;
  282. extern char *yytext;
  283. #define yytext_ptr yytext
  284. static yy_state_type yy_get_previous_state (void );
  285. static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
  286. static int yy_get_next_buffer (void );
  287. static void yy_fatal_error (yyconst char msg[] );
  288. /* Done after the current pattern has been matched and before the
  289. * corresponding action - sets up yytext.
  290. */
  291. #define YY_DO_BEFORE_ACTION \
  292. (yytext_ptr) = yy_bp; \
  293. yyleng = (size_t) (yy_cp - yy_bp); \
  294. (yy_hold_char) = *yy_cp; \
  295. *yy_cp = '\0'; \
  296. (yy_c_buf_p) = yy_cp;
  297. #define YY_NUM_RULES 31
  298. #define YY_END_OF_BUFFER 32
  299. /* This struct is not used in this scanner,
  300. but its presence is necessary. */
  301. struct yy_trans_info
  302. {
  303. flex_int32_t yy_verify;
  304. flex_int32_t yy_nxt;
  305. };
  306. static yyconst flex_int16_t yy_accept[166] =
  307. { 0,
  308. 0, 0, 0, 0, 0, 0, 0, 0, 32, 30,
  309. 19, 19, 30, 30, 30, 30, 30, 30, 30, 30,
  310. 30, 30, 30, 30, 30, 30, 16, 17, 17, 30,
  311. 17, 11, 11, 19, 27, 0, 3, 0, 28, 13,
  312. 0, 0, 12, 0, 0, 0, 0, 0, 0, 0,
  313. 0, 22, 24, 26, 25, 23, 0, 10, 29, 0,
  314. 0, 0, 15, 15, 17, 17, 17, 11, 11, 11,
  315. 0, 13, 0, 12, 0, 0, 0, 21, 0, 0,
  316. 0, 0, 0, 0, 0, 0, 0, 17, 11, 11,
  317. 11, 0, 14, 20, 0, 0, 0, 0, 0, 0,
  318. 0, 0, 0, 0, 17, 0, 0, 0, 0, 0,
  319. 0, 0, 0, 0, 0, 17, 7, 0, 0, 0,
  320. 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
  321. 0, 0, 0, 0, 4, 18, 0, 0, 5, 2,
  322. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  323. 0, 0, 1, 0, 0, 0, 0, 6, 9, 0,
  324. 0, 0, 0, 8, 0
  325. } ;
  326. static yyconst flex_int32_t yy_ec[256] =
  327. { 0,
  328. 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
  329. 4, 4, 4, 1, 1, 1, 1, 1, 1, 1,
  330. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  331. 1, 2, 5, 6, 7, 1, 1, 8, 9, 1,
  332. 1, 10, 11, 11, 12, 11, 13, 14, 15, 16,
  333. 16, 16, 16, 16, 16, 16, 16, 17, 1, 18,
  334. 19, 20, 11, 11, 21, 21, 21, 21, 21, 21,
  335. 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
  336. 22, 22, 22, 22, 24, 22, 22, 25, 22, 22,
  337. 1, 26, 27, 1, 22, 1, 21, 28, 29, 30,
  338. 31, 21, 32, 22, 33, 22, 22, 34, 35, 36,
  339. 37, 38, 22, 39, 40, 41, 42, 43, 22, 25,
  340. 44, 22, 45, 46, 47, 1, 1, 1, 1, 1,
  341. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  342. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  343. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  344. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  345. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  346. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  347. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  348. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  349. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  350. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  351. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  352. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  353. 1, 1, 1, 1, 1
  354. } ;
  355. static yyconst flex_int32_t yy_meta[48] =
  356. { 0,
  357. 1, 1, 1, 1, 1, 1, 2, 3, 1, 2,
  358. 2, 2, 4, 5, 5, 5, 6, 1, 1, 1,
  359. 7, 8, 8, 8, 8, 1, 1, 7, 7, 7,
  360. 7, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  361. 8, 8, 8, 8, 3, 1, 4
  362. } ;
  363. static yyconst flex_int16_t yy_base[180] =
  364. { 0,
  365. 0, 393, 35, 392, 66, 391, 38, 107, 397, 401,
  366. 55, 113, 377, 112, 111, 111, 114, 42, 376, 106,
  367. 377, 347, 126, 120, 0, 147, 401, 0, 124, 0,
  368. 137, 158, 170, 163, 401, 153, 401, 389, 401, 0,
  369. 378, 120, 401, 131, 380, 386, 355, 139, 351, 355,
  370. 351, 401, 401, 401, 401, 401, 367, 401, 401, 185,
  371. 350, 346, 401, 364, 0, 185, 347, 189, 356, 355,
  372. 0, 0, 330, 180, 366, 141, 372, 361, 332, 338,
  373. 331, 341, 334, 326, 205, 331, 337, 329, 401, 341,
  374. 167, 316, 401, 349, 348, 320, 328, 346, 180, 318,
  375. 324, 209, 324, 320, 322, 342, 338, 309, 306, 315,
  376. 305, 315, 312, 192, 342, 341, 401, 293, 306, 282,
  377. 268, 252, 255, 203, 285, 282, 272, 268, 252, 233,
  378. 232, 239, 208, 107, 401, 401, 238, 211, 401, 211,
  379. 212, 208, 228, 203, 215, 207, 233, 222, 212, 211,
  380. 203, 227, 401, 237, 225, 204, 185, 401, 401, 149,
  381. 128, 88, 42, 401, 401, 253, 259, 267, 271, 275,
  382. 281, 288, 292, 300, 308, 312, 318, 326, 334
  383. } ;
  384. static yyconst flex_int16_t yy_def[180] =
  385. { 0,
  386. 165, 1, 1, 3, 165, 5, 1, 1, 165, 165,
  387. 165, 165, 165, 166, 167, 168, 165, 165, 165, 165,
  388. 169, 165, 165, 165, 170, 169, 165, 171, 172, 171,
  389. 171, 165, 165, 165, 165, 166, 165, 166, 165, 173,
  390. 165, 168, 165, 168, 174, 175, 165, 165, 165, 165,
  391. 165, 165, 165, 165, 165, 165, 169, 165, 165, 165,
  392. 165, 165, 165, 169, 171, 172, 171, 165, 165, 165,
  393. 176, 173, 177, 168, 174, 174, 175, 165, 165, 165,
  394. 165, 165, 165, 165, 165, 165, 165, 171, 165, 165,
  395. 176, 177, 165, 165, 165, 165, 165, 165, 165, 165,
  396. 165, 165, 165, 165, 171, 165, 165, 165, 165, 165,
  397. 165, 165, 165, 178, 165, 171, 165, 165, 165, 165,
  398. 165, 165, 165, 178, 165, 178, 165, 165, 165, 165,
  399. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  400. 165, 165, 165, 165, 165, 165, 165, 179, 165, 165,
  401. 165, 179, 165, 179, 165, 165, 165, 165, 165, 165,
  402. 165, 165, 165, 165, 0, 165, 165, 165, 165, 165,
  403. 165, 165, 165, 165, 165, 165, 165, 165, 165
  404. } ;
  405. static yyconst flex_int16_t yy_nxt[449] =
  406. { 0,
  407. 10, 11, 12, 11, 13, 14, 10, 15, 16, 10,
  408. 10, 10, 17, 10, 10, 10, 10, 18, 19, 20,
  409. 21, 21, 21, 21, 21, 10, 10, 21, 21, 21,
  410. 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
  411. 21, 21, 21, 21, 10, 22, 10, 24, 25, 25,
  412. 25, 32, 33, 33, 164, 26, 34, 34, 34, 52,
  413. 53, 27, 26, 26, 26, 26, 10, 11, 12, 11,
  414. 13, 14, 28, 15, 16, 28, 28, 28, 24, 28,
  415. 28, 28, 10, 18, 19, 20, 29, 29, 29, 29,
  416. 29, 30, 10, 29, 29, 29, 29, 29, 29, 29,
  417. 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
  418. 10, 22, 10, 23, 34, 34, 34, 37, 39, 43,
  419. 32, 33, 33, 45, 55, 56, 46, 60, 43, 45,
  420. 65, 163, 46, 65, 65, 65, 44, 38, 60, 74,
  421. 58, 47, 141, 48, 142, 44, 49, 47, 50, 48,
  422. 76, 51, 62, 94, 50, 41, 44, 51, 37, 61,
  423. 64, 64, 64, 58, 34, 34, 34, 64, 162, 80,
  424. 67, 68, 68, 68, 64, 64, 64, 64, 38, 81,
  425. 69, 70, 71, 68, 68, 68, 60, 161, 43, 69,
  426. 70, 65, 69, 70, 65, 65, 65, 125, 85, 85,
  427. 85, 58, 68, 68, 68, 44, 102, 110, 125, 133,
  428. 102, 69, 70, 111, 114, 160, 159, 126, 85, 85,
  429. 85, 140, 140, 140, 140, 140, 140, 153, 126, 147,
  430. 147, 147, 153, 148, 147, 147, 147, 158, 148, 165,
  431. 157, 156, 155, 151, 150, 149, 146, 154, 145, 144,
  432. 143, 139, 154, 36, 36, 36, 36, 36, 36, 36,
  433. 36, 40, 138, 137, 136, 40, 40, 42, 42, 42,
  434. 42, 42, 42, 42, 42, 57, 57, 57, 57, 63,
  435. 135, 63, 65, 134, 165, 65, 133, 65, 65, 66,
  436. 132, 131, 66, 66, 66, 66, 72, 130, 72, 72,
  437. 75, 75, 75, 75, 75, 75, 75, 75, 77, 77,
  438. 77, 77, 77, 77, 77, 77, 91, 129, 91, 92,
  439. 128, 92, 92, 127, 92, 92, 124, 124, 124, 124,
  440. 124, 124, 124, 124, 152, 152, 152, 152, 152, 152,
  441. 152, 152, 60, 60, 123, 122, 121, 120, 119, 118,
  442. 117, 45, 116, 111, 115, 113, 112, 109, 108, 107,
  443. 46, 106, 93, 89, 105, 104, 103, 101, 100, 99,
  444. 98, 97, 96, 95, 78, 76, 93, 90, 89, 88,
  445. 58, 87, 86, 58, 84, 83, 82, 79, 78, 76,
  446. 73, 165, 59, 58, 54, 35, 165, 31, 23, 23,
  447. 9, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  448. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  449. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  450. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  451. 165, 165, 165, 165, 165, 165, 165, 165
  452. } ;
  453. static yyconst flex_int16_t yy_chk[449] =
  454. { 0,
  455. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  456. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  457. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  458. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
  459. 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
  460. 3, 7, 7, 7, 163, 3, 11, 11, 11, 18,
  461. 18, 3, 3, 3, 3, 3, 5, 5, 5, 5,
  462. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  463. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  464. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  465. 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  466. 5, 5, 5, 8, 12, 12, 12, 14, 15, 16,
  467. 8, 8, 8, 17, 20, 20, 17, 23, 42, 24,
  468. 29, 162, 24, 29, 29, 29, 16, 14, 31, 44,
  469. 29, 17, 134, 17, 134, 42, 17, 24, 17, 24,
  470. 76, 17, 24, 76, 24, 15, 44, 24, 36, 23,
  471. 26, 26, 26, 26, 34, 34, 34, 26, 161, 48,
  472. 31, 32, 32, 32, 26, 26, 26, 26, 36, 48,
  473. 32, 32, 32, 33, 33, 33, 60, 160, 74, 91,
  474. 91, 66, 33, 33, 66, 66, 66, 114, 60, 60,
  475. 60, 66, 68, 68, 68, 74, 85, 99, 124, 133,
  476. 102, 68, 68, 99, 102, 157, 156, 114, 85, 85,
  477. 85, 133, 133, 133, 140, 140, 140, 148, 124, 143,
  478. 143, 143, 152, 143, 147, 147, 147, 155, 147, 154,
  479. 151, 150, 149, 146, 145, 144, 142, 148, 141, 138,
  480. 137, 132, 152, 166, 166, 166, 166, 166, 166, 166,
  481. 166, 167, 131, 130, 129, 167, 167, 168, 168, 168,
  482. 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
  483. 128, 170, 171, 127, 126, 171, 125, 171, 171, 172,
  484. 123, 122, 172, 172, 172, 172, 173, 121, 173, 173,
  485. 174, 174, 174, 174, 174, 174, 174, 174, 175, 175,
  486. 175, 175, 175, 175, 175, 175, 176, 120, 176, 177,
  487. 119, 177, 177, 118, 177, 177, 178, 178, 178, 178,
  488. 178, 178, 178, 178, 179, 179, 179, 179, 179, 179,
  489. 179, 179, 116, 115, 113, 112, 111, 110, 109, 108,
  490. 107, 106, 105, 104, 103, 101, 100, 98, 97, 96,
  491. 95, 94, 92, 90, 88, 87, 86, 84, 83, 82,
  492. 81, 80, 79, 78, 77, 75, 73, 70, 69, 67,
  493. 64, 62, 61, 57, 51, 50, 49, 47, 46, 45,
  494. 41, 38, 22, 21, 19, 13, 9, 6, 4, 2,
  495. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  496. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  497. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  498. 165, 165, 165, 165, 165, 165, 165, 165, 165, 165,
  499. 165, 165, 165, 165, 165, 165, 165, 165
  500. } ;
  501. static yy_state_type yy_last_accepting_state;
  502. static char *yy_last_accepting_cpos;
  503. extern int yy_flex_debug;
  504. int yy_flex_debug = 0;
  505. /* The intent behind this definition is that it'll catch
  506. * any uses of REJECT which flex missed.
  507. */
  508. #define REJECT reject_used_but_not_detected
  509. #define yymore() yymore_used_but_not_detected
  510. #define YY_MORE_ADJ 0
  511. #define YY_RESTORE_YY_MORE_OFFSET
  512. char *yytext;
  513. #line 1 "dtc-lexer.l"
  514. /*
  515. * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2005.
  516. *
  517. *
  518. * This program is free software; you can redistribute it and/or
  519. * modify it under the terms of the GNU General Public License as
  520. * published by the Free Software Foundation; either version 2 of the
  521. * License, or (at your option) any later version.
  522. *
  523. * This program is distributed in the hope that it will be useful,
  524. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  525. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  526. * General Public License for more details.
  527. *
  528. * You should have received a copy of the GNU General Public License
  529. * along with this program; if not, write to the Free Software
  530. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  531. * USA
  532. */
  533. #define YY_NO_INPUT 1
  534. #line 37 "dtc-lexer.l"
  535. #include "dtc.h"
  536. #include "srcpos.h"
  537. #include "dtc-parser.tab.h"
  538. YYLTYPE yylloc;
  539. extern bool treesource_error;
  540. /* CAUTION: this will stop working if we ever use yyless() or yyunput() */
  541. #define YY_USER_ACTION \
  542. { \
  543. srcpos_update(&yylloc, yytext, yyleng); \
  544. }
  545. /*#define LEXDEBUG 1*/
  546. #ifdef LEXDEBUG
  547. #define DPRINT(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
  548. #else
  549. #define DPRINT(fmt, ...) do { } while (0)
  550. #endif
  551. static int dts_version = 1;
  552. #define BEGIN_DEFAULT() DPRINT("<V1>\n"); \
  553. BEGIN(V1); \
  554. static void push_input_file(const char *filename);
  555. static bool pop_input_file(void);
  556. static void PRINTF(1, 2) lexical_error(const char *fmt, ...);
  557. #line 669 "dtc-lexer.lex.c"
  558. #define INITIAL 0
  559. #define BYTESTRING 1
  560. #define PROPNODENAME 2
  561. #define V1 3
  562. #ifndef YY_NO_UNISTD_H
  563. /* Special case for "unistd.h", since it is non-ANSI. We include it way
  564. * down here because we want the user's section 1 to have been scanned first.
  565. * The user has a chance to override it with an option.
  566. */
  567. #include <unistd.h>
  568. #endif
  569. #ifndef YY_EXTRA_TYPE
  570. #define YY_EXTRA_TYPE void *
  571. #endif
  572. static int yy_init_globals (void );
  573. /* Accessor methods to globals.
  574. These are made visible to non-reentrant scanners for convenience. */
  575. int yylex_destroy (void );
  576. int yyget_debug (void );
  577. void yyset_debug (int debug_flag );
  578. YY_EXTRA_TYPE yyget_extra (void );
  579. void yyset_extra (YY_EXTRA_TYPE user_defined );
  580. FILE *yyget_in (void );
  581. void yyset_in (FILE * in_str );
  582. FILE *yyget_out (void );
  583. void yyset_out (FILE * out_str );
  584. int yyget_leng (void );
  585. char *yyget_text (void );
  586. int yyget_lineno (void );
  587. void yyset_lineno (int line_number );
  588. /* Macros after this point can all be overridden by user definitions in
  589. * section 1.
  590. */
  591. #ifndef YY_SKIP_YYWRAP
  592. #ifdef __cplusplus
  593. extern "C" int yywrap (void );
  594. #else
  595. extern int yywrap (void );
  596. #endif
  597. #endif
  598. #ifndef yytext_ptr
  599. static void yy_flex_strncpy (char *,yyconst char *,int );
  600. #endif
  601. #ifdef YY_NEED_STRLEN
  602. static int yy_flex_strlen (yyconst char * );
  603. #endif
  604. #ifndef YY_NO_INPUT
  605. #ifdef __cplusplus
  606. static int yyinput (void );
  607. #else
  608. static int input (void );
  609. #endif
  610. #endif
  611. /* Amount of stuff to slurp up with each read. */
  612. #ifndef YY_READ_BUF_SIZE
  613. #ifdef __ia64__
  614. /* On IA-64, the buffer size is 16k, not 8k */
  615. #define YY_READ_BUF_SIZE 16384
  616. #else
  617. #define YY_READ_BUF_SIZE 8192
  618. #endif /* __ia64__ */
  619. #endif
  620. /* Copy whatever the last rule matched to the standard output. */
  621. #ifndef ECHO
  622. /* This used to be an fputs(), but since the string might contain NUL's,
  623. * we now use fwrite().
  624. */
  625. #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
  626. #endif
  627. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  628. * is returned in "result".
  629. */
  630. #ifndef YY_INPUT
  631. #define YY_INPUT(buf,result,max_size) \
  632. if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
  633. { \
  634. int c = '*'; \
  635. size_t n; \
  636. for ( n = 0; n < max_size && \
  637. (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
  638. buf[n] = (char) c; \
  639. if ( c == '\n' ) \
  640. buf[n++] = (char) c; \
  641. if ( c == EOF && ferror( yyin ) ) \
  642. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  643. result = n; \
  644. } \
  645. else \
  646. { \
  647. errno=0; \
  648. while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
  649. { \
  650. if( errno != EINTR) \
  651. { \
  652. YY_FATAL_ERROR( "input in flex scanner failed" ); \
  653. break; \
  654. } \
  655. errno=0; \
  656. clearerr(yyin); \
  657. } \
  658. }\
  659. \
  660. #endif
  661. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  662. * we don't want an extra ';' after the "return" because that will cause
  663. * some compilers to complain about unreachable statements.
  664. */
  665. #ifndef yyterminate
  666. #define yyterminate() return YY_NULL
  667. #endif
  668. /* Number of entries by which start-condition stack grows. */
  669. #ifndef YY_START_STACK_INCR
  670. #define YY_START_STACK_INCR 25
  671. #endif
  672. /* Report a fatal error. */
  673. #ifndef YY_FATAL_ERROR
  674. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  675. #endif
  676. /* end tables serialization structures and prototypes */
  677. /* Default declaration of generated scanner - a define so the user can
  678. * easily add parameters.
  679. */
  680. #ifndef YY_DECL
  681. #define YY_DECL_IS_OURS 1
  682. extern int yylex (void);
  683. #define YY_DECL int yylex (void)
  684. #endif /* !YY_DECL */
  685. /* Code executed at the beginning of each rule, after yytext and yyleng
  686. * have been set up.
  687. */
  688. #ifndef YY_USER_ACTION
  689. #define YY_USER_ACTION
  690. #endif
  691. /* Code executed at the end of each rule. */
  692. #ifndef YY_BREAK
  693. #define YY_BREAK break;
  694. #endif
  695. #define YY_RULE_SETUP \
  696. if ( yyleng > 0 ) \
  697. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
  698. (yytext[yyleng - 1] == '\n'); \
  699. YY_USER_ACTION
  700. /** The main scanner function which does all the work.
  701. */
  702. YY_DECL
  703. {
  704. register yy_state_type yy_current_state;
  705. register char *yy_cp, *yy_bp;
  706. register int yy_act;
  707. #line 69 "dtc-lexer.l"
  708. #line 862 "dtc-lexer.lex.c"
  709. if ( !(yy_init) )
  710. {
  711. (yy_init) = 1;
  712. #ifdef YY_USER_INIT
  713. YY_USER_INIT;
  714. #endif
  715. if ( ! (yy_start) )
  716. (yy_start) = 1; /* first start state */
  717. if ( ! yyin )
  718. yyin = stdin;
  719. if ( ! yyout )
  720. yyout = stdout;
  721. if ( ! YY_CURRENT_BUFFER ) {
  722. yyensure_buffer_stack ();
  723. YY_CURRENT_BUFFER_LVALUE =
  724. yy_create_buffer(yyin,YY_BUF_SIZE );
  725. }
  726. yy_load_buffer_state( );
  727. }
  728. while ( 1 ) /* loops until end-of-file is reached */
  729. {
  730. yy_cp = (yy_c_buf_p);
  731. /* Support of yytext. */
  732. *yy_cp = (yy_hold_char);
  733. /* yy_bp points to the position in yy_ch_buf of the start of
  734. * the current run.
  735. */
  736. yy_bp = yy_cp;
  737. yy_current_state = (yy_start);
  738. yy_current_state += YY_AT_BOL();
  739. yy_match:
  740. do
  741. {
  742. register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
  743. if ( yy_accept[yy_current_state] )
  744. {
  745. (yy_last_accepting_state) = yy_current_state;
  746. (yy_last_accepting_cpos) = yy_cp;
  747. }
  748. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  749. {
  750. yy_current_state = (int) yy_def[yy_current_state];
  751. if ( yy_current_state >= 166 )
  752. yy_c = yy_meta[(unsigned int) yy_c];
  753. }
  754. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  755. ++yy_cp;
  756. }
  757. while ( yy_current_state != 165 );
  758. yy_cp = (yy_last_accepting_cpos);
  759. yy_current_state = (yy_last_accepting_state);
  760. yy_find_action:
  761. yy_act = yy_accept[yy_current_state];
  762. YY_DO_BEFORE_ACTION;
  763. do_action: /* This label is used only to access EOF actions. */
  764. switch ( yy_act )
  765. { /* beginning of action switch */
  766. case 0: /* must back up */
  767. /* undo the effects of YY_DO_BEFORE_ACTION */
  768. *yy_cp = (yy_hold_char);
  769. yy_cp = (yy_last_accepting_cpos);
  770. yy_current_state = (yy_last_accepting_state);
  771. goto yy_find_action;
  772. case 1:
  773. /* rule 1 can match eol */
  774. YY_RULE_SETUP
  775. #line 70 "dtc-lexer.l"
  776. {
  777. char *name = strchr(yytext, '\"') + 1;
  778. yytext[yyleng-1] = '\0';
  779. push_input_file(name);
  780. }
  781. YY_BREAK
  782. case 2:
  783. /* rule 2 can match eol */
  784. YY_RULE_SETUP
  785. #line 76 "dtc-lexer.l"
  786. {
  787. char *line, *fnstart, *fnend;
  788. struct data fn;
  789. /* skip text before line # */
  790. line = yytext;
  791. while (!isdigit((unsigned char)*line))
  792. line++;
  793. /* regexp ensures that first and list "
  794. * in the whole yytext are those at
  795. * beginning and end of the filename string */
  796. fnstart = memchr(yytext, '"', yyleng);
  797. for (fnend = yytext + yyleng - 1;
  798. *fnend != '"'; fnend--)
  799. ;
  800. assert(fnstart && fnend && (fnend > fnstart));
  801. fn = data_copy_escape_string(fnstart + 1,
  802. fnend - fnstart - 1);
  803. /* Don't allow nuls in filenames */
  804. if (memchr(fn.val, '\0', fn.len - 1))
  805. lexical_error("nul in line number directive");
  806. /* -1 since #line is the number of the next line */
  807. srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
  808. data_free(fn);
  809. }
  810. YY_BREAK
  811. case YY_STATE_EOF(INITIAL):
  812. case YY_STATE_EOF(BYTESTRING):
  813. case YY_STATE_EOF(PROPNODENAME):
  814. case YY_STATE_EOF(V1):
  815. #line 105 "dtc-lexer.l"
  816. {
  817. if (!pop_input_file()) {
  818. yyterminate();
  819. }
  820. }
  821. YY_BREAK
  822. case 3:
  823. /* rule 3 can match eol */
  824. YY_RULE_SETUP
  825. #line 111 "dtc-lexer.l"
  826. {
  827. DPRINT("String: %s\n", yytext);
  828. yylval.data = data_copy_escape_string(yytext+1,
  829. yyleng-2);
  830. return DT_STRING;
  831. }
  832. YY_BREAK
  833. case 4:
  834. YY_RULE_SETUP
  835. #line 118 "dtc-lexer.l"
  836. {
  837. DPRINT("Keyword: /dts-v1/\n");
  838. dts_version = 1;
  839. BEGIN_DEFAULT();
  840. return DT_V1;
  841. }
  842. YY_BREAK
  843. case 5:
  844. YY_RULE_SETUP
  845. #line 125 "dtc-lexer.l"
  846. {
  847. DPRINT("Keyword: /plugin/\n");
  848. return DT_PLUGIN;
  849. }
  850. YY_BREAK
  851. case 6:
  852. YY_RULE_SETUP
  853. #line 130 "dtc-lexer.l"
  854. {
  855. DPRINT("Keyword: /memreserve/\n");
  856. BEGIN_DEFAULT();
  857. return DT_MEMRESERVE;
  858. }
  859. YY_BREAK
  860. case 7:
  861. YY_RULE_SETUP
  862. #line 136 "dtc-lexer.l"
  863. {
  864. DPRINT("Keyword: /bits/\n");
  865. BEGIN_DEFAULT();
  866. return DT_BITS;
  867. }
  868. YY_BREAK
  869. case 8:
  870. YY_RULE_SETUP
  871. #line 142 "dtc-lexer.l"
  872. {
  873. DPRINT("Keyword: /delete-property/\n");
  874. DPRINT("<PROPNODENAME>\n");
  875. BEGIN(PROPNODENAME);
  876. return DT_DEL_PROP;
  877. }
  878. YY_BREAK
  879. case 9:
  880. YY_RULE_SETUP
  881. #line 149 "dtc-lexer.l"
  882. {
  883. DPRINT("Keyword: /delete-node/\n");
  884. DPRINT("<PROPNODENAME>\n");
  885. BEGIN(PROPNODENAME);
  886. return DT_DEL_NODE;
  887. }
  888. YY_BREAK
  889. case 10:
  890. YY_RULE_SETUP
  891. #line 156 "dtc-lexer.l"
  892. {
  893. DPRINT("Label: %s\n", yytext);
  894. yylval.labelref = xstrdup(yytext);
  895. yylval.labelref[yyleng-1] = '\0';
  896. return DT_LABEL;
  897. }
  898. YY_BREAK
  899. case 11:
  900. YY_RULE_SETUP
  901. #line 163 "dtc-lexer.l"
  902. {
  903. char *e;
  904. DPRINT("Integer Literal: '%s'\n", yytext);
  905. errno = 0;
  906. yylval.integer = strtoull(yytext, &e, 0);
  907. if (*e && e[strspn(e, "UL")]) {
  908. lexical_error("Bad integer literal '%s'",
  909. yytext);
  910. }
  911. if (errno == ERANGE)
  912. lexical_error("Integer literal '%s' out of range",
  913. yytext);
  914. else
  915. /* ERANGE is the only strtoull error triggerable
  916. * by strings matching the pattern */
  917. assert(errno == 0);
  918. return DT_LITERAL;
  919. }
  920. YY_BREAK
  921. case 12:
  922. /* rule 12 can match eol */
  923. YY_RULE_SETUP
  924. #line 185 "dtc-lexer.l"
  925. {
  926. struct data d;
  927. DPRINT("Character literal: %s\n", yytext);
  928. d = data_copy_escape_string(yytext+1, yyleng-2);
  929. if (d.len == 1) {
  930. lexical_error("Empty character literal");
  931. yylval.integer = 0;
  932. } else {
  933. yylval.integer = (unsigned char)d.val[0];
  934. if (d.len > 2)
  935. lexical_error("Character literal has %d"
  936. " characters instead of 1",
  937. d.len - 1);
  938. }
  939. data_free(d);
  940. return DT_CHAR_LITERAL;
  941. }
  942. YY_BREAK
  943. case 13:
  944. YY_RULE_SETUP
  945. #line 206 "dtc-lexer.l"
  946. { /* label reference */
  947. DPRINT("Ref: %s\n", yytext+1);
  948. yylval.labelref = xstrdup(yytext+1);
  949. return DT_REF;
  950. }
  951. YY_BREAK
  952. case 14:
  953. YY_RULE_SETUP
  954. #line 212 "dtc-lexer.l"
  955. { /* new-style path reference */
  956. yytext[yyleng-1] = '\0';
  957. DPRINT("Ref: %s\n", yytext+2);
  958. yylval.labelref = xstrdup(yytext+2);
  959. return DT_REF;
  960. }
  961. YY_BREAK
  962. case 15:
  963. YY_RULE_SETUP
  964. #line 219 "dtc-lexer.l"
  965. {
  966. yylval.byte = strtol(yytext, NULL, 16);
  967. DPRINT("Byte: %02x\n", (int)yylval.byte);
  968. return DT_BYTE;
  969. }
  970. YY_BREAK
  971. case 16:
  972. YY_RULE_SETUP
  973. #line 225 "dtc-lexer.l"
  974. {
  975. DPRINT("/BYTESTRING\n");
  976. BEGIN_DEFAULT();
  977. return ']';
  978. }
  979. YY_BREAK
  980. case 17:
  981. YY_RULE_SETUP
  982. #line 231 "dtc-lexer.l"
  983. {
  984. DPRINT("PropNodeName: %s\n", yytext);
  985. yylval.propnodename = xstrdup((yytext[0] == '\\') ?
  986. yytext + 1 : yytext);
  987. BEGIN_DEFAULT();
  988. return DT_PROPNODENAME;
  989. }
  990. YY_BREAK
  991. case 18:
  992. YY_RULE_SETUP
  993. #line 239 "dtc-lexer.l"
  994. {
  995. DPRINT("Binary Include\n");
  996. return DT_INCBIN;
  997. }
  998. YY_BREAK
  999. case 19:
  1000. /* rule 19 can match eol */
  1001. YY_RULE_SETUP
  1002. #line 244 "dtc-lexer.l"
  1003. /* eat whitespace */
  1004. YY_BREAK
  1005. case 20:
  1006. /* rule 20 can match eol */
  1007. YY_RULE_SETUP
  1008. #line 245 "dtc-lexer.l"
  1009. /* eat C-style comments */
  1010. YY_BREAK
  1011. case 21:
  1012. /* rule 21 can match eol */
  1013. YY_RULE_SETUP
  1014. #line 246 "dtc-lexer.l"
  1015. /* eat C++-style comments */
  1016. YY_BREAK
  1017. case 22:
  1018. YY_RULE_SETUP
  1019. #line 248 "dtc-lexer.l"
  1020. { return DT_LSHIFT; };
  1021. YY_BREAK
  1022. case 23:
  1023. YY_RULE_SETUP
  1024. #line 249 "dtc-lexer.l"
  1025. { return DT_RSHIFT; };
  1026. YY_BREAK
  1027. case 24:
  1028. YY_RULE_SETUP
  1029. #line 250 "dtc-lexer.l"
  1030. { return DT_LE; };
  1031. YY_BREAK
  1032. case 25:
  1033. YY_RULE_SETUP
  1034. #line 251 "dtc-lexer.l"
  1035. { return DT_GE; };
  1036. YY_BREAK
  1037. case 26:
  1038. YY_RULE_SETUP
  1039. #line 252 "dtc-lexer.l"
  1040. { return DT_EQ; };
  1041. YY_BREAK
  1042. case 27:
  1043. YY_RULE_SETUP
  1044. #line 253 "dtc-lexer.l"
  1045. { return DT_NE; };
  1046. YY_BREAK
  1047. case 28:
  1048. YY_RULE_SETUP
  1049. #line 254 "dtc-lexer.l"
  1050. { return DT_AND; };
  1051. YY_BREAK
  1052. case 29:
  1053. YY_RULE_SETUP
  1054. #line 255 "dtc-lexer.l"
  1055. { return DT_OR; };
  1056. YY_BREAK
  1057. case 30:
  1058. YY_RULE_SETUP
  1059. #line 257 "dtc-lexer.l"
  1060. {
  1061. DPRINT("Char: %c (\\x%02x)\n", yytext[0],
  1062. (unsigned)yytext[0]);
  1063. if (yytext[0] == '[') {
  1064. DPRINT("<BYTESTRING>\n");
  1065. BEGIN(BYTESTRING);
  1066. }
  1067. if ((yytext[0] == '{')
  1068. || (yytext[0] == ';')) {
  1069. DPRINT("<PROPNODENAME>\n");
  1070. BEGIN(PROPNODENAME);
  1071. }
  1072. return yytext[0];
  1073. }
  1074. YY_BREAK
  1075. case 31:
  1076. YY_RULE_SETUP
  1077. #line 272 "dtc-lexer.l"
  1078. ECHO;
  1079. YY_BREAK
  1080. #line 1260 "dtc-lexer.lex.c"
  1081. case YY_END_OF_BUFFER:
  1082. {
  1083. /* Amount of text matched not including the EOB char. */
  1084. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  1085. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1086. *yy_cp = (yy_hold_char);
  1087. YY_RESTORE_YY_MORE_OFFSET
  1088. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1089. {
  1090. /* We're scanning a new file or input source. It's
  1091. * possible that this happened because the user
  1092. * just pointed yyin at a new source and called
  1093. * yylex(). If so, then we have to assure
  1094. * consistency between YY_CURRENT_BUFFER and our
  1095. * globals. Here is the right place to do so, because
  1096. * this is the first action (other than possibly a
  1097. * back-up) that will match for the new input source.
  1098. */
  1099. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1100. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1101. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1102. }
  1103. /* Note that here we test for yy_c_buf_p "<=" to the position
  1104. * of the first EOB in the buffer, since yy_c_buf_p will
  1105. * already have been incremented past the NUL character
  1106. * (since all states make transitions on EOB to the
  1107. * end-of-buffer state). Contrast this with the test
  1108. * in input().
  1109. */
  1110. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1111. { /* This was really a NUL. */
  1112. yy_state_type yy_next_state;
  1113. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1114. yy_current_state = yy_get_previous_state( );
  1115. /* Okay, we're now positioned to make the NUL
  1116. * transition. We couldn't have
  1117. * yy_get_previous_state() go ahead and do it
  1118. * for us because it doesn't know how to deal
  1119. * with the possibility of jamming (and we don't
  1120. * want to build jamming into it because then it
  1121. * will run more slowly).
  1122. */
  1123. yy_next_state = yy_try_NUL_trans( yy_current_state );
  1124. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1125. if ( yy_next_state )
  1126. {
  1127. /* Consume the NUL. */
  1128. yy_cp = ++(yy_c_buf_p);
  1129. yy_current_state = yy_next_state;
  1130. goto yy_match;
  1131. }
  1132. else
  1133. {
  1134. yy_cp = (yy_last_accepting_cpos);
  1135. yy_current_state = (yy_last_accepting_state);
  1136. goto yy_find_action;
  1137. }
  1138. }
  1139. else switch ( yy_get_next_buffer( ) )
  1140. {
  1141. case EOB_ACT_END_OF_FILE:
  1142. {
  1143. (yy_did_buffer_switch_on_eof) = 0;
  1144. if ( yywrap( ) )
  1145. {
  1146. /* Note: because we've taken care in
  1147. * yy_get_next_buffer() to have set up
  1148. * yytext, we can now set up
  1149. * yy_c_buf_p so that if some total
  1150. * hoser (like flex itself) wants to
  1151. * call the scanner after we return the
  1152. * YY_NULL, it'll still work - another
  1153. * YY_NULL will get returned.
  1154. */
  1155. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1156. yy_act = YY_STATE_EOF(YY_START);
  1157. goto do_action;
  1158. }
  1159. else
  1160. {
  1161. if ( ! (yy_did_buffer_switch_on_eof) )
  1162. YY_NEW_FILE;
  1163. }
  1164. break;
  1165. }
  1166. case EOB_ACT_CONTINUE_SCAN:
  1167. (yy_c_buf_p) =
  1168. (yytext_ptr) + yy_amount_of_matched_text;
  1169. yy_current_state = yy_get_previous_state( );
  1170. yy_cp = (yy_c_buf_p);
  1171. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1172. goto yy_match;
  1173. case EOB_ACT_LAST_MATCH:
  1174. (yy_c_buf_p) =
  1175. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1176. yy_current_state = yy_get_previous_state( );
  1177. yy_cp = (yy_c_buf_p);
  1178. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1179. goto yy_find_action;
  1180. }
  1181. break;
  1182. }
  1183. default:
  1184. YY_FATAL_ERROR(
  1185. "fatal flex scanner internal error--no action found" );
  1186. } /* end of action switch */
  1187. } /* end of scanning one token */
  1188. } /* end of yylex */
  1189. /* yy_get_next_buffer - try to read in a new buffer
  1190. *
  1191. * Returns a code representing an action:
  1192. * EOB_ACT_LAST_MATCH -
  1193. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1194. * EOB_ACT_END_OF_FILE - end of file
  1195. */
  1196. static int yy_get_next_buffer (void)
  1197. {
  1198. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1199. register char *source = (yytext_ptr);
  1200. register int number_to_move, i;
  1201. int ret_val;
  1202. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  1203. YY_FATAL_ERROR(
  1204. "fatal flex scanner internal error--end of buffer missed" );
  1205. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1206. { /* Don't try to fill the buffer, so this is an EOF. */
  1207. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  1208. {
  1209. /* We matched a single character, the EOB, so
  1210. * treat this as a final EOF.
  1211. */
  1212. return EOB_ACT_END_OF_FILE;
  1213. }
  1214. else
  1215. {
  1216. /* We matched some text prior to the EOB, first
  1217. * process it.
  1218. */
  1219. return EOB_ACT_LAST_MATCH;
  1220. }
  1221. }
  1222. /* Try to read more data. */
  1223. /* First move last chars to start of buffer. */
  1224. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  1225. for ( i = 0; i < number_to_move; ++i )
  1226. *(dest++) = *(source++);
  1227. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1228. /* don't do the read, it's not guaranteed to return an EOF,
  1229. * just force an EOF
  1230. */
  1231. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1232. else
  1233. {
  1234. int num_to_read =
  1235. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1236. while ( num_to_read <= 0 )
  1237. { /* Not enough room in the buffer - grow it. */
  1238. /* just a shorter name for the current buffer */
  1239. YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
  1240. int yy_c_buf_p_offset =
  1241. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1242. if ( b->yy_is_our_buffer )
  1243. {
  1244. int new_size = b->yy_buf_size * 2;
  1245. if ( new_size <= 0 )
  1246. b->yy_buf_size += b->yy_buf_size / 8;
  1247. else
  1248. b->yy_buf_size *= 2;
  1249. b->yy_ch_buf = (char *)
  1250. /* Include room in for 2 EOB chars. */
  1251. yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
  1252. }
  1253. else
  1254. /* Can't grow it, we don't own it. */
  1255. b->yy_ch_buf = 0;
  1256. if ( ! b->yy_ch_buf )
  1257. YY_FATAL_ERROR(
  1258. "fatal error - scanner input buffer overflow" );
  1259. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1260. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1261. number_to_move - 1;
  1262. }
  1263. if ( num_to_read > YY_READ_BUF_SIZE )
  1264. num_to_read = YY_READ_BUF_SIZE;
  1265. /* Read in more data. */
  1266. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1267. (yy_n_chars), (size_t) num_to_read );
  1268. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1269. }
  1270. if ( (yy_n_chars) == 0 )
  1271. {
  1272. if ( number_to_move == YY_MORE_ADJ )
  1273. {
  1274. ret_val = EOB_ACT_END_OF_FILE;
  1275. yyrestart(yyin );
  1276. }
  1277. else
  1278. {
  1279. ret_val = EOB_ACT_LAST_MATCH;
  1280. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1281. YY_BUFFER_EOF_PENDING;
  1282. }
  1283. }
  1284. else
  1285. ret_val = EOB_ACT_CONTINUE_SCAN;
  1286. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1287. /* Extend the array by 50%, plus the number we really need. */
  1288. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1289. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  1290. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1291. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1292. }
  1293. (yy_n_chars) += number_to_move;
  1294. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1295. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1296. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1297. return ret_val;
  1298. }
  1299. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1300. static yy_state_type yy_get_previous_state (void)
  1301. {
  1302. register yy_state_type yy_current_state;
  1303. register char *yy_cp;
  1304. yy_current_state = (yy_start);
  1305. yy_current_state += YY_AT_BOL();
  1306. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1307. {
  1308. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1309. if ( yy_accept[yy_current_state] )
  1310. {
  1311. (yy_last_accepting_state) = yy_current_state;
  1312. (yy_last_accepting_cpos) = yy_cp;
  1313. }
  1314. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1315. {
  1316. yy_current_state = (int) yy_def[yy_current_state];
  1317. if ( yy_current_state >= 166 )
  1318. yy_c = yy_meta[(unsigned int) yy_c];
  1319. }
  1320. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1321. }
  1322. return yy_current_state;
  1323. }
  1324. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1325. *
  1326. * synopsis
  1327. * next_state = yy_try_NUL_trans( current_state );
  1328. */
  1329. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1330. {
  1331. register int yy_is_jam;
  1332. register char *yy_cp = (yy_c_buf_p);
  1333. register YY_CHAR yy_c = 1;
  1334. if ( yy_accept[yy_current_state] )
  1335. {
  1336. (yy_last_accepting_state) = yy_current_state;
  1337. (yy_last_accepting_cpos) = yy_cp;
  1338. }
  1339. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1340. {
  1341. yy_current_state = (int) yy_def[yy_current_state];
  1342. if ( yy_current_state >= 166 )
  1343. yy_c = yy_meta[(unsigned int) yy_c];
  1344. }
  1345. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1346. yy_is_jam = (yy_current_state == 165);
  1347. return yy_is_jam ? 0 : yy_current_state;
  1348. }
  1349. #ifndef YY_NO_INPUT
  1350. #ifdef __cplusplus
  1351. static int yyinput (void)
  1352. #else
  1353. static int input (void)
  1354. #endif
  1355. {
  1356. int c;
  1357. *(yy_c_buf_p) = (yy_hold_char);
  1358. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1359. {
  1360. /* yy_c_buf_p now points to the character we want to return.
  1361. * If this occurs *before* the EOB characters, then it's a
  1362. * valid NUL; if not, then we've hit the end of the buffer.
  1363. */
  1364. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1365. /* This was really a NUL. */
  1366. *(yy_c_buf_p) = '\0';
  1367. else
  1368. { /* need more input */
  1369. int offset = (yy_c_buf_p) - (yytext_ptr);
  1370. ++(yy_c_buf_p);
  1371. switch ( yy_get_next_buffer( ) )
  1372. {
  1373. case EOB_ACT_LAST_MATCH:
  1374. /* This happens because yy_g_n_b()
  1375. * sees that we've accumulated a
  1376. * token and flags that we need to
  1377. * try matching the token before
  1378. * proceeding. But for input(),
  1379. * there's no matching to consider.
  1380. * So convert the EOB_ACT_LAST_MATCH
  1381. * to EOB_ACT_END_OF_FILE.
  1382. */
  1383. /* Reset buffer status. */
  1384. yyrestart(yyin );
  1385. /*FALLTHROUGH*/
  1386. case EOB_ACT_END_OF_FILE:
  1387. {
  1388. if ( yywrap( ) )
  1389. return EOF;
  1390. if ( ! (yy_did_buffer_switch_on_eof) )
  1391. YY_NEW_FILE;
  1392. #ifdef __cplusplus
  1393. return yyinput();
  1394. #else
  1395. return input();
  1396. #endif
  1397. }
  1398. case EOB_ACT_CONTINUE_SCAN:
  1399. (yy_c_buf_p) = (yytext_ptr) + offset;
  1400. break;
  1401. }
  1402. }
  1403. }
  1404. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1405. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1406. (yy_hold_char) = *++(yy_c_buf_p);
  1407. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
  1408. return c;
  1409. }
  1410. #endif /* ifndef YY_NO_INPUT */
  1411. /** Immediately switch to a different input stream.
  1412. * @param input_file A readable stream.
  1413. *
  1414. * @note This function does not reset the start condition to @c INITIAL .
  1415. */
  1416. void yyrestart (FILE * input_file )
  1417. {
  1418. if ( ! YY_CURRENT_BUFFER ){
  1419. yyensure_buffer_stack ();
  1420. YY_CURRENT_BUFFER_LVALUE =
  1421. yy_create_buffer(yyin,YY_BUF_SIZE );
  1422. }
  1423. yy_init_buffer(YY_CURRENT_BUFFER,input_file );
  1424. yy_load_buffer_state( );
  1425. }
  1426. /** Switch to a different input buffer.
  1427. * @param new_buffer The new input buffer.
  1428. *
  1429. */
  1430. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1431. {
  1432. /* TODO. We should be able to replace this entire function body
  1433. * with
  1434. * yypop_buffer_state();
  1435. * yypush_buffer_state(new_buffer);
  1436. */
  1437. yyensure_buffer_stack ();
  1438. if ( YY_CURRENT_BUFFER == new_buffer )
  1439. return;
  1440. if ( YY_CURRENT_BUFFER )
  1441. {
  1442. /* Flush out information for old buffer. */
  1443. *(yy_c_buf_p) = (yy_hold_char);
  1444. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1445. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1446. }
  1447. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1448. yy_load_buffer_state( );
  1449. /* We don't actually know whether we did this switch during
  1450. * EOF (yywrap()) processing, but the only time this flag
  1451. * is looked at is after yywrap() is called, so it's safe
  1452. * to go ahead and always set it.
  1453. */
  1454. (yy_did_buffer_switch_on_eof) = 1;
  1455. }
  1456. static void yy_load_buffer_state (void)
  1457. {
  1458. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1459. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1460. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1461. (yy_hold_char) = *(yy_c_buf_p);
  1462. }
  1463. /** Allocate and initialize an input buffer state.
  1464. * @param file A readable stream.
  1465. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1466. *
  1467. * @return the allocated buffer state.
  1468. */
  1469. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1470. {
  1471. YY_BUFFER_STATE b;
  1472. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1473. if ( ! b )
  1474. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1475. b->yy_buf_size = size;
  1476. /* yy_ch_buf has to be 2 characters longer than the size given because
  1477. * we need to put in 2 end-of-buffer characters.
  1478. */
  1479. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
  1480. if ( ! b->yy_ch_buf )
  1481. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1482. b->yy_is_our_buffer = 1;
  1483. yy_init_buffer(b,file );
  1484. return b;
  1485. }
  1486. /** Destroy the buffer.
  1487. * @param b a buffer created with yy_create_buffer()
  1488. *
  1489. */
  1490. void yy_delete_buffer (YY_BUFFER_STATE b )
  1491. {
  1492. if ( ! b )
  1493. return;
  1494. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1495. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1496. if ( b->yy_is_our_buffer )
  1497. yyfree((void *) b->yy_ch_buf );
  1498. yyfree((void *) b );
  1499. }
  1500. /* Initializes or reinitializes a buffer.
  1501. * This function is sometimes called more than once on the same buffer,
  1502. * such as during a yyrestart() or at EOF.
  1503. */
  1504. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1505. {
  1506. int oerrno = errno;
  1507. yy_flush_buffer(b );
  1508. b->yy_input_file = file;
  1509. b->yy_fill_buffer = 1;
  1510. /* If b is the current buffer, then yy_init_buffer was _probably_
  1511. * called from yyrestart() or through yy_get_next_buffer.
  1512. * In that case, we don't want to reset the lineno or column.
  1513. */
  1514. if (b != YY_CURRENT_BUFFER){
  1515. b->yy_bs_lineno = 1;
  1516. b->yy_bs_column = 0;
  1517. }
  1518. b->yy_is_interactive = 0;
  1519. errno = oerrno;
  1520. }
  1521. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1522. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1523. *
  1524. */
  1525. void yy_flush_buffer (YY_BUFFER_STATE b )
  1526. {
  1527. if ( ! b )
  1528. return;
  1529. b->yy_n_chars = 0;
  1530. /* We always need two end-of-buffer characters. The first causes
  1531. * a transition to the end-of-buffer state. The second causes
  1532. * a jam in that state.
  1533. */
  1534. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1535. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1536. b->yy_buf_pos = &b->yy_ch_buf[0];
  1537. b->yy_at_bol = 1;
  1538. b->yy_buffer_status = YY_BUFFER_NEW;
  1539. if ( b == YY_CURRENT_BUFFER )
  1540. yy_load_buffer_state( );
  1541. }
  1542. /** Pushes the new state onto the stack. The new state becomes
  1543. * the current state. This function will allocate the stack
  1544. * if necessary.
  1545. * @param new_buffer The new state.
  1546. *
  1547. */
  1548. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1549. {
  1550. if (new_buffer == NULL)
  1551. return;
  1552. yyensure_buffer_stack();
  1553. /* This block is copied from yy_switch_to_buffer. */
  1554. if ( YY_CURRENT_BUFFER )
  1555. {
  1556. /* Flush out information for old buffer. */
  1557. *(yy_c_buf_p) = (yy_hold_char);
  1558. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1559. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1560. }
  1561. /* Only push if top exists. Otherwise, replace top. */
  1562. if (YY_CURRENT_BUFFER)
  1563. (yy_buffer_stack_top)++;
  1564. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1565. /* copied from yy_switch_to_buffer. */
  1566. yy_load_buffer_state( );
  1567. (yy_did_buffer_switch_on_eof) = 1;
  1568. }
  1569. /** Removes and deletes the top of the stack, if present.
  1570. * The next element becomes the new top.
  1571. *
  1572. */
  1573. void yypop_buffer_state (void)
  1574. {
  1575. if (!YY_CURRENT_BUFFER)
  1576. return;
  1577. yy_delete_buffer(YY_CURRENT_BUFFER );
  1578. YY_CURRENT_BUFFER_LVALUE = NULL;
  1579. if ((yy_buffer_stack_top) > 0)
  1580. --(yy_buffer_stack_top);
  1581. if (YY_CURRENT_BUFFER) {
  1582. yy_load_buffer_state( );
  1583. (yy_did_buffer_switch_on_eof) = 1;
  1584. }
  1585. }
  1586. /* Allocates the stack if it does not exist.
  1587. * Guarantees space for at least one push.
  1588. */
  1589. static void yyensure_buffer_stack (void)
  1590. {
  1591. int num_to_alloc;
  1592. if (!(yy_buffer_stack)) {
  1593. /* First allocation is just for 2 elements, since we don't know if this
  1594. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1595. * immediate realloc on the next call.
  1596. */
  1597. num_to_alloc = 1;
  1598. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1599. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1600. );
  1601. if ( ! (yy_buffer_stack) )
  1602. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1603. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1604. (yy_buffer_stack_max) = num_to_alloc;
  1605. (yy_buffer_stack_top) = 0;
  1606. return;
  1607. }
  1608. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1609. /* Increase the buffer to prepare for a possible push. */
  1610. int grow_size = 8 /* arbitrary grow size */;
  1611. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1612. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  1613. ((yy_buffer_stack),
  1614. num_to_alloc * sizeof(struct yy_buffer_state*)
  1615. );
  1616. if ( ! (yy_buffer_stack) )
  1617. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1618. /* zero only the new slots.*/
  1619. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1620. (yy_buffer_stack_max) = num_to_alloc;
  1621. }
  1622. }
  1623. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1624. * @param base the character buffer
  1625. * @param size the size in bytes of the character buffer
  1626. *
  1627. * @return the newly allocated buffer state object.
  1628. */
  1629. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  1630. {
  1631. YY_BUFFER_STATE b;
  1632. if ( size < 2 ||
  1633. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1634. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1635. /* They forgot to leave room for the EOB's. */
  1636. return 0;
  1637. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1638. if ( ! b )
  1639. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1640. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1641. b->yy_buf_pos = b->yy_ch_buf = base;
  1642. b->yy_is_our_buffer = 0;
  1643. b->yy_input_file = 0;
  1644. b->yy_n_chars = b->yy_buf_size;
  1645. b->yy_is_interactive = 0;
  1646. b->yy_at_bol = 1;
  1647. b->yy_fill_buffer = 0;
  1648. b->yy_buffer_status = YY_BUFFER_NEW;
  1649. yy_switch_to_buffer(b );
  1650. return b;
  1651. }
  1652. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1653. * scan from a @e copy of @a str.
  1654. * @param yystr a NUL-terminated string to scan
  1655. *
  1656. * @return the newly allocated buffer state object.
  1657. * @note If you want to scan bytes that may contain NUL values, then use
  1658. * yy_scan_bytes() instead.
  1659. */
  1660. YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
  1661. {
  1662. return yy_scan_bytes(yystr,strlen(yystr) );
  1663. }
  1664. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1665. * scan from a @e copy of @a bytes.
  1666. * @param yybytes the byte buffer to scan
  1667. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  1668. *
  1669. * @return the newly allocated buffer state object.
  1670. */
  1671. YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
  1672. {
  1673. YY_BUFFER_STATE b;
  1674. char *buf;
  1675. yy_size_t n;
  1676. int i;
  1677. /* Get memory for full buffer, including space for trailing EOB's. */
  1678. n = _yybytes_len + 2;
  1679. buf = (char *) yyalloc(n );
  1680. if ( ! buf )
  1681. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1682. for ( i = 0; i < _yybytes_len; ++i )
  1683. buf[i] = yybytes[i];
  1684. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1685. b = yy_scan_buffer(buf,n );
  1686. if ( ! b )
  1687. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1688. /* It's okay to grow etc. this buffer, and we should throw it
  1689. * away when we're done.
  1690. */
  1691. b->yy_is_our_buffer = 1;
  1692. return b;
  1693. }
  1694. #ifndef YY_EXIT_FAILURE
  1695. #define YY_EXIT_FAILURE 2
  1696. #endif
  1697. static void yy_fatal_error (yyconst char* msg )
  1698. {
  1699. (void) fprintf( stderr, "%s\n", msg );
  1700. exit( YY_EXIT_FAILURE );
  1701. }
  1702. /* Redefine yyless() so it works in section 3 code. */
  1703. #undef yyless
  1704. #define yyless(n) \
  1705. do \
  1706. { \
  1707. /* Undo effects of setting up yytext. */ \
  1708. int yyless_macro_arg = (n); \
  1709. YY_LESS_LINENO(yyless_macro_arg);\
  1710. yytext[yyleng] = (yy_hold_char); \
  1711. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1712. (yy_hold_char) = *(yy_c_buf_p); \
  1713. *(yy_c_buf_p) = '\0'; \
  1714. yyleng = yyless_macro_arg; \
  1715. } \
  1716. while ( 0 )
  1717. /* Accessor methods (get/set functions) to struct members. */
  1718. /** Get the current line number.
  1719. *
  1720. */
  1721. int yyget_lineno (void)
  1722. {
  1723. return yylineno;
  1724. }
  1725. /** Get the input stream.
  1726. *
  1727. */
  1728. FILE *yyget_in (void)
  1729. {
  1730. return yyin;
  1731. }
  1732. /** Get the output stream.
  1733. *
  1734. */
  1735. FILE *yyget_out (void)
  1736. {
  1737. return yyout;
  1738. }
  1739. /** Get the length of the current token.
  1740. *
  1741. */
  1742. int yyget_leng (void)
  1743. {
  1744. return yyleng;
  1745. }
  1746. /** Get the current token.
  1747. *
  1748. */
  1749. char *yyget_text (void)
  1750. {
  1751. return yytext;
  1752. }
  1753. /** Set the current line number.
  1754. * @param line_number
  1755. *
  1756. */
  1757. void yyset_lineno (int line_number )
  1758. {
  1759. yylineno = line_number;
  1760. }
  1761. /** Set the input stream. This does not discard the current
  1762. * input buffer.
  1763. * @param in_str A readable stream.
  1764. *
  1765. * @see yy_switch_to_buffer
  1766. */
  1767. void yyset_in (FILE * in_str )
  1768. {
  1769. yyin = in_str ;
  1770. }
  1771. void yyset_out (FILE * out_str )
  1772. {
  1773. yyout = out_str ;
  1774. }
  1775. int yyget_debug (void)
  1776. {
  1777. return yy_flex_debug;
  1778. }
  1779. void yyset_debug (int bdebug )
  1780. {
  1781. yy_flex_debug = bdebug ;
  1782. }
  1783. static int yy_init_globals (void)
  1784. {
  1785. /* Initialization is the same as for the non-reentrant scanner.
  1786. * This function is called from yylex_destroy(), so don't allocate here.
  1787. */
  1788. (yy_buffer_stack) = 0;
  1789. (yy_buffer_stack_top) = 0;
  1790. (yy_buffer_stack_max) = 0;
  1791. (yy_c_buf_p) = (char *) 0;
  1792. (yy_init) = 0;
  1793. (yy_start) = 0;
  1794. /* Defined in main.c */
  1795. #ifdef YY_STDINIT
  1796. yyin = stdin;
  1797. yyout = stdout;
  1798. #else
  1799. yyin = (FILE *) 0;
  1800. yyout = (FILE *) 0;
  1801. #endif
  1802. /* For future reference: Set errno on error, since we are called by
  1803. * yylex_init()
  1804. */
  1805. return 0;
  1806. }
  1807. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1808. int yylex_destroy (void)
  1809. {
  1810. /* Pop the buffer stack, destroying each element. */
  1811. while(YY_CURRENT_BUFFER){
  1812. yy_delete_buffer(YY_CURRENT_BUFFER );
  1813. YY_CURRENT_BUFFER_LVALUE = NULL;
  1814. yypop_buffer_state();
  1815. }
  1816. /* Destroy the stack itself. */
  1817. yyfree((yy_buffer_stack) );
  1818. (yy_buffer_stack) = NULL;
  1819. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1820. * yylex() is called, initialization will occur. */
  1821. yy_init_globals( );
  1822. return 0;
  1823. }
  1824. /*
  1825. * Internal utility routines.
  1826. */
  1827. #ifndef yytext_ptr
  1828. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1829. {
  1830. register int i;
  1831. for ( i = 0; i < n; ++i )
  1832. s1[i] = s2[i];
  1833. }
  1834. #endif
  1835. #ifdef YY_NEED_STRLEN
  1836. static int yy_flex_strlen (yyconst char * s )
  1837. {
  1838. register int n;
  1839. for ( n = 0; s[n]; ++n )
  1840. ;
  1841. return n;
  1842. }
  1843. #endif
  1844. void *yyalloc (yy_size_t size )
  1845. {
  1846. return (void *) malloc( size );
  1847. }
  1848. void *yyrealloc (void * ptr, yy_size_t size )
  1849. {
  1850. /* The cast to (char *) in the following accommodates both
  1851. * implementations that use char* generic pointers, and those
  1852. * that use void* generic pointers. It works with the latter
  1853. * because both ANSI C and C++ allow castless assignment from
  1854. * any pointer type to void*, and deal with argument conversions
  1855. * as though doing an assignment.
  1856. */
  1857. return (void *) realloc( (char *) ptr, size );
  1858. }
  1859. void yyfree (void * ptr )
  1860. {
  1861. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1862. }
  1863. #define YYTABLES_NAME "yytables"
  1864. #line 272 "dtc-lexer.l"
  1865. static void push_input_file(const char *filename)
  1866. {
  1867. assert(filename);
  1868. srcfile_push(filename);
  1869. yyin = current_srcfile->f;
  1870. yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
  1871. }
  1872. static bool pop_input_file(void)
  1873. {
  1874. if (srcfile_pop() == 0)
  1875. return false;
  1876. yypop_buffer_state();
  1877. yyin = current_srcfile->f;
  1878. return true;
  1879. }
  1880. static void lexical_error(const char *fmt, ...)
  1881. {
  1882. va_list ap;
  1883. va_start(ap, fmt);
  1884. srcpos_verror(&yylloc, "Lexical error", fmt, ap);
  1885. va_end(ap);
  1886. treesource_error = true;
  1887. }