1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
8 #if defined(__FreeBSD__)
16 #define YY_FLEX_MAJOR_VERSION 2
17 #define YY_FLEX_MINOR_VERSION 5
24 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
41 /* Use prototypes in function declarations. */
44 /* The "const" storage-class-modifier is valid. */
47 #else /* ! __cplusplus */
55 #endif /* ! __cplusplus */
74 #define YY_PROTO(proto) proto
76 #define YY_PROTO(proto) ()
79 /* Returned upon end-of-file. */
82 /* Promotes a possibly negative, possibly signed char to an unsigned
83 * integer for use as an array index. If the signed char is negative,
84 * we want to instead treat it as an 8-bit unsigned char, hence the
87 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
89 /* Enter a start condition. This macro really ought to take a parameter,
90 * but we do it the disgusting crufty way forced on us by the ()-less
91 * definition of BEGIN.
93 #define BEGIN yy_start = 1 + 2 *
95 /* Translate the current start state into a value that can be later handed
96 * to BEGIN to return to the state. The YYSTATE alias is for lex
99 #define YY_START ((yy_start - 1) / 2)
100 #define YYSTATE YY_START
102 /* Action number for EOF rule of a given start state. */
103 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
105 /* Special action meaning "start processing a new file". */
106 #define YY_NEW_FILE yyrestart( yyin )
108 #define YY_END_OF_BUFFER_CHAR 0
110 /* Size of default input buffer. */
111 #define YY_BUF_SIZE 16384
113 typedef struct yy_buffer_state *YY_BUFFER_STATE;
117 extern FILE *yyin, *yyout;
120 #define EOB_ACT_CONTINUE_SCAN 0
121 #define EOB_ACT_END_OF_FILE 1
122 #define EOB_ACT_LAST_MATCH 2
124 /* The funky do-while in the following #define is used to turn the definition
125 * int a single C statement (which needs a semi-colon terminator). This
126 * avoids problems with code like:
128 * if ( condition_holds )
131 * do_something_else();
133 * Prior to using the do-while the compiler would get upset at the
134 * "else" because it interpreted the "if" statement as being all
135 * done when it reached the ';' after the yyless() call.
138 /* Return all but the first 'n' matched characters back to the input stream. */
143 /* Undo effects of setting up yytext. */ \
144 *yy_cp = yy_hold_char; \
145 YY_RESTORE_YY_MORE_OFFSET \
146 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
147 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
151 #define unput(c) yyunput( c, yytext_ptr )
153 /* The following is because we cannot portably get our hands on size_t
154 * (without autoconf's help, which isn't available because we want
155 * flex-generated scanners to compile on their own).
157 typedef unsigned int yy_size_t;
160 struct yy_buffer_state
165 istream* yy_input_file;
168 char *yy_ch_buf; /* input buffer */
169 char *yy_buf_pos; /* current position in input buffer */
171 /* Size of input buffer in bytes, not including room for EOB
174 yy_size_t yy_buf_size;
176 /* Number of characters read into yy_ch_buf, not including EOB
181 /* Whether we "own" the buffer - i.e., we know we created it,
182 * and can realloc() it to grow it, and should free() it to
185 int yy_is_our_buffer;
187 /* Whether this is an "interactive" input source; if so, and
188 * if we're using stdio for input, then we want to use getc()
189 * instead of fread(), to make sure we stop fetching input after
192 int yy_is_interactive;
194 /* Whether we're considered to be at the beginning of a line.
195 * If so, '^' rules will be active on the next match, otherwise
200 /* Whether to try to fill the input buffer when we reach the
205 int yy_buffer_status;
206 #define YY_BUFFER_NEW 0
207 #define YY_BUFFER_NORMAL 1
208 /* When an EOF's been seen but there's still some text to process
209 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
210 * shouldn't try reading from the input source any more. We might
211 * still have a bunch of tokens to match, though, because of
212 * possible backing-up.
214 * When we actually see the EOF, we change the status to "new"
215 * (via yyrestart()), so that the user can continue scanning by
216 * just pointing yyin at a new input file.
218 #define YY_BUFFER_EOF_PENDING 2
221 %- Standard (non-C++) definition
222 static YY_BUFFER_STATE yy_current_buffer = 0;
225 /* We provide macros for accessing buffer states in case in the
226 * future we want to put the buffer states in a more general
229 #define YY_CURRENT_BUFFER yy_current_buffer
232 %- Standard (non-C++) definition
233 /* yy_hold_char holds the character lost when yytext is formed. */
234 static char yy_hold_char;
236 static int yy_n_chars; /* number of characters read into yy_ch_buf */
241 /* Points to current character in buffer. */
242 static char *yy_c_buf_p = (char *) 0;
243 static int yy_init = 1; /* whether we need to initialize */
244 static int yy_start = 0; /* start state number */
246 /* Flag which is used to allow yywrap()'s to do buffer switches
247 * instead of setting up a fresh yyin. A bit of a hack ...
249 static int yy_did_buffer_switch_on_eof;
251 void yyrestart YY_PROTO(( FILE *input_file ));
253 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
254 void yy_load_buffer_state YY_PROTO(( void ));
255 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
256 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
257 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
258 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
259 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
261 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
262 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
263 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
266 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
267 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) __unused;
268 static void yy_flex_free YY_PROTO(( void * ));
270 #define yy_new_buffer yy_create_buffer
272 #define yy_set_interactive(is_interactive) \
274 if ( ! yy_current_buffer ) \
275 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
276 yy_current_buffer->yy_is_interactive = is_interactive; \
279 #define yy_set_bol(at_bol) \
281 if ( ! yy_current_buffer ) \
282 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
283 yy_current_buffer->yy_at_bol = at_bol; \
286 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
288 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
290 %- Standard (non-C++) definition
291 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
292 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
293 static int yy_get_next_buffer YY_PROTO(( void ));
294 static void yy_fatal_error YY_PROTO(( yyconst char msg[] )) __dead2;
297 /* Done after the current pattern has been matched and before the
298 * corresponding action - sets up yytext.
300 #define YY_DO_BEFORE_ACTION \
301 yytext_ptr = yy_bp; \
302 %% code to fiddle yytext and yyleng for yymore() goes here
303 yy_hold_char = *yy_cp; \
305 %% code to copy yytext_ptr to yytext[] goes here, if %array
308 %% data tables for the DFA and the user's section 1 definitions go here
310 /* Macros after this point can all be overridden by user definitions in
314 #ifndef YY_SKIP_YYWRAP
316 extern "C" int yywrap YY_PROTO(( void ));
318 extern int yywrap YY_PROTO(( void ));
324 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
329 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
332 #ifdef YY_NEED_STRLEN
333 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
337 %- Standard (non-C++) definition
339 static int yyinput YY_PROTO(( void ));
341 static int input YY_PROTO(( void ));
347 static int yy_start_stack_ptr = 0;
348 static int yy_start_stack_depth = 0;
349 static int *yy_start_stack = 0;
350 #ifndef YY_NO_PUSH_STATE
351 static void yy_push_state YY_PROTO(( int new_state ));
353 #ifndef YY_NO_POP_STATE
354 static void yy_pop_state YY_PROTO(( void ));
356 #ifndef YY_NO_TOP_STATE
357 static int yy_top_state YY_PROTO(( void ));
361 #define YY_NO_PUSH_STATE 1
362 #define YY_NO_POP_STATE 1
363 #define YY_NO_TOP_STATE 1
366 #ifdef YY_MALLOC_DECL
374 /* Just try to get by without declaring the routines. This will fail
375 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
376 * or sizeof(void*) != sizeof(int).
381 /* Amount of stuff to slurp up with each read. */
382 #ifndef YY_READ_BUF_SIZE
383 #define YY_READ_BUF_SIZE 8192
386 /* Copy whatever the last rule matched to the standard output. */
389 %- Standard (non-C++) definition
390 /* This used to be an fputs(), but since the string might contain NUL's,
391 * we now use fwrite().
393 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
395 #define ECHO LexerOutput( yytext, yyleng )
399 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
400 * is returned in "result".
403 #define YY_INPUT(buf,result,max_size) \
404 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
406 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
407 YY_FATAL_ERROR( "input in flex scanner failed" );
411 /* No semi-colon after return; correct usage is to write "yyterminate();" -
412 * we don't want an extra ';' after the "return" because that will cause
413 * some compilers to complain about unreachable statements.
416 #define yyterminate() return YY_NULL
419 /* Number of entries by which start-condition stack grows. */
420 #ifndef YY_START_STACK_INCR
421 #define YY_START_STACK_INCR 25
424 /* Report a fatal error. */
425 #ifndef YY_FATAL_ERROR
427 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
429 #define YY_FATAL_ERROR(msg) LexerError( msg )
433 /* Default declaration of generated scanner - a define so the user can
434 * easily add parameters.
437 %- Standard (non-C++) definition
438 #define YY_DECL int yylex YY_PROTO(( void ))
440 #define YY_DECL int yyFlexLexer::yylex()
444 /* Code executed at the beginning of each rule, after yytext and yyleng
447 #ifndef YY_USER_ACTION
448 #define YY_USER_ACTION
451 /* Code executed at the end of each rule. */
453 #define YY_BREAK break;
456 %% YY_RULE_SETUP definition goes here
460 yy_state_type yy_current_state;
464 %% user's declarations go here
475 yy_start = 1; /* first start state */
491 if ( ! yy_current_buffer )
493 yy_create_buffer( yyin, YY_BUF_SIZE );
495 yy_load_buffer_state();
498 while ( 1 ) /* loops until end-of-file is reached */
500 %% yymore()-related code goes here
503 /* Support of yytext. */
504 *yy_cp = yy_hold_char;
506 /* yy_bp points to the position in yy_ch_buf of the start of
511 %% code to set up and find next match goes here
514 %% code to find the action number goes here
518 %% code for yylineno update goes here
520 do_action: /* This label is used only to access EOF actions. */
522 %% debug code goes here
525 { /* beginning of action switch */
528 case YY_END_OF_BUFFER:
530 /* Amount of text matched not including the EOB char. */
531 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
533 /* Undo the effects of YY_DO_BEFORE_ACTION. */
534 *yy_cp = yy_hold_char;
535 YY_RESTORE_YY_MORE_OFFSET
537 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
539 /* We're scanning a new file or input source. It's
540 * possible that this happened because the user
541 * just pointed yyin at a new source and called
542 * yylex(). If so, then we have to assure
543 * consistency between yy_current_buffer and our
544 * globals. Here is the right place to do so, because
545 * this is the first action (other than possibly a
546 * back-up) that will match for the new input source.
548 yy_n_chars = yy_current_buffer->yy_n_chars;
549 yy_current_buffer->yy_input_file = yyin;
550 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
553 /* Note that here we test for yy_c_buf_p "<=" to the position
554 * of the first EOB in the buffer, since yy_c_buf_p will
555 * already have been incremented past the NUL character
556 * (since all states make transitions on EOB to the
557 * end-of-buffer state). Contrast this with the test
560 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
561 { /* This was really a NUL. */
562 yy_state_type yy_next_state;
564 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
566 yy_current_state = yy_get_previous_state();
568 /* Okay, we're now positioned to make the NUL
569 * transition. We couldn't have
570 * yy_get_previous_state() go ahead and do it
571 * for us because it doesn't know how to deal
572 * with the possibility of jamming (and we don't
573 * want to build jamming into it because then it
574 * will run more slowly).
577 yy_next_state = yy_try_NUL_trans( yy_current_state );
579 yy_bp = yytext_ptr + YY_MORE_ADJ;
583 /* Consume the NUL. */
584 yy_cp = ++yy_c_buf_p;
585 yy_current_state = yy_next_state;
591 %% code to do back-up for compressed tables and set up yy_cp goes here
596 else switch ( yy_get_next_buffer() )
598 case EOB_ACT_END_OF_FILE:
600 yy_did_buffer_switch_on_eof = 0;
604 /* Note: because we've taken care in
605 * yy_get_next_buffer() to have set up
606 * yytext, we can now set up
607 * yy_c_buf_p so that if some total
608 * hoser (like flex itself) wants to
609 * call the scanner after we return the
610 * YY_NULL, it'll still work - another
611 * YY_NULL will get returned.
613 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
615 yy_act = YY_STATE_EOF(YY_START);
621 if ( ! yy_did_buffer_switch_on_eof )
627 case EOB_ACT_CONTINUE_SCAN:
629 yytext_ptr + yy_amount_of_matched_text;
631 yy_current_state = yy_get_previous_state();
634 yy_bp = yytext_ptr + YY_MORE_ADJ;
637 case EOB_ACT_LAST_MATCH:
639 &yy_current_buffer->yy_ch_buf[yy_n_chars];
641 yy_current_state = yy_get_previous_state();
644 yy_bp = yytext_ptr + YY_MORE_ADJ;
652 "fatal flex scanner internal error--no action found" );
653 } /* end of action switch */
654 } /* end of scanning one token */
658 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
666 yylineno = 1; // this will only get updated if %option yylineno
668 yy_did_buffer_switch_on_eof = 0;
670 yy_looking_for_trail_begin = 0;
673 yy_more_offset = yy_prev_more_offset = 0;
675 yy_start_stack_ptr = yy_start_stack_depth = 0;
678 yy_current_buffer = 0;
680 #ifdef YY_USES_REJECT
681 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
687 yyFlexLexer::~yyFlexLexer()
690 yy_delete_buffer( yy_current_buffer );
693 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
697 yy_delete_buffer( yy_current_buffer );
698 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
705 #ifdef YY_INTERACTIVE
706 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
708 int yyFlexLexer::LexerInput( char* buf, int max_size )
711 if ( yyin->eof() || yyin->fail() )
714 #ifdef YY_INTERACTIVE
726 (void) yyin->read( buf, max_size );
731 return yyin->gcount();
735 void yyFlexLexer::LexerOutput( const char* buf, int size )
737 (void) yyout->write( buf, size );
741 /* yy_get_next_buffer - try to read in a new buffer
743 * Returns a code representing an action:
744 * EOB_ACT_LAST_MATCH -
745 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
746 * EOB_ACT_END_OF_FILE - end of file
751 static int yy_get_next_buffer(void)
753 static int yy_get_next_buffer()
756 int yyFlexLexer::yy_get_next_buffer()
759 char *dest = yy_current_buffer->yy_ch_buf;
760 char *source = yytext_ptr;
761 int number_to_move, i;
764 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
766 "fatal flex scanner internal error--end of buffer missed" );
768 if ( yy_current_buffer->yy_fill_buffer == 0 )
769 { /* Don't try to fill the buffer, so this is an EOF. */
770 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
772 /* We matched a single character, the EOB, so
773 * treat this as a final EOF.
775 return EOB_ACT_END_OF_FILE;
780 /* We matched some text prior to the EOB, first
783 return EOB_ACT_LAST_MATCH;
787 /* Try to read more data. */
789 /* First move last chars to start of buffer. */
790 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
792 for ( i = 0; i < number_to_move; ++i )
793 *(dest++) = *(source++);
795 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
796 /* don't do the read, it's not guaranteed to return an EOF,
799 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
804 yy_current_buffer->yy_buf_size - number_to_move - 1;
806 while ( num_to_read <= 0 )
807 { /* Not enough room in the buffer - grow it. */
808 #ifdef YY_USES_REJECT
810 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
813 /* just a shorter name for the current buffer */
814 YY_BUFFER_STATE b = yy_current_buffer;
816 int yy_c_buf_p_offset =
817 (int) (yy_c_buf_p - b->yy_ch_buf);
819 if ( b->yy_is_our_buffer )
821 int new_size = b->yy_buf_size * 2;
824 b->yy_buf_size += b->yy_buf_size / 8;
828 b->yy_ch_buf = (char *)
829 /* Include room in for 2 EOB chars. */
830 yy_flex_realloc( (void *) b->yy_ch_buf,
831 b->yy_buf_size + 2 );
834 /* Can't grow it, we don't own it. */
837 if ( ! b->yy_ch_buf )
839 "fatal error - scanner input buffer overflow" );
841 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
843 num_to_read = yy_current_buffer->yy_buf_size -
848 if ( num_to_read > YY_READ_BUF_SIZE )
849 num_to_read = YY_READ_BUF_SIZE;
851 /* Read in more data. */
852 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
853 yy_n_chars, num_to_read );
855 yy_current_buffer->yy_n_chars = yy_n_chars;
858 if ( yy_n_chars == 0 )
860 if ( number_to_move == YY_MORE_ADJ )
862 ret_val = EOB_ACT_END_OF_FILE;
868 ret_val = EOB_ACT_LAST_MATCH;
869 yy_current_buffer->yy_buffer_status =
870 YY_BUFFER_EOF_PENDING;
875 ret_val = EOB_ACT_CONTINUE_SCAN;
877 yy_n_chars += number_to_move;
878 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
879 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
881 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
887 /* yy_get_previous_state - get the state just before the EOB char was reached */
891 static yy_state_type yy_get_previous_state(void)
893 static yy_state_type yy_get_previous_state()
896 yy_state_type yyFlexLexer::yy_get_previous_state()
899 yy_state_type yy_current_state;
902 %% code to get the start state into yy_current_state goes here
904 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
906 %% code to find the next state goes here
909 return yy_current_state;
913 /* yy_try_NUL_trans - try to make a transition on the NUL character
916 * next_state = yy_try_NUL_trans( current_state );
921 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
923 static yy_state_type yy_try_NUL_trans( yy_current_state )
924 yy_state_type yy_current_state;
927 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
931 %% code to find the next state, and perhaps do backing up, goes here
933 return yy_is_jam ? 0 : yy_current_state;
940 static void yyunput( int c, char *yy_bp )
942 static void yyunput( c, yy_bp )
947 void yyFlexLexer::yyunput( int c, char* yy_bp )
950 char *yy_cp = yy_c_buf_p;
952 /* undo effects of setting up yytext */
953 *yy_cp = yy_hold_char;
955 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
956 { /* need to shift things up to make room */
957 /* +2 for EOB chars. */
958 int number_to_move = yy_n_chars + 2;
959 char *dest = &yy_current_buffer->yy_ch_buf[
960 yy_current_buffer->yy_buf_size + 2];
962 &yy_current_buffer->yy_ch_buf[number_to_move];
964 while ( source > yy_current_buffer->yy_ch_buf )
967 yy_cp += (int) (dest - source);
968 yy_bp += (int) (dest - source);
969 yy_current_buffer->yy_n_chars =
970 yy_n_chars = yy_current_buffer->yy_buf_size;
972 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
973 YY_FATAL_ERROR( "flex scanner push-back overflow" );
978 %% update yylineno here
981 yy_hold_char = *yy_cp;
985 #endif /* ifndef YY_NO_UNPUT */
995 static int input(void)
1001 int yyFlexLexer::yyinput()
1006 *yy_c_buf_p = yy_hold_char;
1008 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1010 /* yy_c_buf_p now points to the character we want to return.
1011 * If this occurs *before* the EOB characters, then it's a
1012 * valid NUL; if not, then we've hit the end of the buffer.
1014 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1015 /* This was really a NUL. */
1019 { /* need more input */
1020 int offset = yy_c_buf_p - yytext_ptr;
1023 switch ( yy_get_next_buffer() )
1025 case EOB_ACT_LAST_MATCH:
1026 /* This happens because yy_g_n_b()
1027 * sees that we've accumulated a
1028 * token and flags that we need to
1029 * try matching the token before
1030 * proceeding. But for input(),
1031 * there's no matching to consider.
1032 * So convert the EOB_ACT_LAST_MATCH
1033 * to EOB_ACT_END_OF_FILE.
1036 /* Reset buffer status. */
1041 case EOB_ACT_END_OF_FILE:
1046 if ( ! yy_did_buffer_switch_on_eof )
1055 case EOB_ACT_CONTINUE_SCAN:
1056 yy_c_buf_p = yytext_ptr + offset;
1062 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1063 *yy_c_buf_p = '\0'; /* preserve yytext */
1064 yy_hold_char = *++yy_c_buf_p;
1066 %% update BOL and yylineno
1071 #endif /* ifndef YY_NO_INPUT */
1076 #ifdef YY_USE_PROTOS
1077 void yyrestart( FILE *input_file )
1079 void yyrestart( input_file )
1083 void yyFlexLexer::yyrestart( istream* input_file )
1086 if ( ! yy_current_buffer )
1087 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1089 yy_init_buffer( yy_current_buffer, input_file );
1090 yy_load_buffer_state();
1095 #ifdef YY_USE_PROTOS
1096 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1098 void yy_switch_to_buffer( new_buffer )
1099 YY_BUFFER_STATE new_buffer;
1102 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1105 if ( yy_current_buffer == new_buffer )
1108 if ( yy_current_buffer )
1110 /* Flush out information for old buffer. */
1111 *yy_c_buf_p = yy_hold_char;
1112 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1113 yy_current_buffer->yy_n_chars = yy_n_chars;
1116 yy_current_buffer = new_buffer;
1117 yy_load_buffer_state();
1119 /* We don't actually know whether we did this switch during
1120 * EOF (yywrap()) processing, but the only time this flag
1121 * is looked at is after yywrap() is called, so it's safe
1122 * to go ahead and always set it.
1124 yy_did_buffer_switch_on_eof = 1;
1129 #ifdef YY_USE_PROTOS
1130 void yy_load_buffer_state( void )
1132 void yy_load_buffer_state()
1135 void yyFlexLexer::yy_load_buffer_state()
1138 yy_n_chars = yy_current_buffer->yy_n_chars;
1139 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1140 yyin = yy_current_buffer->yy_input_file;
1141 yy_hold_char = *yy_c_buf_p;
1146 #ifdef YY_USE_PROTOS
1147 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1149 YY_BUFFER_STATE yy_create_buffer( file, size )
1154 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1159 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1161 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1163 b->yy_buf_size = size;
1165 /* yy_ch_buf has to be 2 characters longer than the size given because
1166 * we need to put in 2 end-of-buffer characters.
1168 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1169 if ( ! b->yy_ch_buf )
1170 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1172 b->yy_is_our_buffer = 1;
1174 yy_init_buffer( b, file );
1181 #ifdef YY_USE_PROTOS
1182 void yy_delete_buffer( YY_BUFFER_STATE b )
1184 void yy_delete_buffer( b )
1188 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1194 if ( b == yy_current_buffer )
1195 yy_current_buffer = (YY_BUFFER_STATE) 0;
1197 if ( b->yy_is_our_buffer )
1198 yy_flex_free( (void *) b->yy_ch_buf );
1200 yy_flex_free( (void *) b );
1205 #ifndef YY_ALWAYS_INTERACTIVE
1206 #ifndef YY_NEVER_INTERACTIVE
1207 extern int isatty YY_PROTO(( int ));
1211 #ifdef YY_USE_PROTOS
1212 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1214 void yy_init_buffer( b, file )
1220 extern "C" int isatty YY_PROTO(( int ));
1221 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1225 yy_flush_buffer( b );
1227 b->yy_input_file = file;
1228 b->yy_fill_buffer = 1;
1231 #if YY_ALWAYS_INTERACTIVE
1232 b->yy_is_interactive = 1;
1234 #if YY_NEVER_INTERACTIVE
1235 b->yy_is_interactive = 0;
1237 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1241 b->yy_is_interactive = 0;
1247 #ifdef YY_USE_PROTOS
1248 void yy_flush_buffer( YY_BUFFER_STATE b )
1250 void yy_flush_buffer( b )
1255 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1263 /* We always need two end-of-buffer characters. The first causes
1264 * a transition to the end-of-buffer state. The second causes
1265 * a jam in that state.
1267 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1268 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1270 b->yy_buf_pos = &b->yy_ch_buf[0];
1273 b->yy_buffer_status = YY_BUFFER_NEW;
1275 if ( b == yy_current_buffer )
1276 yy_load_buffer_state();
1281 #ifndef YY_NO_SCAN_BUFFER
1283 #ifdef YY_USE_PROTOS
1284 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1286 YY_BUFFER_STATE yy_scan_buffer( base, size )
1294 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1295 base[size-1] != YY_END_OF_BUFFER_CHAR )
1296 /* They forgot to leave room for the EOB's. */
1299 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1301 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1303 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1304 b->yy_buf_pos = b->yy_ch_buf = base;
1305 b->yy_is_our_buffer = 0;
1306 b->yy_input_file = 0;
1307 b->yy_n_chars = b->yy_buf_size;
1308 b->yy_is_interactive = 0;
1310 b->yy_fill_buffer = 0;
1311 b->yy_buffer_status = YY_BUFFER_NEW;
1313 yy_switch_to_buffer( b );
1321 #ifndef YY_NO_SCAN_STRING
1323 #ifdef YY_USE_PROTOS
1324 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1326 YY_BUFFER_STATE yy_scan_string( yy_str )
1327 yyconst char *yy_str;
1331 for ( len = 0; yy_str[len]; ++len )
1334 return yy_scan_bytes( yy_str, len );
1340 #ifndef YY_NO_SCAN_BYTES
1342 #ifdef YY_USE_PROTOS
1343 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1345 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1346 yyconst char *bytes;
1355 /* Get memory for full buffer, including space for trailing EOB's. */
1357 buf = (char *) yy_flex_alloc( n );
1359 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1361 for ( i = 0; i < len; ++i )
1364 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1366 b = yy_scan_buffer( buf, n );
1368 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1370 /* It's okay to grow etc. this buffer, and we should throw it
1371 * away when we're done.
1373 b->yy_is_our_buffer = 1;
1381 #ifndef YY_NO_PUSH_STATE
1383 #ifdef YY_USE_PROTOS
1384 static void yy_push_state( int new_state )
1386 static void yy_push_state( new_state )
1390 void yyFlexLexer::yy_push_state( int new_state )
1393 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1397 yy_start_stack_depth += YY_START_STACK_INCR;
1398 new_size = yy_start_stack_depth * sizeof( int );
1400 if ( ! yy_start_stack )
1401 yy_start_stack = (int *) yy_flex_alloc( new_size );
1404 yy_start_stack = (int *) yy_flex_realloc(
1405 (void *) yy_start_stack, new_size );
1407 if ( ! yy_start_stack )
1409 "out of memory expanding start-condition stack" );
1412 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1419 #ifndef YY_NO_POP_STATE
1421 #ifdef YY_USE_PROTOS
1422 static void yy_pop_state(void)
1424 static void yy_pop_state()
1427 void yyFlexLexer::yy_pop_state()
1430 if ( --yy_start_stack_ptr < 0 )
1431 YY_FATAL_ERROR( "start-condition stack underflow" );
1433 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1438 #ifndef YY_NO_TOP_STATE
1440 #ifdef YY_USE_PROTOS
1441 static int yy_top_state(void)
1443 static int yy_top_state()
1446 int yyFlexLexer::yy_top_state()
1449 return yy_start_stack[yy_start_stack_ptr - 1];
1453 #ifndef YY_EXIT_FAILURE
1454 #define YY_EXIT_FAILURE 2
1458 #ifdef YY_USE_PROTOS
1459 static void yy_fatal_error( yyconst char msg[] )
1461 static void yy_fatal_error( msg )
1465 (void) fprintf( stderr, "%s\n", msg );
1466 exit( YY_EXIT_FAILURE );
1471 void yyFlexLexer::LexerError( yyconst char msg[] )
1473 cerr << msg << '\n';
1474 exit( YY_EXIT_FAILURE );
1479 /* Redefine yyless() so it works in section 3 code. */
1485 /* Undo effects of setting up yytext. */ \
1486 yytext[yyleng] = yy_hold_char; \
1487 yy_c_buf_p = yytext + n; \
1488 yy_hold_char = *yy_c_buf_p; \
1489 *yy_c_buf_p = '\0'; \
1495 /* Internal utility routines. */
1498 #ifdef YY_USE_PROTOS
1499 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1501 static void yy_flex_strncpy( s1, s2, n )
1508 for ( i = 0; i < n; ++i )
1513 #ifdef YY_NEED_STRLEN
1514 #ifdef YY_USE_PROTOS
1515 static int yy_flex_strlen( yyconst char *s )
1517 static int yy_flex_strlen( s )
1522 for ( n = 0; s[n]; ++n )
1530 #ifdef YY_USE_PROTOS
1531 static void *yy_flex_alloc( yy_size_t size )
1533 static void *yy_flex_alloc( size )
1537 return (void *) malloc( size );
1540 #ifdef YY_USE_PROTOS
1541 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1543 static void *yy_flex_realloc( ptr, size )
1548 /* The cast to (char *) in the following accommodates both
1549 * implementations that use char* generic pointers, and those
1550 * that use void* generic pointers. It works with the latter
1551 * because both ANSI C and C++ allow castless assignment from
1552 * any pointer type to void*, and deal with argument conversions
1553 * as though doing an assignment.
1555 return (void *) realloc( (char *) ptr, size );
1558 #ifdef YY_USE_PROTOS
1559 static void yy_flex_free( void *ptr )
1561 static void yy_flex_free( ptr )