dtc-lexer.lex.c_shipped 59 KB

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