dtc-lexer.lex.c_shipped 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247
  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, *fnstart, *fnend;
  787. struct data fn;
  788. /* skip text before line # */
  789. line = yytext;
  790. while (!isdigit((unsigned char)*line))
  791. line++;
  792. /* regexp ensures that first and list "
  793. * in the whole yytext are those at
  794. * beginning and end of the filename string */
  795. fnstart = memchr(yytext, '"', yyleng);
  796. for (fnend = yytext + yyleng - 1;
  797. *fnend != '"'; fnend--)
  798. ;
  799. assert(fnstart && fnend && (fnend > fnstart));
  800. fn = data_copy_escape_string(fnstart + 1,
  801. fnend - fnstart - 1);
  802. /* Don't allow nuls in filenames */
  803. if (memchr(fn.val, '\0', fn.len - 1))
  804. lexical_error("nul in line number directive");
  805. /* -1 since #line is the number of the next line */
  806. srcpos_set_line(xstrdup(fn.val), atoi(line) - 1);
  807. data_free(fn);
  808. }
  809. YY_BREAK
  810. case YY_STATE_EOF(INITIAL):
  811. case YY_STATE_EOF(BYTESTRING):
  812. case YY_STATE_EOF(PROPNODENAME):
  813. case YY_STATE_EOF(V1):
  814. #line 104 "dtc-lexer.l"
  815. {
  816. if (!pop_input_file()) {
  817. yyterminate();
  818. }
  819. }
  820. YY_BREAK
  821. case 3:
  822. /* rule 3 can match eol */
  823. YY_RULE_SETUP
  824. #line 110 "dtc-lexer.l"
  825. {
  826. DPRINT("String: %s\n", yytext);
  827. yylval.data = data_copy_escape_string(yytext+1,
  828. yyleng-2);
  829. return DT_STRING;
  830. }
  831. YY_BREAK
  832. case 4:
  833. YY_RULE_SETUP
  834. #line 117 "dtc-lexer.l"
  835. {
  836. DPRINT("Keyword: /dts-v1/\n");
  837. dts_version = 1;
  838. BEGIN_DEFAULT();
  839. return DT_V1;
  840. }
  841. YY_BREAK
  842. case 5:
  843. YY_RULE_SETUP
  844. #line 124 "dtc-lexer.l"
  845. {
  846. DPRINT("Keyword: /memreserve/\n");
  847. BEGIN_DEFAULT();
  848. return DT_MEMRESERVE;
  849. }
  850. YY_BREAK
  851. case 6:
  852. YY_RULE_SETUP
  853. #line 130 "dtc-lexer.l"
  854. {
  855. DPRINT("Keyword: /bits/\n");
  856. BEGIN_DEFAULT();
  857. return DT_BITS;
  858. }
  859. YY_BREAK
  860. case 7:
  861. YY_RULE_SETUP
  862. #line 136 "dtc-lexer.l"
  863. {
  864. DPRINT("Keyword: /delete-property/\n");
  865. DPRINT("<PROPNODENAME>\n");
  866. BEGIN(PROPNODENAME);
  867. return DT_DEL_PROP;
  868. }
  869. YY_BREAK
  870. case 8:
  871. YY_RULE_SETUP
  872. #line 143 "dtc-lexer.l"
  873. {
  874. DPRINT("Keyword: /delete-node/\n");
  875. DPRINT("<PROPNODENAME>\n");
  876. BEGIN(PROPNODENAME);
  877. return DT_DEL_NODE;
  878. }
  879. YY_BREAK
  880. case 9:
  881. YY_RULE_SETUP
  882. #line 150 "dtc-lexer.l"
  883. {
  884. DPRINT("Label: %s\n", yytext);
  885. yylval.labelref = xstrdup(yytext);
  886. yylval.labelref[yyleng-1] = '\0';
  887. return DT_LABEL;
  888. }
  889. YY_BREAK
  890. case 10:
  891. YY_RULE_SETUP
  892. #line 157 "dtc-lexer.l"
  893. {
  894. char *e;
  895. DPRINT("Integer Literal: '%s'\n", yytext);
  896. errno = 0;
  897. yylval.integer = strtoull(yytext, &e, 0);
  898. if (*e && e[strspn(e, "UL")]) {
  899. lexical_error("Bad integer literal '%s'",
  900. yytext);
  901. }
  902. if (errno == ERANGE)
  903. lexical_error("Integer literal '%s' out of range",
  904. yytext);
  905. else
  906. /* ERANGE is the only strtoull error triggerable
  907. * by strings matching the pattern */
  908. assert(errno == 0);
  909. return DT_LITERAL;
  910. }
  911. YY_BREAK
  912. case 11:
  913. /* rule 11 can match eol */
  914. YY_RULE_SETUP
  915. #line 179 "dtc-lexer.l"
  916. {
  917. struct data d;
  918. DPRINT("Character literal: %s\n", yytext);
  919. d = data_copy_escape_string(yytext+1, yyleng-2);
  920. if (d.len == 1) {
  921. lexical_error("Empty character literal");
  922. yylval.integer = 0;
  923. return DT_CHAR_LITERAL;
  924. }
  925. yylval.integer = (unsigned char)d.val[0];
  926. if (d.len > 2)
  927. lexical_error("Character literal has %d"
  928. " characters instead of 1",
  929. d.len - 1);
  930. return DT_CHAR_LITERAL;
  931. }
  932. YY_BREAK
  933. case 12:
  934. YY_RULE_SETUP
  935. #line 200 "dtc-lexer.l"
  936. { /* label reference */
  937. DPRINT("Ref: %s\n", yytext+1);
  938. yylval.labelref = xstrdup(yytext+1);
  939. return DT_REF;
  940. }
  941. YY_BREAK
  942. case 13:
  943. YY_RULE_SETUP
  944. #line 206 "dtc-lexer.l"
  945. { /* new-style path reference */
  946. yytext[yyleng-1] = '\0';
  947. DPRINT("Ref: %s\n", yytext+2);
  948. yylval.labelref = xstrdup(yytext+2);
  949. return DT_REF;
  950. }
  951. YY_BREAK
  952. case 14:
  953. YY_RULE_SETUP
  954. #line 213 "dtc-lexer.l"
  955. {
  956. yylval.byte = strtol(yytext, NULL, 16);
  957. DPRINT("Byte: %02x\n", (int)yylval.byte);
  958. return DT_BYTE;
  959. }
  960. YY_BREAK
  961. case 15:
  962. YY_RULE_SETUP
  963. #line 219 "dtc-lexer.l"
  964. {
  965. DPRINT("/BYTESTRING\n");
  966. BEGIN_DEFAULT();
  967. return ']';
  968. }
  969. YY_BREAK
  970. case 16:
  971. YY_RULE_SETUP
  972. #line 225 "dtc-lexer.l"
  973. {
  974. DPRINT("PropNodeName: %s\n", yytext);
  975. yylval.propnodename = xstrdup((yytext[0] == '\\') ?
  976. yytext + 1 : yytext);
  977. BEGIN_DEFAULT();
  978. return DT_PROPNODENAME;
  979. }
  980. YY_BREAK
  981. case 17:
  982. YY_RULE_SETUP
  983. #line 233 "dtc-lexer.l"
  984. {
  985. DPRINT("Binary Include\n");
  986. return DT_INCBIN;
  987. }
  988. YY_BREAK
  989. case 18:
  990. /* rule 18 can match eol */
  991. YY_RULE_SETUP
  992. #line 238 "dtc-lexer.l"
  993. /* eat whitespace */
  994. YY_BREAK
  995. case 19:
  996. /* rule 19 can match eol */
  997. YY_RULE_SETUP
  998. #line 239 "dtc-lexer.l"
  999. /* eat C-style comments */
  1000. YY_BREAK
  1001. case 20:
  1002. /* rule 20 can match eol */
  1003. YY_RULE_SETUP
  1004. #line 240 "dtc-lexer.l"
  1005. /* eat C++-style comments */
  1006. YY_BREAK
  1007. case 21:
  1008. YY_RULE_SETUP
  1009. #line 242 "dtc-lexer.l"
  1010. { return DT_LSHIFT; };
  1011. YY_BREAK
  1012. case 22:
  1013. YY_RULE_SETUP
  1014. #line 243 "dtc-lexer.l"
  1015. { return DT_RSHIFT; };
  1016. YY_BREAK
  1017. case 23:
  1018. YY_RULE_SETUP
  1019. #line 244 "dtc-lexer.l"
  1020. { return DT_LE; };
  1021. YY_BREAK
  1022. case 24:
  1023. YY_RULE_SETUP
  1024. #line 245 "dtc-lexer.l"
  1025. { return DT_GE; };
  1026. YY_BREAK
  1027. case 25:
  1028. YY_RULE_SETUP
  1029. #line 246 "dtc-lexer.l"
  1030. { return DT_EQ; };
  1031. YY_BREAK
  1032. case 26:
  1033. YY_RULE_SETUP
  1034. #line 247 "dtc-lexer.l"
  1035. { return DT_NE; };
  1036. YY_BREAK
  1037. case 27:
  1038. YY_RULE_SETUP
  1039. #line 248 "dtc-lexer.l"
  1040. { return DT_AND; };
  1041. YY_BREAK
  1042. case 28:
  1043. YY_RULE_SETUP
  1044. #line 249 "dtc-lexer.l"
  1045. { return DT_OR; };
  1046. YY_BREAK
  1047. case 29:
  1048. YY_RULE_SETUP
  1049. #line 251 "dtc-lexer.l"
  1050. {
  1051. DPRINT("Char: %c (\\x%02x)\n", yytext[0],
  1052. (unsigned)yytext[0]);
  1053. if (yytext[0] == '[') {
  1054. DPRINT("<BYTESTRING>\n");
  1055. BEGIN(BYTESTRING);
  1056. }
  1057. if ((yytext[0] == '{')
  1058. || (yytext[0] == ';')) {
  1059. DPRINT("<PROPNODENAME>\n");
  1060. BEGIN(PROPNODENAME);
  1061. }
  1062. return yytext[0];
  1063. }
  1064. YY_BREAK
  1065. case 30:
  1066. YY_RULE_SETUP
  1067. #line 266 "dtc-lexer.l"
  1068. ECHO;
  1069. YY_BREAK
  1070. #line 1250 "dtc-lexer.lex.c"
  1071. case YY_END_OF_BUFFER:
  1072. {
  1073. /* Amount of text matched not including the EOB char. */
  1074. int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
  1075. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  1076. *yy_cp = (yy_hold_char);
  1077. YY_RESTORE_YY_MORE_OFFSET
  1078. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
  1079. {
  1080. /* We're scanning a new file or input source. It's
  1081. * possible that this happened because the user
  1082. * just pointed yyin at a new source and called
  1083. * yylex(). If so, then we have to assure
  1084. * consistency between YY_CURRENT_BUFFER and our
  1085. * globals. Here is the right place to do so, because
  1086. * this is the first action (other than possibly a
  1087. * back-up) that will match for the new input source.
  1088. */
  1089. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1090. YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
  1091. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
  1092. }
  1093. /* Note that here we test for yy_c_buf_p "<=" to the position
  1094. * of the first EOB in the buffer, since yy_c_buf_p will
  1095. * already have been incremented past the NUL character
  1096. * (since all states make transitions on EOB to the
  1097. * end-of-buffer state). Contrast this with the test
  1098. * in input().
  1099. */
  1100. if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1101. { /* This was really a NUL. */
  1102. yy_state_type yy_next_state;
  1103. (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
  1104. yy_current_state = yy_get_previous_state( );
  1105. /* Okay, we're now positioned to make the NUL
  1106. * transition. We couldn't have
  1107. * yy_get_previous_state() go ahead and do it
  1108. * for us because it doesn't know how to deal
  1109. * with the possibility of jamming (and we don't
  1110. * want to build jamming into it because then it
  1111. * will run more slowly).
  1112. */
  1113. yy_next_state = yy_try_NUL_trans( yy_current_state );
  1114. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1115. if ( yy_next_state )
  1116. {
  1117. /* Consume the NUL. */
  1118. yy_cp = ++(yy_c_buf_p);
  1119. yy_current_state = yy_next_state;
  1120. goto yy_match;
  1121. }
  1122. else
  1123. {
  1124. yy_cp = (yy_last_accepting_cpos);
  1125. yy_current_state = (yy_last_accepting_state);
  1126. goto yy_find_action;
  1127. }
  1128. }
  1129. else switch ( yy_get_next_buffer( ) )
  1130. {
  1131. case EOB_ACT_END_OF_FILE:
  1132. {
  1133. (yy_did_buffer_switch_on_eof) = 0;
  1134. if ( yywrap( ) )
  1135. {
  1136. /* Note: because we've taken care in
  1137. * yy_get_next_buffer() to have set up
  1138. * yytext, we can now set up
  1139. * yy_c_buf_p so that if some total
  1140. * hoser (like flex itself) wants to
  1141. * call the scanner after we return the
  1142. * YY_NULL, it'll still work - another
  1143. * YY_NULL will get returned.
  1144. */
  1145. (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
  1146. yy_act = YY_STATE_EOF(YY_START);
  1147. goto do_action;
  1148. }
  1149. else
  1150. {
  1151. if ( ! (yy_did_buffer_switch_on_eof) )
  1152. YY_NEW_FILE;
  1153. }
  1154. break;
  1155. }
  1156. case EOB_ACT_CONTINUE_SCAN:
  1157. (yy_c_buf_p) =
  1158. (yytext_ptr) + yy_amount_of_matched_text;
  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_match;
  1163. case EOB_ACT_LAST_MATCH:
  1164. (yy_c_buf_p) =
  1165. &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
  1166. yy_current_state = yy_get_previous_state( );
  1167. yy_cp = (yy_c_buf_p);
  1168. yy_bp = (yytext_ptr) + YY_MORE_ADJ;
  1169. goto yy_find_action;
  1170. }
  1171. break;
  1172. }
  1173. default:
  1174. YY_FATAL_ERROR(
  1175. "fatal flex scanner internal error--no action found" );
  1176. } /* end of action switch */
  1177. } /* end of scanning one token */
  1178. } /* end of user's declarations */
  1179. } /* end of yylex */
  1180. /* yy_get_next_buffer - try to read in a new buffer
  1181. *
  1182. * Returns a code representing an action:
  1183. * EOB_ACT_LAST_MATCH -
  1184. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  1185. * EOB_ACT_END_OF_FILE - end of file
  1186. */
  1187. static int yy_get_next_buffer (void)
  1188. {
  1189. register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
  1190. register char *source = (yytext_ptr);
  1191. register int number_to_move, i;
  1192. int ret_val;
  1193. if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
  1194. YY_FATAL_ERROR(
  1195. "fatal flex scanner internal error--end of buffer missed" );
  1196. if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
  1197. { /* Don't try to fill the buffer, so this is an EOF. */
  1198. if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
  1199. {
  1200. /* We matched a single character, the EOB, so
  1201. * treat this as a final EOF.
  1202. */
  1203. return EOB_ACT_END_OF_FILE;
  1204. }
  1205. else
  1206. {
  1207. /* We matched some text prior to the EOB, first
  1208. * process it.
  1209. */
  1210. return EOB_ACT_LAST_MATCH;
  1211. }
  1212. }
  1213. /* Try to read more data. */
  1214. /* First move last chars to start of buffer. */
  1215. number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
  1216. for ( i = 0; i < number_to_move; ++i )
  1217. *(dest++) = *(source++);
  1218. if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  1219. /* don't do the read, it's not guaranteed to return an EOF,
  1220. * just force an EOF
  1221. */
  1222. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
  1223. else
  1224. {
  1225. yy_size_t num_to_read =
  1226. YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
  1227. while ( num_to_read <= 0 )
  1228. { /* Not enough room in the buffer - grow it. */
  1229. /* just a shorter name for the current buffer */
  1230. YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
  1231. int yy_c_buf_p_offset =
  1232. (int) ((yy_c_buf_p) - b->yy_ch_buf);
  1233. if ( b->yy_is_our_buffer )
  1234. {
  1235. yy_size_t new_size = b->yy_buf_size * 2;
  1236. if ( new_size <= 0 )
  1237. b->yy_buf_size += b->yy_buf_size / 8;
  1238. else
  1239. b->yy_buf_size *= 2;
  1240. b->yy_ch_buf = (char *)
  1241. /* Include room in for 2 EOB chars. */
  1242. yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
  1243. }
  1244. else
  1245. /* Can't grow it, we don't own it. */
  1246. b->yy_ch_buf = 0;
  1247. if ( ! b->yy_ch_buf )
  1248. YY_FATAL_ERROR(
  1249. "fatal error - scanner input buffer overflow" );
  1250. (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
  1251. num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
  1252. number_to_move - 1;
  1253. }
  1254. if ( num_to_read > YY_READ_BUF_SIZE )
  1255. num_to_read = YY_READ_BUF_SIZE;
  1256. /* Read in more data. */
  1257. YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
  1258. (yy_n_chars), num_to_read );
  1259. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1260. }
  1261. if ( (yy_n_chars) == 0 )
  1262. {
  1263. if ( number_to_move == YY_MORE_ADJ )
  1264. {
  1265. ret_val = EOB_ACT_END_OF_FILE;
  1266. yyrestart(yyin );
  1267. }
  1268. else
  1269. {
  1270. ret_val = EOB_ACT_LAST_MATCH;
  1271. YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
  1272. YY_BUFFER_EOF_PENDING;
  1273. }
  1274. }
  1275. else
  1276. ret_val = EOB_ACT_CONTINUE_SCAN;
  1277. if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
  1278. /* Extend the array by 50%, plus the number we really need. */
  1279. yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
  1280. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
  1281. if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
  1282. YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
  1283. }
  1284. (yy_n_chars) += number_to_move;
  1285. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
  1286. YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
  1287. (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
  1288. return ret_val;
  1289. }
  1290. /* yy_get_previous_state - get the state just before the EOB char was reached */
  1291. static yy_state_type yy_get_previous_state (void)
  1292. {
  1293. register yy_state_type yy_current_state;
  1294. register char *yy_cp;
  1295. yy_current_state = (yy_start);
  1296. yy_current_state += YY_AT_BOL();
  1297. for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
  1298. {
  1299. register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
  1300. if ( yy_accept[yy_current_state] )
  1301. {
  1302. (yy_last_accepting_state) = yy_current_state;
  1303. (yy_last_accepting_cpos) = yy_cp;
  1304. }
  1305. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1306. {
  1307. yy_current_state = (int) yy_def[yy_current_state];
  1308. if ( yy_current_state >= 159 )
  1309. yy_c = yy_meta[(unsigned int) yy_c];
  1310. }
  1311. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1312. }
  1313. return yy_current_state;
  1314. }
  1315. /* yy_try_NUL_trans - try to make a transition on the NUL character
  1316. *
  1317. * synopsis
  1318. * next_state = yy_try_NUL_trans( current_state );
  1319. */
  1320. static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
  1321. {
  1322. register int yy_is_jam;
  1323. register char *yy_cp = (yy_c_buf_p);
  1324. register YY_CHAR yy_c = 1;
  1325. if ( yy_accept[yy_current_state] )
  1326. {
  1327. (yy_last_accepting_state) = yy_current_state;
  1328. (yy_last_accepting_cpos) = yy_cp;
  1329. }
  1330. while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
  1331. {
  1332. yy_current_state = (int) yy_def[yy_current_state];
  1333. if ( yy_current_state >= 159 )
  1334. yy_c = yy_meta[(unsigned int) yy_c];
  1335. }
  1336. yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
  1337. yy_is_jam = (yy_current_state == 158);
  1338. return yy_is_jam ? 0 : yy_current_state;
  1339. }
  1340. #ifndef YY_NO_INPUT
  1341. #ifdef __cplusplus
  1342. static int yyinput (void)
  1343. #else
  1344. static int input (void)
  1345. #endif
  1346. {
  1347. int c;
  1348. *(yy_c_buf_p) = (yy_hold_char);
  1349. if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
  1350. {
  1351. /* yy_c_buf_p now points to the character we want to return.
  1352. * If this occurs *before* the EOB characters, then it's a
  1353. * valid NUL; if not, then we've hit the end of the buffer.
  1354. */
  1355. if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
  1356. /* This was really a NUL. */
  1357. *(yy_c_buf_p) = '\0';
  1358. else
  1359. { /* need more input */
  1360. yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
  1361. ++(yy_c_buf_p);
  1362. switch ( yy_get_next_buffer( ) )
  1363. {
  1364. case EOB_ACT_LAST_MATCH:
  1365. /* This happens because yy_g_n_b()
  1366. * sees that we've accumulated a
  1367. * token and flags that we need to
  1368. * try matching the token before
  1369. * proceeding. But for input(),
  1370. * there's no matching to consider.
  1371. * So convert the EOB_ACT_LAST_MATCH
  1372. * to EOB_ACT_END_OF_FILE.
  1373. */
  1374. /* Reset buffer status. */
  1375. yyrestart(yyin );
  1376. /*FALLTHROUGH*/
  1377. case EOB_ACT_END_OF_FILE:
  1378. {
  1379. if ( yywrap( ) )
  1380. return EOF;
  1381. if ( ! (yy_did_buffer_switch_on_eof) )
  1382. YY_NEW_FILE;
  1383. #ifdef __cplusplus
  1384. return yyinput();
  1385. #else
  1386. return input();
  1387. #endif
  1388. }
  1389. case EOB_ACT_CONTINUE_SCAN:
  1390. (yy_c_buf_p) = (yytext_ptr) + offset;
  1391. break;
  1392. }
  1393. }
  1394. }
  1395. c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
  1396. *(yy_c_buf_p) = '\0'; /* preserve yytext */
  1397. (yy_hold_char) = *++(yy_c_buf_p);
  1398. YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
  1399. return c;
  1400. }
  1401. #endif /* ifndef YY_NO_INPUT */
  1402. /** Immediately switch to a different input stream.
  1403. * @param input_file A readable stream.
  1404. *
  1405. * @note This function does not reset the start condition to @c INITIAL .
  1406. */
  1407. void yyrestart (FILE * input_file )
  1408. {
  1409. if ( ! YY_CURRENT_BUFFER ){
  1410. yyensure_buffer_stack ();
  1411. YY_CURRENT_BUFFER_LVALUE =
  1412. yy_create_buffer(yyin,YY_BUF_SIZE );
  1413. }
  1414. yy_init_buffer(YY_CURRENT_BUFFER,input_file );
  1415. yy_load_buffer_state( );
  1416. }
  1417. /** Switch to a different input buffer.
  1418. * @param new_buffer The new input buffer.
  1419. *
  1420. */
  1421. void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
  1422. {
  1423. /* TODO. We should be able to replace this entire function body
  1424. * with
  1425. * yypop_buffer_state();
  1426. * yypush_buffer_state(new_buffer);
  1427. */
  1428. yyensure_buffer_stack ();
  1429. if ( YY_CURRENT_BUFFER == new_buffer )
  1430. return;
  1431. if ( YY_CURRENT_BUFFER )
  1432. {
  1433. /* Flush out information for old buffer. */
  1434. *(yy_c_buf_p) = (yy_hold_char);
  1435. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1436. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1437. }
  1438. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1439. yy_load_buffer_state( );
  1440. /* We don't actually know whether we did this switch during
  1441. * EOF (yywrap()) processing, but the only time this flag
  1442. * is looked at is after yywrap() is called, so it's safe
  1443. * to go ahead and always set it.
  1444. */
  1445. (yy_did_buffer_switch_on_eof) = 1;
  1446. }
  1447. static void yy_load_buffer_state (void)
  1448. {
  1449. (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
  1450. (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
  1451. yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
  1452. (yy_hold_char) = *(yy_c_buf_p);
  1453. }
  1454. /** Allocate and initialize an input buffer state.
  1455. * @param file A readable stream.
  1456. * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
  1457. *
  1458. * @return the allocated buffer state.
  1459. */
  1460. YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
  1461. {
  1462. YY_BUFFER_STATE b;
  1463. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1464. if ( ! b )
  1465. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1466. b->yy_buf_size = size;
  1467. /* yy_ch_buf has to be 2 characters longer than the size given because
  1468. * we need to put in 2 end-of-buffer characters.
  1469. */
  1470. b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
  1471. if ( ! b->yy_ch_buf )
  1472. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1473. b->yy_is_our_buffer = 1;
  1474. yy_init_buffer(b,file );
  1475. return b;
  1476. }
  1477. /** Destroy the buffer.
  1478. * @param b a buffer created with yy_create_buffer()
  1479. *
  1480. */
  1481. void yy_delete_buffer (YY_BUFFER_STATE b )
  1482. {
  1483. if ( ! b )
  1484. return;
  1485. if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
  1486. YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
  1487. if ( b->yy_is_our_buffer )
  1488. yyfree((void *) b->yy_ch_buf );
  1489. yyfree((void *) b );
  1490. }
  1491. /* Initializes or reinitializes a buffer.
  1492. * This function is sometimes called more than once on the same buffer,
  1493. * such as during a yyrestart() or at EOF.
  1494. */
  1495. static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
  1496. {
  1497. int oerrno = errno;
  1498. yy_flush_buffer(b );
  1499. b->yy_input_file = file;
  1500. b->yy_fill_buffer = 1;
  1501. /* If b is the current buffer, then yy_init_buffer was _probably_
  1502. * called from yyrestart() or through yy_get_next_buffer.
  1503. * In that case, we don't want to reset the lineno or column.
  1504. */
  1505. if (b != YY_CURRENT_BUFFER){
  1506. b->yy_bs_lineno = 1;
  1507. b->yy_bs_column = 0;
  1508. }
  1509. b->yy_is_interactive = 0;
  1510. errno = oerrno;
  1511. }
  1512. /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
  1513. * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
  1514. *
  1515. */
  1516. void yy_flush_buffer (YY_BUFFER_STATE b )
  1517. {
  1518. if ( ! b )
  1519. return;
  1520. b->yy_n_chars = 0;
  1521. /* We always need two end-of-buffer characters. The first causes
  1522. * a transition to the end-of-buffer state. The second causes
  1523. * a jam in that state.
  1524. */
  1525. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  1526. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1527. b->yy_buf_pos = &b->yy_ch_buf[0];
  1528. b->yy_at_bol = 1;
  1529. b->yy_buffer_status = YY_BUFFER_NEW;
  1530. if ( b == YY_CURRENT_BUFFER )
  1531. yy_load_buffer_state( );
  1532. }
  1533. /** Pushes the new state onto the stack. The new state becomes
  1534. * the current state. This function will allocate the stack
  1535. * if necessary.
  1536. * @param new_buffer The new state.
  1537. *
  1538. */
  1539. void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
  1540. {
  1541. if (new_buffer == NULL)
  1542. return;
  1543. yyensure_buffer_stack();
  1544. /* This block is copied from yy_switch_to_buffer. */
  1545. if ( YY_CURRENT_BUFFER )
  1546. {
  1547. /* Flush out information for old buffer. */
  1548. *(yy_c_buf_p) = (yy_hold_char);
  1549. YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
  1550. YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
  1551. }
  1552. /* Only push if top exists. Otherwise, replace top. */
  1553. if (YY_CURRENT_BUFFER)
  1554. (yy_buffer_stack_top)++;
  1555. YY_CURRENT_BUFFER_LVALUE = new_buffer;
  1556. /* copied from yy_switch_to_buffer. */
  1557. yy_load_buffer_state( );
  1558. (yy_did_buffer_switch_on_eof) = 1;
  1559. }
  1560. /** Removes and deletes the top of the stack, if present.
  1561. * The next element becomes the new top.
  1562. *
  1563. */
  1564. void yypop_buffer_state (void)
  1565. {
  1566. if (!YY_CURRENT_BUFFER)
  1567. return;
  1568. yy_delete_buffer(YY_CURRENT_BUFFER );
  1569. YY_CURRENT_BUFFER_LVALUE = NULL;
  1570. if ((yy_buffer_stack_top) > 0)
  1571. --(yy_buffer_stack_top);
  1572. if (YY_CURRENT_BUFFER) {
  1573. yy_load_buffer_state( );
  1574. (yy_did_buffer_switch_on_eof) = 1;
  1575. }
  1576. }
  1577. /* Allocates the stack if it does not exist.
  1578. * Guarantees space for at least one push.
  1579. */
  1580. static void yyensure_buffer_stack (void)
  1581. {
  1582. yy_size_t num_to_alloc;
  1583. if (!(yy_buffer_stack)) {
  1584. /* First allocation is just for 2 elements, since we don't know if this
  1585. * scanner will even need a stack. We use 2 instead of 1 to avoid an
  1586. * immediate realloc on the next call.
  1587. */
  1588. num_to_alloc = 1;
  1589. (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
  1590. (num_to_alloc * sizeof(struct yy_buffer_state*)
  1591. );
  1592. if ( ! (yy_buffer_stack) )
  1593. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1594. memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
  1595. (yy_buffer_stack_max) = num_to_alloc;
  1596. (yy_buffer_stack_top) = 0;
  1597. return;
  1598. }
  1599. if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
  1600. /* Increase the buffer to prepare for a possible push. */
  1601. int grow_size = 8 /* arbitrary grow size */;
  1602. num_to_alloc = (yy_buffer_stack_max) + grow_size;
  1603. (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
  1604. ((yy_buffer_stack),
  1605. num_to_alloc * sizeof(struct yy_buffer_state*)
  1606. );
  1607. if ( ! (yy_buffer_stack) )
  1608. YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
  1609. /* zero only the new slots.*/
  1610. memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
  1611. (yy_buffer_stack_max) = num_to_alloc;
  1612. }
  1613. }
  1614. /** Setup the input buffer state to scan directly from a user-specified character buffer.
  1615. * @param base the character buffer
  1616. * @param size the size in bytes of the character buffer
  1617. *
  1618. * @return the newly allocated buffer state object.
  1619. */
  1620. YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
  1621. {
  1622. YY_BUFFER_STATE b;
  1623. if ( size < 2 ||
  1624. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1625. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1626. /* They forgot to leave room for the EOB's. */
  1627. return 0;
  1628. b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
  1629. if ( ! b )
  1630. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1631. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1632. b->yy_buf_pos = b->yy_ch_buf = base;
  1633. b->yy_is_our_buffer = 0;
  1634. b->yy_input_file = 0;
  1635. b->yy_n_chars = b->yy_buf_size;
  1636. b->yy_is_interactive = 0;
  1637. b->yy_at_bol = 1;
  1638. b->yy_fill_buffer = 0;
  1639. b->yy_buffer_status = YY_BUFFER_NEW;
  1640. yy_switch_to_buffer(b );
  1641. return b;
  1642. }
  1643. /** Setup the input buffer state to scan a string. The next call to yylex() will
  1644. * scan from a @e copy of @a str.
  1645. * @param yystr a NUL-terminated string to scan
  1646. *
  1647. * @return the newly allocated buffer state object.
  1648. * @note If you want to scan bytes that may contain NUL values, then use
  1649. * yy_scan_bytes() instead.
  1650. */
  1651. YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
  1652. {
  1653. return yy_scan_bytes(yystr,strlen(yystr) );
  1654. }
  1655. /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
  1656. * scan from a @e copy of @a bytes.
  1657. * @param yybytes the byte buffer to scan
  1658. * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  1659. *
  1660. * @return the newly allocated buffer state object.
  1661. */
  1662. YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
  1663. {
  1664. YY_BUFFER_STATE b;
  1665. char *buf;
  1666. yy_size_t n;
  1667. yy_size_t i;
  1668. /* Get memory for full buffer, including space for trailing EOB's. */
  1669. n = _yybytes_len + 2;
  1670. buf = (char *) yyalloc(n );
  1671. if ( ! buf )
  1672. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1673. for ( i = 0; i < _yybytes_len; ++i )
  1674. buf[i] = yybytes[i];
  1675. buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
  1676. b = yy_scan_buffer(buf,n );
  1677. if ( ! b )
  1678. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1679. /* It's okay to grow etc. this buffer, and we should throw it
  1680. * away when we're done.
  1681. */
  1682. b->yy_is_our_buffer = 1;
  1683. return b;
  1684. }
  1685. #ifndef YY_EXIT_FAILURE
  1686. #define YY_EXIT_FAILURE 2
  1687. #endif
  1688. static void yy_fatal_error (yyconst char* msg )
  1689. {
  1690. (void) fprintf( stderr, "%s\n", msg );
  1691. exit( YY_EXIT_FAILURE );
  1692. }
  1693. /* Redefine yyless() so it works in section 3 code. */
  1694. #undef yyless
  1695. #define yyless(n) \
  1696. do \
  1697. { \
  1698. /* Undo effects of setting up yytext. */ \
  1699. int yyless_macro_arg = (n); \
  1700. YY_LESS_LINENO(yyless_macro_arg);\
  1701. yytext[yyleng] = (yy_hold_char); \
  1702. (yy_c_buf_p) = yytext + yyless_macro_arg; \
  1703. (yy_hold_char) = *(yy_c_buf_p); \
  1704. *(yy_c_buf_p) = '\0'; \
  1705. yyleng = yyless_macro_arg; \
  1706. } \
  1707. while ( 0 )
  1708. /* Accessor methods (get/set functions) to struct members. */
  1709. /** Get the current line number.
  1710. *
  1711. */
  1712. int yyget_lineno (void)
  1713. {
  1714. return yylineno;
  1715. }
  1716. /** Get the input stream.
  1717. *
  1718. */
  1719. FILE *yyget_in (void)
  1720. {
  1721. return yyin;
  1722. }
  1723. /** Get the output stream.
  1724. *
  1725. */
  1726. FILE *yyget_out (void)
  1727. {
  1728. return yyout;
  1729. }
  1730. /** Get the length of the current token.
  1731. *
  1732. */
  1733. yy_size_t yyget_leng (void)
  1734. {
  1735. return yyleng;
  1736. }
  1737. /** Get the current token.
  1738. *
  1739. */
  1740. char *yyget_text (void)
  1741. {
  1742. return yytext;
  1743. }
  1744. /** Set the current line number.
  1745. * @param line_number
  1746. *
  1747. */
  1748. void yyset_lineno (int line_number )
  1749. {
  1750. yylineno = line_number;
  1751. }
  1752. /** Set the input stream. This does not discard the current
  1753. * input buffer.
  1754. * @param in_str A readable stream.
  1755. *
  1756. * @see yy_switch_to_buffer
  1757. */
  1758. void yyset_in (FILE * in_str )
  1759. {
  1760. yyin = in_str ;
  1761. }
  1762. void yyset_out (FILE * out_str )
  1763. {
  1764. yyout = out_str ;
  1765. }
  1766. int yyget_debug (void)
  1767. {
  1768. return yy_flex_debug;
  1769. }
  1770. void yyset_debug (int bdebug )
  1771. {
  1772. yy_flex_debug = bdebug ;
  1773. }
  1774. static int yy_init_globals (void)
  1775. {
  1776. /* Initialization is the same as for the non-reentrant scanner.
  1777. * This function is called from yylex_destroy(), so don't allocate here.
  1778. */
  1779. (yy_buffer_stack) = 0;
  1780. (yy_buffer_stack_top) = 0;
  1781. (yy_buffer_stack_max) = 0;
  1782. (yy_c_buf_p) = (char *) 0;
  1783. (yy_init) = 0;
  1784. (yy_start) = 0;
  1785. /* Defined in main.c */
  1786. #ifdef YY_STDINIT
  1787. yyin = stdin;
  1788. yyout = stdout;
  1789. #else
  1790. yyin = (FILE *) 0;
  1791. yyout = (FILE *) 0;
  1792. #endif
  1793. /* For future reference: Set errno on error, since we are called by
  1794. * yylex_init()
  1795. */
  1796. return 0;
  1797. }
  1798. /* yylex_destroy is for both reentrant and non-reentrant scanners. */
  1799. int yylex_destroy (void)
  1800. {
  1801. /* Pop the buffer stack, destroying each element. */
  1802. while(YY_CURRENT_BUFFER){
  1803. yy_delete_buffer(YY_CURRENT_BUFFER );
  1804. YY_CURRENT_BUFFER_LVALUE = NULL;
  1805. yypop_buffer_state();
  1806. }
  1807. /* Destroy the stack itself. */
  1808. yyfree((yy_buffer_stack) );
  1809. (yy_buffer_stack) = NULL;
  1810. /* Reset the globals. This is important in a non-reentrant scanner so the next time
  1811. * yylex() is called, initialization will occur. */
  1812. yy_init_globals( );
  1813. return 0;
  1814. }
  1815. /*
  1816. * Internal utility routines.
  1817. */
  1818. #ifndef yytext_ptr
  1819. static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
  1820. {
  1821. register int i;
  1822. for ( i = 0; i < n; ++i )
  1823. s1[i] = s2[i];
  1824. }
  1825. #endif
  1826. #ifdef YY_NEED_STRLEN
  1827. static int yy_flex_strlen (yyconst char * s )
  1828. {
  1829. register int n;
  1830. for ( n = 0; s[n]; ++n )
  1831. ;
  1832. return n;
  1833. }
  1834. #endif
  1835. void *yyalloc (yy_size_t size )
  1836. {
  1837. return (void *) malloc( size );
  1838. }
  1839. void *yyrealloc (void * ptr, yy_size_t size )
  1840. {
  1841. /* The cast to (char *) in the following accommodates both
  1842. * implementations that use char* generic pointers, and those
  1843. * that use void* generic pointers. It works with the latter
  1844. * because both ANSI C and C++ allow castless assignment from
  1845. * any pointer type to void*, and deal with argument conversions
  1846. * as though doing an assignment.
  1847. */
  1848. return (void *) realloc( (char *) ptr, size );
  1849. }
  1850. void yyfree (void * ptr )
  1851. {
  1852. free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
  1853. }
  1854. #define YYTABLES_NAME "yytables"
  1855. #line 265 "dtc-lexer.l"
  1856. static void push_input_file(const char *filename)
  1857. {
  1858. assert(filename);
  1859. srcfile_push(filename);
  1860. yyin = current_srcfile->f;
  1861. yypush_buffer_state(yy_create_buffer(yyin,YY_BUF_SIZE));
  1862. }
  1863. static bool pop_input_file(void)
  1864. {
  1865. if (srcfile_pop() == 0)
  1866. return false;
  1867. yypop_buffer_state();
  1868. yyin = current_srcfile->f;
  1869. return true;
  1870. }
  1871. static void lexical_error(const char *fmt, ...)
  1872. {
  1873. va_list ap;
  1874. va_start(ap, fmt);
  1875. srcpos_verror(&yylloc, "Lexical error", fmt, ap);
  1876. va_end(ap);
  1877. treesource_error = true;
  1878. }