Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1509 lines
32 KiB

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