dtc-lexer.lex.c_shipped 59 KB

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