dtc-lexer.lex.c_shipped 57 KB

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