dtc-lexer.lex.c_shipped 57 KB

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