dtc-lexer.lex.c_shipped 55 KB

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