FLEX.skl 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497
  1. #include "StdH.h"
  2. /* A lexical scanner generated by flex */
  3. /* Scanner skeleton version:
  4. * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.81 95/03/20 14:02:24 vern Exp $
  5. */
  6. #define FLEX_SCANNER
  7. #define YY_FLEX_MAJOR_VERSION 2
  8. #define YY_FLEX_MINOR_VERSION 5
  9. %-
  10. #include <stdio.h>
  11. %*
  12. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  13. //#ifdef c_plusplus
  14. //#ifndef __cplusplus
  15. //#define __cplusplus
  16. //#endif
  17. //#endif
  18. #if 1 //def __cplusplus
  19. #include <stdlib.h>
  20. %+
  21. class istream;
  22. %*
  23. /* Use prototypes in function declarations. */
  24. #define YY_USE_PROTOS
  25. /* The "const" storage-class-modifier is valid. */
  26. #define YY_USE_CONST
  27. #else /* ! __cplusplus */
  28. #if __STDC__
  29. #define YY_USE_PROTOS
  30. #define YY_USE_CONST
  31. #endif /* __STDC__ */
  32. #endif /* ! __cplusplus */
  33. #ifdef __TURBOC__
  34. #pragma warn -rch
  35. #pragma warn -use
  36. #include <io.h>
  37. #include <stdlib.h>
  38. #define YY_USE_CONST
  39. #define YY_USE_PROTOS
  40. #endif
  41. #ifdef YY_USE_CONST
  42. #define yyconst const
  43. #else
  44. #define yyconst
  45. #endif
  46. #ifdef YY_USE_PROTOS
  47. #define YY_PROTO(proto) proto
  48. #else
  49. #define YY_PROTO(proto) ()
  50. #endif
  51. /* Returned upon end-of-file. */
  52. #define YY_NULL 0
  53. /* Promotes a possibly negative, possibly signed char to an unsigned
  54. * integer for use as an array index. If the signed char is negative,
  55. * we want to instead treat it as an 8-bit unsigned char, hence the
  56. * double cast.
  57. */
  58. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  59. /* Enter a start condition. This macro really ought to take a parameter,
  60. * but we do it the disgusting crufty way forced on us by the ()-less
  61. * definition of BEGIN.
  62. */
  63. #define BEGIN yy_start = 1 + 2 *
  64. /* Translate the current start state into a value that can be later handed
  65. * to BEGIN to return to the state. The YYSTATE alias is for lex
  66. * compatibility.
  67. */
  68. #define YY_START ((yy_start - 1) / 2)
  69. #define YYSTATE YY_START
  70. /* Action number for EOF rule of a given start state. */
  71. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  72. /* Special action meaning "start processing a new file". */
  73. #define YY_NEW_FILE yyrestart( yyin )
  74. #define YY_END_OF_BUFFER_CHAR 0
  75. /* Size of default input buffer. */
  76. #define YY_BUF_SIZE 16384
  77. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  78. extern int yyleng;
  79. %-
  80. extern FILE *yyin, *yyout;
  81. %*
  82. #define EOB_ACT_CONTINUE_SCAN 0
  83. #define EOB_ACT_END_OF_FILE 1
  84. #define EOB_ACT_LAST_MATCH 2
  85. /* The funky do-while in the following #define is used to turn the definition
  86. * int a single C statement (which needs a semi-colon terminator). This
  87. * avoids problems with code like:
  88. *
  89. * if ( condition_holds )
  90. * yyless( 5 );
  91. * else
  92. * do_something_else();
  93. *
  94. * Prior to using the do-while the compiler would get upset at the
  95. * "else" because it interpreted the "if" statement as being all
  96. * done when it reached the ';' after the yyless() call.
  97. */
  98. /* Return all but the first 'n' matched characters back to the input stream. */
  99. #define yyless(n) \
  100. do \
  101. { \
  102. /* Undo effects of setting up yytext. */ \
  103. *yy_cp = yy_hold_char; \
  104. yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  105. YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  106. } \
  107. while ( 0 )
  108. #define unput(c) yyunput( c, yytext_ptr )
  109. /* The following is because we cannot portably get our hands on size_t
  110. * (without autoconf's help, which isn't available because we want
  111. * flex-generated scanners to compile on their own).
  112. */
  113. typedef unsigned int yy_size_t;
  114. struct yy_buffer_state
  115. {
  116. %-
  117. FILE *yy_input_file;
  118. %+
  119. istream* yy_input_file;
  120. %*
  121. char *yy_ch_buf; /* input buffer */
  122. char *yy_buf_pos; /* current position in input buffer */
  123. /* Size of input buffer in bytes, not including room for EOB
  124. * characters.
  125. */
  126. yy_size_t yy_buf_size;
  127. /* Number of characters read into yy_ch_buf, not including EOB
  128. * characters.
  129. */
  130. int yy_n_chars;
  131. /* Whether we "own" the buffer - i.e., we know we created it,
  132. * and can realloc() it to grow it, and should free() it to
  133. * delete it.
  134. */
  135. int yy_is_our_buffer;
  136. /* Whether this is an "interactive" input source; if so, and
  137. * if we're using stdio for input, then we want to use getc()
  138. * instead of fread(), to make sure we stop fetching input after
  139. * each newline.
  140. */
  141. int yy_is_interactive;
  142. /* Whether we're considered to be at the beginning of a line.
  143. * If so, '^' rules will be active on the next match, otherwise
  144. * not.
  145. */
  146. int yy_at_bol;
  147. /* Whether to try to fill the input buffer when we reach the
  148. * end of it.
  149. */
  150. int yy_fill_buffer;
  151. int yy_buffer_status;
  152. #define YY_BUFFER_NEW 0
  153. #define YY_BUFFER_NORMAL 1
  154. /* When an EOF's been seen but there's still some text to process
  155. * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  156. * shouldn't try reading from the input source any more. We might
  157. * still have a bunch of tokens to match, though, because of
  158. * possible backing-up.
  159. *
  160. * When we actually see the EOF, we change the status to "new"
  161. * (via yyrestart()), so that the user can continue scanning by
  162. * just pointing yyin at a new input file.
  163. */
  164. #define YY_BUFFER_EOF_PENDING 2
  165. };
  166. %- Standard (non-C++) definition
  167. static YY_BUFFER_STATE yy_current_buffer = 0;
  168. %*
  169. /* We provide macros for accessing buffer states in case in the
  170. * future we want to put the buffer states in a more general
  171. * "scanner state".
  172. */
  173. #define YY_CURRENT_BUFFER yy_current_buffer
  174. %- Standard (non-C++) definition
  175. /* yy_hold_char holds the character lost when yytext is formed. */
  176. static char yy_hold_char;
  177. static int yy_n_chars; /* number of characters read into yy_ch_buf */
  178. int yyleng;
  179. /* Points to current character in buffer. */
  180. static char *yy_c_buf_p = (char *) 0;
  181. static int yy_init = 1; /* whether we need to initialize */
  182. static int yy_start = 0; /* start state number */
  183. /* Flag which is used to allow yywrap()'s to do buffer switches
  184. * instead of setting up a fresh yyin. A bit of a hack ...
  185. */
  186. static int yy_did_buffer_switch_on_eof;
  187. void yyrestart YY_PROTO(( FILE *input_file ));
  188. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  189. void yy_load_buffer_state YY_PROTO(( void ));
  190. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  191. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  192. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  193. void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  194. #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
  195. YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
  196. YY_BUFFER_STATE yy_scan_string YY_PROTO(( const char *str ));
  197. YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( const char *bytes, int len ));
  198. %*
  199. static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
  200. static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
  201. static void yy_flex_free YY_PROTO(( void * ));
  202. #define yy_new_buffer yy_create_buffer
  203. #define yy_set_interactive(is_interactive) \
  204. { \
  205. if ( ! yy_current_buffer ) \
  206. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  207. yy_current_buffer->yy_is_interactive = is_interactive; \
  208. }
  209. #define yy_set_bol(at_bol) \
  210. { \
  211. if ( ! yy_current_buffer ) \
  212. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
  213. yy_current_buffer->yy_at_bol = at_bol; \
  214. }
  215. #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
  216. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  217. #ifndef YY_SKIP_YYWRAP
  218. #ifdef __cplusplus
  219. extern "C" int yywrap YY_PROTO(( void ));
  220. #else
  221. extern int yywrap YY_PROTO(( void ));
  222. #endif
  223. #endif
  224. #ifndef YY_NO_UNPUT
  225. //static
  226. void yyunput YY_PROTO(( int c, char *buf_ptr ));
  227. #endif
  228. #ifndef yytext_ptr
  229. static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
  230. #endif
  231. #ifndef YY_NO_INPUT
  232. %- Standard (non-C++) definition
  233. #ifdef __cplusplus
  234. static int yyinput YY_PROTO(( void ));
  235. #else
  236. static int input YY_PROTO(( void ));
  237. #endif
  238. %*
  239. #endif
  240. %- Standard (non-C++) definition
  241. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  242. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  243. static int yy_get_next_buffer YY_PROTO(( void ));
  244. static void yy_fatal_error YY_PROTO(( const char msg[] ));
  245. %*
  246. /* Done after the current pattern has been matched and before the
  247. * corresponding action - sets up yytext.
  248. */
  249. #define YY_DO_BEFORE_ACTION \
  250. yytext_ptr = yy_bp; \
  251. %% code to fiddle yytext and yyleng for yymore() goes here
  252. yy_hold_char = *yy_cp; \
  253. *yy_cp = '\0'; \
  254. %% code to copy yytext_ptr to yytext[] goes here, if %array
  255. yy_c_buf_p = yy_cp;
  256. %% data tables for the DFA and the user's section 1 definitions go here
  257. /* Macros after this point can all be overridden by user definitions in
  258. * section 1.
  259. */
  260. #ifdef YY_STACK_USED
  261. static int yy_start_stack_ptr = 0;
  262. static int yy_start_stack_depth = 0;
  263. static int *yy_start_stack = 0;
  264. #ifndef YY_NO_PUSH_STATE
  265. static void yy_push_state YY_PROTO(( int new_state ));
  266. #endif
  267. #ifndef YY_NO_POP_STATE
  268. static void yy_pop_state YY_PROTO(( void ));
  269. #endif
  270. #ifndef YY_NO_TOP_STATE
  271. static int yy_top_state YY_PROTO(( void ));
  272. #endif
  273. #else
  274. #define YY_NO_PUSH_STATE 1
  275. #define YY_NO_POP_STATE 1
  276. #define YY_NO_TOP_STATE 1
  277. #endif
  278. #ifdef YY_MALLOC_DECL
  279. YY_MALLOC_DECL
  280. #else
  281. #if __STDC__
  282. #ifndef __cplusplus
  283. #include <stdlib.h>
  284. #endif
  285. #else
  286. /* Just try to get by without declaring the routines. This will fail
  287. * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  288. * or sizeof(void*) != sizeof(int).
  289. */
  290. #endif
  291. #endif
  292. /* Amount of stuff to slurp up with each read. */
  293. #ifndef YY_READ_BUF_SIZE
  294. #define YY_READ_BUF_SIZE 8192
  295. #endif
  296. /* Copy whatever the last rule matched to the standard output. */
  297. #ifndef ECHO
  298. %- Standard (non-C++) definition
  299. /* This used to be an fputs(), but since the string might contain NUL's,
  300. * we now use fwrite().
  301. */
  302. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  303. %+ C++ definition
  304. #define ECHO LexerOutput( yytext, yyleng )
  305. %*
  306. #endif
  307. /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
  308. * is returned in "result".
  309. */
  310. #ifndef YY_INPUT
  311. #define YY_INPUT(buf,result,max_size) \
  312. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  313. %+ C++ definition
  314. if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  315. YY_FATAL_ERROR( "input in flex scanner failed" );
  316. %*
  317. #endif
  318. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  319. * we don't want an extra ';' after the "return" because that will cause
  320. * some compilers to complain about unreachable statements.
  321. */
  322. #ifndef yyterminate
  323. #define yyterminate() return YY_NULL
  324. #endif
  325. /* Number of entries by which start-condition stack grows. */
  326. #ifndef YY_START_STACK_INCR
  327. #define YY_START_STACK_INCR 25
  328. #endif
  329. /* Report a fatal error. */
  330. #ifndef YY_FATAL_ERROR
  331. %-
  332. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  333. %+
  334. #define YY_FATAL_ERROR(msg) LexerError( msg )
  335. %*
  336. #endif
  337. /* Default declaration of generated scanner - a define so the user can
  338. * easily add parameters.
  339. */
  340. #ifndef YY_DECL
  341. %- Standard (non-C++) definition
  342. #define YY_DECL int yylex YY_PROTO(( void ))
  343. %+ C++ definition
  344. #define YY_DECL int yyFlexLexer::yylex()
  345. %*
  346. #endif
  347. /* Code executed at the beginning of each rule, after yytext and yyleng
  348. * have been set up.
  349. */
  350. #ifndef YY_USER_ACTION
  351. #define YY_USER_ACTION
  352. #endif
  353. /* Code executed at the end of each rule. */
  354. #ifndef YY_BREAK
  355. #define YY_BREAK break;
  356. #endif
  357. %% YY_RULE_SETUP definition goes here
  358. YY_DECL
  359. {
  360. register yy_state_type yy_current_state;
  361. register char *yy_cp, *yy_bp;
  362. register int yy_act;
  363. %% user's declarations go here
  364. if ( yy_init )
  365. {
  366. yy_init = 0;
  367. #ifdef YY_USER_INIT
  368. YY_USER_INIT;
  369. #endif
  370. if ( ! yy_start )
  371. yy_start = 1; /* first start state */
  372. if ( ! yyin )
  373. %-
  374. yyin = stdin;
  375. %+
  376. yyin = &cin;
  377. %*
  378. if ( ! yyout )
  379. %-
  380. yyout = stdout;
  381. %+
  382. yyout = &cout;
  383. %*
  384. if ( ! yy_current_buffer )
  385. yy_current_buffer =
  386. yy_create_buffer( yyin, YY_BUF_SIZE );
  387. yy_load_buffer_state();
  388. }
  389. while ( 1 ) /* loops until end-of-file is reached */
  390. {
  391. %% yymore()-related code goes here
  392. yy_cp = yy_c_buf_p;
  393. /* Support of yytext. */
  394. *yy_cp = yy_hold_char;
  395. /* yy_bp points to the position in yy_ch_buf of the start of
  396. * the current run.
  397. */
  398. yy_bp = yy_cp;
  399. %% code to set up and find next match goes here
  400. yy_find_action:
  401. %% code to find the action number goes here
  402. YY_DO_BEFORE_ACTION;
  403. %% code for yylineno update goes here
  404. do_action: /* This label is used only to access EOF actions. */
  405. %% debug code goes here
  406. switch ( yy_act )
  407. { /* beginning of action switch */
  408. %% actions go here
  409. case YY_END_OF_BUFFER:
  410. {
  411. /* Amount of text matched not including the EOB char. */
  412. int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
  413. /* Undo the effects of YY_DO_BEFORE_ACTION. */
  414. *yy_cp = yy_hold_char;
  415. if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  416. {
  417. /* We're scanning a new file or input source. It's
  418. * possible that this happened because the user
  419. * just pointed yyin at a new source and called
  420. * yylex(). If so, then we have to assure
  421. * consistency between yy_current_buffer and our
  422. * globals. Here is the right place to do so, because
  423. * this is the first action (other than possibly a
  424. * back-up) that will match for the new input source.
  425. */
  426. yy_n_chars = yy_current_buffer->yy_n_chars;
  427. yy_current_buffer->yy_input_file = yyin;
  428. yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  429. }
  430. /* Note that here we test for yy_c_buf_p "<=" to the position
  431. * of the first EOB in the buffer, since yy_c_buf_p will
  432. * already have been incremented past the NUL character
  433. * (since all states make transitions on EOB to the
  434. * end-of-buffer state). Contrast this with the test
  435. * in input().
  436. */
  437. if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  438. { /* This was really a NUL. */
  439. yy_state_type yy_next_state;
  440. yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  441. yy_current_state = yy_get_previous_state();
  442. /* Okay, we're now positioned to make the NUL
  443. * transition. We couldn't have
  444. * yy_get_previous_state() go ahead and do it
  445. * for us because it doesn't know how to deal
  446. * with the possibility of jamming (and we don't
  447. * want to build jamming into it because then it
  448. * will run more slowly).
  449. */
  450. yy_next_state = yy_try_NUL_trans( yy_current_state );
  451. yy_bp = yytext_ptr + YY_MORE_ADJ;
  452. if ( yy_next_state )
  453. {
  454. /* Consume the NUL. */
  455. yy_cp = ++yy_c_buf_p;
  456. yy_current_state = yy_next_state;
  457. goto yy_match;
  458. }
  459. else
  460. {
  461. %% code to do back-up for compressed tables and set up yy_cp goes here
  462. goto yy_find_action;
  463. }
  464. }
  465. else switch ( yy_get_next_buffer() )
  466. {
  467. case EOB_ACT_END_OF_FILE:
  468. {
  469. yy_did_buffer_switch_on_eof = 0;
  470. if ( yywrap() )
  471. {
  472. /* Note: because we've taken care in
  473. * yy_get_next_buffer() to have set up
  474. * yytext, we can now set up
  475. * yy_c_buf_p so that if some total
  476. * hoser (like flex itself) wants to
  477. * call the scanner after we return the
  478. * YY_NULL, it'll still work - another
  479. * YY_NULL will get returned.
  480. */
  481. yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  482. yy_act = YY_STATE_EOF(YY_START);
  483. goto do_action;
  484. }
  485. else
  486. {
  487. if ( ! yy_did_buffer_switch_on_eof )
  488. YY_NEW_FILE;
  489. }
  490. break;
  491. }
  492. case EOB_ACT_CONTINUE_SCAN:
  493. yy_c_buf_p =
  494. yytext_ptr + yy_amount_of_matched_text;
  495. yy_current_state = yy_get_previous_state();
  496. yy_cp = yy_c_buf_p;
  497. yy_bp = yytext_ptr + YY_MORE_ADJ;
  498. goto yy_match;
  499. case EOB_ACT_LAST_MATCH:
  500. yy_c_buf_p =
  501. &yy_current_buffer->yy_ch_buf[yy_n_chars];
  502. yy_current_state = yy_get_previous_state();
  503. yy_cp = yy_c_buf_p;
  504. yy_bp = yytext_ptr + YY_MORE_ADJ;
  505. goto yy_find_action;
  506. }
  507. break;
  508. }
  509. default:
  510. YY_FATAL_ERROR(
  511. "fatal flex scanner internal error--no action found" );
  512. } /* end of action switch */
  513. } /* end of scanning one token */
  514. } /* end of yylex */
  515. %+
  516. yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
  517. {
  518. yyin = arg_yyin;
  519. yyout = arg_yyout;
  520. yy_c_buf_p = 0;
  521. yy_init = 1;
  522. yy_start = 0;
  523. yy_flex_debug = 0;
  524. yylineno = 1; // this will only get updated if %option yylineno
  525. yy_did_buffer_switch_on_eof = 0;
  526. yy_looking_for_trail_begin = 0;
  527. yy_more_flag = 0;
  528. yy_more_len = 0;
  529. yy_start_stack_ptr = yy_start_stack_depth = 0;
  530. yy_start_stack = 0;
  531. yy_current_buffer = 0;
  532. #ifdef YY_USES_REJECT
  533. yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
  534. #else
  535. yy_state_buf = 0;
  536. #endif
  537. }
  538. yyFlexLexer::~yyFlexLexer()
  539. {
  540. delete yy_state_buf;
  541. yy_delete_buffer( yy_current_buffer );
  542. }
  543. void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
  544. {
  545. if ( new_in )
  546. {
  547. yy_delete_buffer( yy_current_buffer );
  548. yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
  549. }
  550. if ( new_out )
  551. yyout = new_out;
  552. }
  553. #ifdef YY_INTERACTIVE
  554. int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
  555. #else
  556. int yyFlexLexer::LexerInput( char* buf, int max_size )
  557. #endif
  558. {
  559. if ( yyin->eof() || yyin->fail() )
  560. return 0;
  561. #ifdef YY_INTERACTIVE
  562. yyin->get( buf[0] );
  563. if ( yyin->eof() )
  564. return 0;
  565. if ( yyin->bad() )
  566. return -1;
  567. return 1;
  568. #else
  569. (void) yyin->read( buf, max_size );
  570. if ( yyin->bad() )
  571. return -1;
  572. else
  573. return yyin->gcount();
  574. #endif
  575. }
  576. void yyFlexLexer::LexerOutput( const char* buf, int size )
  577. {
  578. (void) yyout->write( buf, size );
  579. }
  580. %*
  581. /* yy_get_next_buffer - try to read in a new buffer
  582. *
  583. * Returns a code representing an action:
  584. * EOB_ACT_LAST_MATCH -
  585. * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  586. * EOB_ACT_END_OF_FILE - end of file
  587. */
  588. %-
  589. static int yy_get_next_buffer()
  590. %+
  591. int yyFlexLexer::yy_get_next_buffer()
  592. %*
  593. {
  594. register char *dest = yy_current_buffer->yy_ch_buf;
  595. register char *source = yytext_ptr;
  596. register int number_to_move, i;
  597. int ret_val;
  598. if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  599. YY_FATAL_ERROR(
  600. "fatal flex scanner internal error--end of buffer missed" );
  601. if ( yy_current_buffer->yy_fill_buffer == 0 )
  602. { /* Don't try to fill the buffer, so this is an EOF. */
  603. if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  604. {
  605. /* We matched a singled characater, the EOB, so
  606. * treat this as a final EOF.
  607. */
  608. return EOB_ACT_END_OF_FILE;
  609. }
  610. else
  611. {
  612. /* We matched some text prior to the EOB, first
  613. * process it.
  614. */
  615. return EOB_ACT_LAST_MATCH;
  616. }
  617. }
  618. /* Try to read more data. */
  619. /* First move last chars to start of buffer. */
  620. number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
  621. for ( i = 0; i < number_to_move; ++i )
  622. *(dest++) = *(source++);
  623. if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  624. /* don't do the read, it's not guaranteed to return an EOF,
  625. * just force an EOF
  626. */
  627. yy_n_chars = 0;
  628. else
  629. {
  630. int num_to_read =
  631. yy_current_buffer->yy_buf_size - number_to_move - 1;
  632. while ( num_to_read <= 0 )
  633. { /* Not enough room in the buffer - grow it. */
  634. #ifdef YY_USES_REJECT
  635. YY_FATAL_ERROR(
  636. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  637. #else
  638. /* just a shorter name for the current buffer */
  639. YY_BUFFER_STATE b = yy_current_buffer;
  640. int yy_c_buf_p_offset =
  641. (int) (yy_c_buf_p - b->yy_ch_buf);
  642. if ( b->yy_is_our_buffer )
  643. {
  644. int new_size = b->yy_buf_size * 2;
  645. if ( new_size <= 0 )
  646. b->yy_buf_size += b->yy_buf_size / 8;
  647. else
  648. b->yy_buf_size *= 2;
  649. b->yy_ch_buf = (char *)
  650. /* Include room in for 2 EOB chars. */
  651. yy_flex_realloc( (void *) b->yy_ch_buf,
  652. b->yy_buf_size + 2 );
  653. }
  654. else
  655. /* Can't grow it, we don't own it. */
  656. b->yy_ch_buf = 0;
  657. if ( ! b->yy_ch_buf )
  658. YY_FATAL_ERROR(
  659. "fatal error - scanner input buffer overflow" );
  660. yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  661. num_to_read = yy_current_buffer->yy_buf_size -
  662. number_to_move - 1;
  663. #endif
  664. }
  665. if ( num_to_read > YY_READ_BUF_SIZE )
  666. num_to_read = YY_READ_BUF_SIZE;
  667. /* Read in more data. */
  668. YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  669. yy_n_chars, num_to_read );
  670. }
  671. if ( yy_n_chars == 0 )
  672. {
  673. if ( number_to_move == YY_MORE_ADJ )
  674. {
  675. ret_val = EOB_ACT_END_OF_FILE;
  676. yyrestart( yyin );
  677. }
  678. else
  679. {
  680. ret_val = EOB_ACT_LAST_MATCH;
  681. yy_current_buffer->yy_buffer_status =
  682. YY_BUFFER_EOF_PENDING;
  683. }
  684. }
  685. else
  686. ret_val = EOB_ACT_CONTINUE_SCAN;
  687. yy_n_chars += number_to_move;
  688. yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  689. yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  690. yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
  691. return ret_val;
  692. }
  693. /* yy_get_previous_state - get the state just before the EOB char was reached */
  694. %-
  695. static yy_state_type yy_get_previous_state()
  696. %+
  697. yy_state_type yyFlexLexer::yy_get_previous_state()
  698. %*
  699. {
  700. register yy_state_type yy_current_state;
  701. register char *yy_cp;
  702. %% code to get the start state into yy_current_state goes here
  703. for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  704. {
  705. %% code to find the next state goes here
  706. }
  707. return yy_current_state;
  708. }
  709. /* yy_try_NUL_trans - try to make a transition on the NUL character
  710. *
  711. * synopsis
  712. * next_state = yy_try_NUL_trans( current_state );
  713. */
  714. %-
  715. #ifdef YY_USE_PROTOS
  716. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  717. #else
  718. static yy_state_type yy_try_NUL_trans( yy_current_state )
  719. yy_state_type yy_current_state;
  720. #endif
  721. %+
  722. yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
  723. %*
  724. {
  725. register int yy_is_jam;
  726. %% code to find the next state, and perhaps do backing up, goes here
  727. return yy_is_jam ? 0 : yy_current_state;
  728. }
  729. %-
  730. #ifdef YY_USE_PROTOS
  731. //static
  732. void yyunput( int c, register char *yy_bp )
  733. #else
  734. //static
  735. void yyunput( c, yy_bp )
  736. int c;
  737. register char *yy_bp;
  738. #endif
  739. %+
  740. void yyFlexLexer::yyunput( int c, register char* yy_bp )
  741. %*
  742. {
  743. register char *yy_cp = yy_c_buf_p;
  744. /* undo effects of setting up yytext */
  745. *yy_cp = yy_hold_char;
  746. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  747. { /* need to shift things up to make room */
  748. /* +2 for EOB chars. */
  749. register int number_to_move = yy_n_chars + 2;
  750. register char *dest = &yy_current_buffer->yy_ch_buf[
  751. yy_current_buffer->yy_buf_size + 2];
  752. register char *source =
  753. &yy_current_buffer->yy_ch_buf[number_to_move];
  754. while ( source > yy_current_buffer->yy_ch_buf )
  755. *--dest = *--source;
  756. yy_cp += (int) (dest - source);
  757. yy_bp += (int) (dest - source);
  758. yy_n_chars = yy_current_buffer->yy_buf_size;
  759. if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  760. YY_FATAL_ERROR( "flex scanner push-back overflow" );
  761. }
  762. *--yy_cp = (char) c;
  763. %% update yylineno here
  764. yytext_ptr = yy_bp;
  765. yy_hold_char = *yy_cp;
  766. yy_c_buf_p = yy_cp;
  767. }
  768. %-
  769. #ifdef __cplusplus
  770. static int yyinput()
  771. #else
  772. static int input()
  773. #endif
  774. %+
  775. int yyFlexLexer::yyinput()
  776. %*
  777. {
  778. int c;
  779. *yy_c_buf_p = yy_hold_char;
  780. if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  781. {
  782. /* yy_c_buf_p now points to the character we want to return.
  783. * If this occurs *before* the EOB characters, then it's a
  784. * valid NUL; if not, then we've hit the end of the buffer.
  785. */
  786. if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  787. /* This was really a NUL. */
  788. *yy_c_buf_p = '\0';
  789. else
  790. { /* need more input */
  791. yytext_ptr = yy_c_buf_p;
  792. ++yy_c_buf_p;
  793. switch ( yy_get_next_buffer() )
  794. {
  795. case EOB_ACT_END_OF_FILE:
  796. {
  797. if ( yywrap() )
  798. {
  799. yy_c_buf_p =
  800. yytext_ptr + YY_MORE_ADJ;
  801. return EOF;
  802. }
  803. if ( ! yy_did_buffer_switch_on_eof )
  804. YY_NEW_FILE;
  805. #ifdef __cplusplus
  806. return yyinput();
  807. #else
  808. return input();
  809. #endif
  810. }
  811. case EOB_ACT_CONTINUE_SCAN:
  812. yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  813. break;
  814. case EOB_ACT_LAST_MATCH:
  815. #ifdef __cplusplus
  816. YY_FATAL_ERROR(
  817. "unexpected last match in yyinput()" );
  818. #else
  819. YY_FATAL_ERROR(
  820. "unexpected last match in input()" );
  821. #endif
  822. }
  823. }
  824. }
  825. c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
  826. *yy_c_buf_p = '\0'; /* preserve yytext */
  827. yy_hold_char = *++yy_c_buf_p;
  828. %% update BOL and yylineno
  829. return c;
  830. }
  831. %-
  832. #ifdef YY_USE_PROTOS
  833. void yyrestart( FILE *input_file )
  834. #else
  835. void yyrestart( input_file )
  836. FILE *input_file;
  837. #endif
  838. %+
  839. void yyFlexLexer::yyrestart( istream* input_file )
  840. %*
  841. {
  842. if ( ! yy_current_buffer )
  843. yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  844. yy_init_buffer( yy_current_buffer, input_file );
  845. yy_load_buffer_state();
  846. }
  847. %-
  848. #ifdef YY_USE_PROTOS
  849. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  850. #else
  851. void yy_switch_to_buffer( new_buffer )
  852. YY_BUFFER_STATE new_buffer;
  853. #endif
  854. %+
  855. void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  856. %*
  857. {
  858. if ( yy_current_buffer == new_buffer )
  859. return;
  860. if ( yy_current_buffer )
  861. {
  862. /* Flush out information for old buffer. */
  863. *yy_c_buf_p = yy_hold_char;
  864. yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  865. yy_current_buffer->yy_n_chars = yy_n_chars;
  866. }
  867. yy_current_buffer = new_buffer;
  868. yy_load_buffer_state();
  869. /* We don't actually know whether we did this switch during
  870. * EOF (yywrap()) processing, but the only time this flag
  871. * is looked at is after yywrap() is called, so it's safe
  872. * to go ahead and always set it.
  873. */
  874. yy_did_buffer_switch_on_eof = 1;
  875. }
  876. %-
  877. #ifdef YY_USE_PROTOS
  878. void yy_load_buffer_state( void )
  879. #else
  880. void yy_load_buffer_state()
  881. #endif
  882. %+
  883. void yyFlexLexer::yy_load_buffer_state()
  884. %*
  885. {
  886. yy_n_chars = yy_current_buffer->yy_n_chars;
  887. yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  888. yyin = yy_current_buffer->yy_input_file;
  889. yy_hold_char = *yy_c_buf_p;
  890. }
  891. %-
  892. #ifdef YY_USE_PROTOS
  893. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  894. #else
  895. YY_BUFFER_STATE yy_create_buffer( file, size )
  896. FILE *file;
  897. int size;
  898. #endif
  899. %+
  900. YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
  901. %*
  902. {
  903. YY_BUFFER_STATE b;
  904. b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  905. if ( ! b )
  906. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  907. b->yy_buf_size = size;
  908. /* yy_ch_buf has to be 2 characters longer than the size given because
  909. * we need to put in 2 end-of-buffer characters.
  910. */
  911. b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  912. if ( ! b->yy_ch_buf )
  913. YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  914. b->yy_is_our_buffer = 1;
  915. yy_init_buffer( b, file );
  916. return b;
  917. }
  918. %-
  919. #ifdef YY_USE_PROTOS
  920. void yy_delete_buffer( YY_BUFFER_STATE b )
  921. #else
  922. void yy_delete_buffer( b )
  923. YY_BUFFER_STATE b;
  924. #endif
  925. %+
  926. void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
  927. %*
  928. {
  929. if ( b == yy_current_buffer )
  930. yy_current_buffer = (YY_BUFFER_STATE) 0;
  931. if ( b->yy_is_our_buffer )
  932. yy_flex_free( (void *) b->yy_ch_buf );
  933. yy_flex_free( (void *) b );
  934. }
  935. %-
  936. #ifndef YY_ALWAYS_INTERACTIVE
  937. #ifndef YY_NEVER_INTERACTIVE
  938. extern int isatty YY_PROTO(( int ));
  939. #endif
  940. #endif
  941. #ifdef YY_USE_PROTOS
  942. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  943. #else
  944. void yy_init_buffer( b, file )
  945. YY_BUFFER_STATE b;
  946. FILE *file;
  947. #endif
  948. %+
  949. extern "C" int isatty YY_PROTO(( int ));
  950. void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
  951. %*
  952. {
  953. yy_flush_buffer( b );
  954. b->yy_input_file = file;
  955. b->yy_fill_buffer = 1;
  956. %-
  957. #ifdef YY_ALWAYS_INTERACTIVE
  958. b->yy_is_interactive = 1;
  959. #else
  960. #ifdef YY_NEVER_INTERACTIVE
  961. b->yy_is_interactive = 0;
  962. #else
  963. b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
  964. #endif
  965. #endif
  966. %+
  967. b->yy_is_interactive = 0;
  968. %*
  969. }
  970. %-
  971. #ifdef YY_USE_PROTOS
  972. void yy_flush_buffer( YY_BUFFER_STATE b )
  973. #else
  974. void yy_flush_buffer( b )
  975. YY_BUFFER_STATE b;
  976. #endif
  977. %+
  978. void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
  979. %*
  980. {
  981. b->yy_n_chars = 0;
  982. /* We always need two end-of-buffer characters. The first causes
  983. * a transition to the end-of-buffer state. The second causes
  984. * a jam in that state.
  985. */
  986. b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
  987. b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  988. b->yy_buf_pos = &b->yy_ch_buf[0];
  989. b->yy_at_bol = 1;
  990. b->yy_buffer_status = YY_BUFFER_NEW;
  991. if ( b == yy_current_buffer )
  992. yy_load_buffer_state();
  993. }
  994. %*
  995. #ifndef YY_NO_SCAN_BUFFER
  996. %-
  997. #ifdef YY_USE_PROTOS
  998. YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
  999. #else
  1000. YY_BUFFER_STATE yy_scan_buffer( base, size )
  1001. char *base;
  1002. yy_size_t size;
  1003. #endif
  1004. {
  1005. YY_BUFFER_STATE b;
  1006. if ( size < 2 ||
  1007. base[size-2] != YY_END_OF_BUFFER_CHAR ||
  1008. base[size-1] != YY_END_OF_BUFFER_CHAR )
  1009. /* They forgot to leave room for the EOB's. */
  1010. return 0;
  1011. b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  1012. if ( ! b )
  1013. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
  1014. b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
  1015. b->yy_buf_pos = b->yy_ch_buf = base;
  1016. b->yy_is_our_buffer = 0;
  1017. b->yy_input_file = 0;
  1018. b->yy_n_chars = b->yy_buf_size;
  1019. b->yy_is_interactive = 0;
  1020. b->yy_at_bol = 1;
  1021. b->yy_fill_buffer = 0;
  1022. b->yy_buffer_status = YY_BUFFER_NEW;
  1023. yy_switch_to_buffer( b );
  1024. return b;
  1025. }
  1026. %*
  1027. #endif
  1028. #ifndef YY_NO_SCAN_STRING
  1029. %-
  1030. #ifdef YY_USE_PROTOS
  1031. YY_BUFFER_STATE yy_scan_string( const char *str )
  1032. #else
  1033. YY_BUFFER_STATE yy_scan_string( str )
  1034. const char *str;
  1035. #endif
  1036. {
  1037. int len;
  1038. for ( len = 0; str[len]; ++len )
  1039. ;
  1040. return yy_scan_bytes( str, len );
  1041. }
  1042. %*
  1043. #endif
  1044. #ifndef YY_NO_SCAN_BYTES
  1045. %-
  1046. #ifdef YY_USE_PROTOS
  1047. YY_BUFFER_STATE yy_scan_bytes( const char *bytes, int len )
  1048. #else
  1049. YY_BUFFER_STATE yy_scan_bytes( bytes, len )
  1050. const char *bytes;
  1051. int len;
  1052. #endif
  1053. {
  1054. YY_BUFFER_STATE b;
  1055. char *buf;
  1056. yy_size_t n;
  1057. int i;
  1058. /* Get memory for full buffer, including space for trailing EOB's. */
  1059. n = len + 2;
  1060. buf = (char *) yy_flex_alloc( n );
  1061. if ( ! buf )
  1062. YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
  1063. for ( i = 0; i < len; ++i )
  1064. buf[i] = bytes[i];
  1065. buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
  1066. b = yy_scan_buffer( buf, n );
  1067. if ( ! b )
  1068. YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
  1069. /* It's okay to grow etc. this buffer, and we should throw it
  1070. * away when we're done.
  1071. */
  1072. b->yy_is_our_buffer = 1;
  1073. return b;
  1074. }
  1075. %*
  1076. #endif
  1077. #ifndef YY_NO_PUSH_STATE
  1078. %-
  1079. #ifdef YY_USE_PROTOS
  1080. static void yy_push_state( int new_state )
  1081. #else
  1082. static void yy_push_state( new_state )
  1083. int new_state;
  1084. #endif
  1085. %+
  1086. void yyFlexLexer::yy_push_state( int new_state )
  1087. %*
  1088. {
  1089. if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1090. {
  1091. yy_size_t new_size;
  1092. yy_start_stack_depth += YY_START_STACK_INCR;
  1093. new_size = yy_start_stack_depth * sizeof( int );
  1094. if ( ! yy_start_stack )
  1095. yy_start_stack = (int *) yy_flex_alloc( new_size );
  1096. else
  1097. yy_start_stack = (int *) yy_flex_realloc(
  1098. (void *) yy_start_stack, new_size );
  1099. if ( ! yy_start_stack )
  1100. YY_FATAL_ERROR(
  1101. "out of memory expanding start-condition stack" );
  1102. }
  1103. yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1104. BEGIN(new_state);
  1105. }
  1106. #endif
  1107. #ifndef YY_NO_POP_STATE
  1108. %-
  1109. static void yy_pop_state()
  1110. %+
  1111. void yyFlexLexer::yy_pop_state()
  1112. %*
  1113. {
  1114. if ( --yy_start_stack_ptr < 0 )
  1115. YY_FATAL_ERROR( "start-condition stack underflow" );
  1116. BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1117. }
  1118. #endif
  1119. #ifndef YY_NO_TOP_STATE
  1120. %-
  1121. static int yy_top_state()
  1122. %+
  1123. int yyFlexLexer::yy_top_state()
  1124. %*
  1125. {
  1126. return yy_start_stack[yy_start_stack_ptr - 1];
  1127. }
  1128. #endif
  1129. #ifndef YY_EXIT_FAILURE
  1130. #define YY_EXIT_FAILURE 2
  1131. #endif
  1132. %-
  1133. #ifdef YY_USE_PROTOS
  1134. static void yy_fatal_error( const char msg[] )
  1135. #else
  1136. static void yy_fatal_error( msg )
  1137. char msg[];
  1138. #endif
  1139. {
  1140. (void) fprintf( stderr, "%s\n", msg );
  1141. exit( YY_EXIT_FAILURE );
  1142. }
  1143. %+
  1144. void yyFlexLexer::LexerError( const char msg[] )
  1145. {
  1146. cerr << msg << '\n';
  1147. exit( YY_EXIT_FAILURE );
  1148. }
  1149. %*
  1150. /* Redefine yyless() so it works in section 3 code. */
  1151. #undef yyless
  1152. #define yyless(n) \
  1153. do \
  1154. { \
  1155. /* Undo effects of setting up yytext. */ \
  1156. yytext[yyleng] = yy_hold_char; \
  1157. yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1158. yy_hold_char = *yy_c_buf_p; \
  1159. *yy_c_buf_p = '\0'; \
  1160. yyleng = n; \
  1161. } \
  1162. while ( 0 )
  1163. /* Internal utility routines. */
  1164. #ifndef yytext_ptr
  1165. #ifdef YY_USE_PROTOS
  1166. static void yy_flex_strncpy( char *s1, const char *s2, int n )
  1167. #else
  1168. static void yy_flex_strncpy( s1, s2, n )
  1169. char *s1;
  1170. const char *s2;
  1171. int n;
  1172. #endif
  1173. {
  1174. register int i;
  1175. for ( i = 0; i < n; ++i )
  1176. s1[i] = s2[i];
  1177. }
  1178. #endif
  1179. #ifdef YY_USE_PROTOS
  1180. static void *yy_flex_alloc( yy_size_t size )
  1181. #else
  1182. static void *yy_flex_alloc( size )
  1183. yy_size_t size;
  1184. #endif
  1185. {
  1186. return (void *) malloc( size );
  1187. }
  1188. #ifdef YY_USE_PROTOS
  1189. static void *yy_flex_realloc( void *ptr, yy_size_t size )
  1190. #else
  1191. static void *yy_flex_realloc( ptr, size )
  1192. void *ptr;
  1193. yy_size_t size;
  1194. #endif
  1195. {
  1196. return (void *) realloc( ptr, size );
  1197. }
  1198. #ifdef YY_USE_PROTOS
  1199. static void yy_flex_free( void *ptr )
  1200. #else
  1201. static void yy_flex_free( ptr )
  1202. void *ptr;
  1203. #endif
  1204. {
  1205. free( ptr );
  1206. }
  1207. #ifdef YY_MAIN
  1208. int main()
  1209. {
  1210. yylex();
  1211. return 0;
  1212. }
  1213. #endif