dtc-lexer.lex.c_shipped 58 KB

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