dtc-lexer.lex.c_shipped 51 KB

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