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__)
15 #define YY_FLEX_MAJOR_VERSION 2
16 #define YY_FLEX_MINOR_VERSION 5
23 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
40 /* Use prototypes in function declarations. */
43 /* The "const" storage-class-modifier is valid. */
46 #else /* ! __cplusplus */
54 #endif /* ! __cplusplus */
73 #define YY_PROTO(proto) proto
75 #define YY_PROTO(proto) ()
78 /* Returned upon end-of-file. */
81 /* Promotes a possibly negative, possibly signed char to an unsigned
82 * integer for use as an array index. If the signed char is negative,
83 * we want to instead treat it as an 8-bit unsigned char, hence the
86 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
88 /* Enter a start condition. This macro really ought to take a parameter,
89 * but we do it the disgusting crufty way forced on us by the ()-less
90 * definition of BEGIN.
92 #define BEGIN yy_start = 1 + 2 *
94 /* Translate the current start state into a value that can be later handed
95 * to BEGIN to return to the state. The YYSTATE alias is for lex
98 #define YY_START ((yy_start - 1) / 2)
99 #define YYSTATE YY_START
101 /* Action number for EOF rule of a given start state. */
102 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
104 /* Special action meaning "start processing a new file". */
105 #define YY_NEW_FILE yyrestart( yyin )
107 #define YY_END_OF_BUFFER_CHAR 0
109 /* Size of default input buffer. */
110 #define YY_BUF_SIZE 16384
112 typedef struct yy_buffer_state *YY_BUFFER_STATE;
116 extern FILE *yyin, *yyout;
119 #define EOB_ACT_CONTINUE_SCAN 0
120 #define EOB_ACT_END_OF_FILE 1
121 #define EOB_ACT_LAST_MATCH 2
123 /* The funky do-while in the following #define is used to turn the definition
124 * int a single C statement (which needs a semi-colon terminator). This
125 * avoids problems with code like:
127 * if ( condition_holds )
130 * do_something_else();
132 * Prior to using the do-while the compiler would get upset at the
133 * "else" because it interpreted the "if" statement as being all
134 * done when it reached the ';' after the yyless() call.
137 /* Return all but the first 'n' matched characters back to the input stream. */
142 /* Undo effects of setting up yytext. */ \
143 *yy_cp = yy_hold_char; \
144 YY_RESTORE_YY_MORE_OFFSET \
145 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
146 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
150 #define unput(c) yyunput( c, yytext_ptr )
152 /* The following is because we cannot portably get our hands on size_t
153 * (without autoconf's help, which isn't available because we want
154 * flex-generated scanners to compile on their own).
156 typedef unsigned int yy_size_t;
159 struct yy_buffer_state
164 istream* yy_input_file;
167 char *yy_ch_buf; /* input buffer */
168 char *yy_buf_pos; /* current position in input buffer */
170 /* Size of input buffer in bytes, not including room for EOB
173 yy_size_t yy_buf_size;
175 /* Number of characters read into yy_ch_buf, not including EOB
180 /* Whether we "own" the buffer - i.e., we know we created it,
181 * and can realloc() it to grow it, and should free() it to
184 int yy_is_our_buffer;
186 /* Whether this is an "interactive" input source; if so, and
187 * if we're using stdio for input, then we want to use getc()
188 * instead of fread(), to make sure we stop fetching input after
191 int yy_is_interactive;
193 /* Whether we're considered to be at the beginning of a line.
194 * If so, '^' rules will be active on the next match, otherwise
199 /* Whether to try to fill the input buffer when we reach the
204 int yy_buffer_status;
205 #define YY_BUFFER_NEW 0
206 #define YY_BUFFER_NORMAL 1
207 /* When an EOF's been seen but there's still some text to process
208 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
209 * shouldn't try reading from the input source any more. We might
210 * still have a bunch of tokens to match, though, because of
211 * possible backing-up.
213 * When we actually see the EOF, we change the status to "new"
214 * (via yyrestart()), so that the user can continue scanning by
215 * just pointing yyin at a new input file.
217 #define YY_BUFFER_EOF_PENDING 2
220 %- Standard (non-C++) definition
221 static YY_BUFFER_STATE yy_current_buffer = 0;
224 /* We provide macros for accessing buffer states in case in the
225 * future we want to put the buffer states in a more general
228 #define YY_CURRENT_BUFFER yy_current_buffer
231 %- Standard (non-C++) definition
232 /* yy_hold_char holds the character lost when yytext is formed. */
233 static char yy_hold_char;
235 static int yy_n_chars; /* number of characters read into yy_ch_buf */
240 /* Points to current character in buffer. */
241 static char *yy_c_buf_p = (char *) 0;
242 static int yy_init = 1; /* whether we need to initialize */
243 static int yy_start = 0; /* start state number */
245 /* Flag which is used to allow yywrap()'s to do buffer switches
246 * instead of setting up a fresh yyin. A bit of a hack ...
248 static int yy_did_buffer_switch_on_eof;
250 void yyrestart YY_PROTO(( FILE *input_file ));
252 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
253 void yy_load_buffer_state YY_PROTO(( void ));
254 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
255 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
256 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
257 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
258 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
260 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
261 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
262 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
265 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
266 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) __unused;
267 static void yy_flex_free YY_PROTO(( void * ));
269 #define yy_new_buffer yy_create_buffer
271 #define yy_set_interactive(is_interactive) \
273 if ( ! yy_current_buffer ) \
274 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
275 yy_current_buffer->yy_is_interactive = is_interactive; \
278 #define yy_set_bol(at_bol) \
280 if ( ! yy_current_buffer ) \
281 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
282 yy_current_buffer->yy_at_bol = at_bol; \
285 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
287 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
289 %- Standard (non-C++) definition
290 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
291 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
292 static int yy_get_next_buffer YY_PROTO(( void ));
293 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
296 /* Done after the current pattern has been matched and before the
297 * corresponding action - sets up yytext.
299 #define YY_DO_BEFORE_ACTION \
300 yytext_ptr = yy_bp; \
301 %% code to fiddle yytext and yyleng for yymore() goes here
302 yy_hold_char = *yy_cp; \
304 %% code to copy yytext_ptr to yytext[] goes here, if %array
307 %% data tables for the DFA and the user's section 1 definitions go here
309 /* Macros after this point can all be overridden by user definitions in
313 #ifndef YY_SKIP_YYWRAP
315 extern "C" int yywrap YY_PROTO(( void ));
317 extern int yywrap YY_PROTO(( void ));
323 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
328 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
331 #ifdef YY_NEED_STRLEN
332 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
336 %- Standard (non-C++) definition
338 static int yyinput YY_PROTO(( void ));
340 static int input YY_PROTO(( void ));
346 static int yy_start_stack_ptr = 0;
347 static int yy_start_stack_depth = 0;
348 static int *yy_start_stack = 0;
349 #ifndef YY_NO_PUSH_STATE
350 static void yy_push_state YY_PROTO(( int new_state ));
352 #ifndef YY_NO_POP_STATE
353 static void yy_pop_state YY_PROTO(( void ));
355 #ifndef YY_NO_TOP_STATE
356 static int yy_top_state YY_PROTO(( void ));
360 #define YY_NO_PUSH_STATE 1
361 #define YY_NO_POP_STATE 1
362 #define YY_NO_TOP_STATE 1
365 #ifdef YY_MALLOC_DECL
373 /* Just try to get by without declaring the routines. This will fail
374 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
375 * or sizeof(void*) != sizeof(int).
380 /* Amount of stuff to slurp up with each read. */
381 #ifndef YY_READ_BUF_SIZE
382 #define YY_READ_BUF_SIZE 8192
385 /* Copy whatever the last rule matched to the standard output. */
388 %- Standard (non-C++) definition
389 /* This used to be an fputs(), but since the string might contain NUL's,
390 * we now use fwrite().
392 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
394 #define ECHO LexerOutput( yytext, yyleng )
398 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
399 * is returned in "result".
402 #define YY_INPUT(buf,result,max_size) \
403 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
405 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
406 YY_FATAL_ERROR( "input in flex scanner failed" );
410 /* No semi-colon after return; correct usage is to write "yyterminate();" -
411 * we don't want an extra ';' after the "return" because that will cause
412 * some compilers to complain about unreachable statements.
415 #define yyterminate() return YY_NULL
418 /* Number of entries by which start-condition stack grows. */
419 #ifndef YY_START_STACK_INCR
420 #define YY_START_STACK_INCR 25
423 /* Report a fatal error. */
424 #ifndef YY_FATAL_ERROR
426 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
428 #define YY_FATAL_ERROR(msg) LexerError( msg )
432 /* Default declaration of generated scanner - a define so the user can
433 * easily add parameters.
436 %- Standard (non-C++) definition
437 #define YY_DECL int yylex YY_PROTO(( void ))
439 #define YY_DECL int yyFlexLexer::yylex()
443 /* Code executed at the beginning of each rule, after yytext and yyleng
446 #ifndef YY_USER_ACTION
447 #define YY_USER_ACTION
450 /* Code executed at the end of each rule. */
452 #define YY_BREAK break;
455 %% YY_RULE_SETUP definition goes here
459 register yy_state_type yy_current_state;
460 register char *yy_cp, *yy_bp;
463 %% user's declarations go here
474 yy_start = 1; /* first start state */
490 if ( ! yy_current_buffer )
492 yy_create_buffer( yyin, YY_BUF_SIZE );
494 yy_load_buffer_state();
497 while ( 1 ) /* loops until end-of-file is reached */
499 %% yymore()-related code goes here
502 /* Support of yytext. */
503 *yy_cp = yy_hold_char;
505 /* yy_bp points to the position in yy_ch_buf of the start of
510 %% code to set up and find next match goes here
513 %% code to find the action number goes here
517 %% code for yylineno update goes here
519 do_action: /* This label is used only to access EOF actions. */
521 %% debug code goes here
524 { /* beginning of action switch */
527 case YY_END_OF_BUFFER:
529 /* Amount of text matched not including the EOB char. */
530 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
532 /* Undo the effects of YY_DO_BEFORE_ACTION. */
533 *yy_cp = yy_hold_char;
534 YY_RESTORE_YY_MORE_OFFSET
536 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
538 /* We're scanning a new file or input source. It's
539 * possible that this happened because the user
540 * just pointed yyin at a new source and called
541 * yylex(). If so, then we have to assure
542 * consistency between yy_current_buffer and our
543 * globals. Here is the right place to do so, because
544 * this is the first action (other than possibly a
545 * back-up) that will match for the new input source.
547 yy_n_chars = yy_current_buffer->yy_n_chars;
548 yy_current_buffer->yy_input_file = yyin;
549 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
552 /* Note that here we test for yy_c_buf_p "<=" to the position
553 * of the first EOB in the buffer, since yy_c_buf_p will
554 * already have been incremented past the NUL character
555 * (since all states make transitions on EOB to the
556 * end-of-buffer state). Contrast this with the test
559 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
560 { /* This was really a NUL. */
561 yy_state_type yy_next_state;
563 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
565 yy_current_state = yy_get_previous_state();
567 /* Okay, we're now positioned to make the NUL
568 * transition. We couldn't have
569 * yy_get_previous_state() go ahead and do it
570 * for us because it doesn't know how to deal
571 * with the possibility of jamming (and we don't
572 * want to build jamming into it because then it
573 * will run more slowly).
576 yy_next_state = yy_try_NUL_trans( yy_current_state );
578 yy_bp = yytext_ptr + YY_MORE_ADJ;
582 /* Consume the NUL. */
583 yy_cp = ++yy_c_buf_p;
584 yy_current_state = yy_next_state;
590 %% code to do back-up for compressed tables and set up yy_cp goes here
595 else switch ( yy_get_next_buffer() )
597 case EOB_ACT_END_OF_FILE:
599 yy_did_buffer_switch_on_eof = 0;
603 /* Note: because we've taken care in
604 * yy_get_next_buffer() to have set up
605 * yytext, we can now set up
606 * yy_c_buf_p so that if some total
607 * hoser (like flex itself) wants to
608 * call the scanner after we return the
609 * YY_NULL, it'll still work - another
610 * YY_NULL will get returned.
612 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
614 yy_act = YY_STATE_EOF(YY_START);
620 if ( ! yy_did_buffer_switch_on_eof )
626 case EOB_ACT_CONTINUE_SCAN:
628 yytext_ptr + yy_amount_of_matched_text;
630 yy_current_state = yy_get_previous_state();
633 yy_bp = yytext_ptr + YY_MORE_ADJ;
636 case EOB_ACT_LAST_MATCH:
638 &yy_current_buffer->yy_ch_buf[yy_n_chars];
640 yy_current_state = yy_get_previous_state();
643 yy_bp = yytext_ptr + YY_MORE_ADJ;
651 "fatal flex scanner internal error--no action found" );
652 } /* end of action switch */
653 } /* end of scanning one token */
657 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
665 yylineno = 1; // this will only get updated if %option yylineno
667 yy_did_buffer_switch_on_eof = 0;
669 yy_looking_for_trail_begin = 0;
672 yy_more_offset = yy_prev_more_offset = 0;
674 yy_start_stack_ptr = yy_start_stack_depth = 0;
677 yy_current_buffer = 0;
679 #ifdef YY_USES_REJECT
680 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
686 yyFlexLexer::~yyFlexLexer()
689 yy_delete_buffer( yy_current_buffer );
692 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
696 yy_delete_buffer( yy_current_buffer );
697 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
704 #ifdef YY_INTERACTIVE
705 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
707 int yyFlexLexer::LexerInput( char* buf, int max_size )
710 if ( yyin->eof() || yyin->fail() )
713 #ifdef YY_INTERACTIVE
725 (void) yyin->read( buf, max_size );
730 return yyin->gcount();
734 void yyFlexLexer::LexerOutput( const char* buf, int size )
736 (void) yyout->write( buf, size );
740 /* yy_get_next_buffer - try to read in a new buffer
742 * Returns a code representing an action:
743 * EOB_ACT_LAST_MATCH -
744 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
745 * EOB_ACT_END_OF_FILE - end of file
749 static int yy_get_next_buffer()
751 int yyFlexLexer::yy_get_next_buffer()
754 register char *dest = yy_current_buffer->yy_ch_buf;
755 register char *source = yytext_ptr;
756 register int number_to_move, i;
759 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
761 "fatal flex scanner internal error--end of buffer missed" );
763 if ( yy_current_buffer->yy_fill_buffer == 0 )
764 { /* Don't try to fill the buffer, so this is an EOF. */
765 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
767 /* We matched a single character, the EOB, so
768 * treat this as a final EOF.
770 return EOB_ACT_END_OF_FILE;
775 /* We matched some text prior to the EOB, first
778 return EOB_ACT_LAST_MATCH;
782 /* Try to read more data. */
784 /* First move last chars to start of buffer. */
785 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
787 for ( i = 0; i < number_to_move; ++i )
788 *(dest++) = *(source++);
790 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
791 /* don't do the read, it's not guaranteed to return an EOF,
794 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
799 yy_current_buffer->yy_buf_size - number_to_move - 1;
801 while ( num_to_read <= 0 )
802 { /* Not enough room in the buffer - grow it. */
803 #ifdef YY_USES_REJECT
805 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
808 /* just a shorter name for the current buffer */
809 YY_BUFFER_STATE b = yy_current_buffer;
811 int yy_c_buf_p_offset =
812 (int) (yy_c_buf_p - b->yy_ch_buf);
814 if ( b->yy_is_our_buffer )
816 int new_size = b->yy_buf_size * 2;
819 b->yy_buf_size += b->yy_buf_size / 8;
823 b->yy_ch_buf = (char *)
824 /* Include room in for 2 EOB chars. */
825 yy_flex_realloc( (void *) b->yy_ch_buf,
826 b->yy_buf_size + 2 );
829 /* Can't grow it, we don't own it. */
832 if ( ! b->yy_ch_buf )
834 "fatal error - scanner input buffer overflow" );
836 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
838 num_to_read = yy_current_buffer->yy_buf_size -
843 if ( num_to_read > YY_READ_BUF_SIZE )
844 num_to_read = YY_READ_BUF_SIZE;
846 /* Read in more data. */
847 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
848 yy_n_chars, num_to_read );
850 yy_current_buffer->yy_n_chars = yy_n_chars;
853 if ( yy_n_chars == 0 )
855 if ( number_to_move == YY_MORE_ADJ )
857 ret_val = EOB_ACT_END_OF_FILE;
863 ret_val = EOB_ACT_LAST_MATCH;
864 yy_current_buffer->yy_buffer_status =
865 YY_BUFFER_EOF_PENDING;
870 ret_val = EOB_ACT_CONTINUE_SCAN;
872 yy_n_chars += number_to_move;
873 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
874 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
876 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
882 /* yy_get_previous_state - get the state just before the EOB char was reached */
885 static yy_state_type yy_get_previous_state()
887 yy_state_type yyFlexLexer::yy_get_previous_state()
890 register yy_state_type yy_current_state;
891 register char *yy_cp;
893 %% code to get the start state into yy_current_state goes here
895 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
897 %% code to find the next state goes here
900 return yy_current_state;
904 /* yy_try_NUL_trans - try to make a transition on the NUL character
907 * next_state = yy_try_NUL_trans( current_state );
912 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
914 static yy_state_type yy_try_NUL_trans( yy_current_state )
915 yy_state_type yy_current_state;
918 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
921 register int yy_is_jam;
922 %% code to find the next state, and perhaps do backing up, goes here
924 return yy_is_jam ? 0 : yy_current_state;
931 static void yyunput( int c, register char *yy_bp )
933 static void yyunput( c, yy_bp )
935 register char *yy_bp;
938 void yyFlexLexer::yyunput( int c, register char* yy_bp )
941 register char *yy_cp = yy_c_buf_p;
943 /* undo effects of setting up yytext */
944 *yy_cp = yy_hold_char;
946 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
947 { /* need to shift things up to make room */
948 /* +2 for EOB chars. */
949 register int number_to_move = yy_n_chars + 2;
950 register char *dest = &yy_current_buffer->yy_ch_buf[
951 yy_current_buffer->yy_buf_size + 2];
952 register char *source =
953 &yy_current_buffer->yy_ch_buf[number_to_move];
955 while ( source > yy_current_buffer->yy_ch_buf )
958 yy_cp += (int) (dest - source);
959 yy_bp += (int) (dest - source);
960 yy_current_buffer->yy_n_chars =
961 yy_n_chars = yy_current_buffer->yy_buf_size;
963 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
964 YY_FATAL_ERROR( "flex scanner push-back overflow" );
969 %% update yylineno here
972 yy_hold_char = *yy_cp;
976 #endif /* ifndef YY_NO_UNPUT */
987 int yyFlexLexer::yyinput()
992 *yy_c_buf_p = yy_hold_char;
994 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
996 /* yy_c_buf_p now points to the character we want to return.
997 * If this occurs *before* the EOB characters, then it's a
998 * valid NUL; if not, then we've hit the end of the buffer.
1000 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1001 /* This was really a NUL. */
1005 { /* need more input */
1006 int offset = yy_c_buf_p - yytext_ptr;
1009 switch ( yy_get_next_buffer() )
1011 case EOB_ACT_LAST_MATCH:
1012 /* This happens because yy_g_n_b()
1013 * sees that we've accumulated a
1014 * token and flags that we need to
1015 * try matching the token before
1016 * proceeding. But for input(),
1017 * there's no matching to consider.
1018 * So convert the EOB_ACT_LAST_MATCH
1019 * to EOB_ACT_END_OF_FILE.
1022 /* Reset buffer status. */
1027 case EOB_ACT_END_OF_FILE:
1032 if ( ! yy_did_buffer_switch_on_eof )
1041 case EOB_ACT_CONTINUE_SCAN:
1042 yy_c_buf_p = yytext_ptr + offset;
1048 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1049 *yy_c_buf_p = '\0'; /* preserve yytext */
1050 yy_hold_char = *++yy_c_buf_p;
1052 %% update BOL and yylineno
1059 #ifdef YY_USE_PROTOS
1060 void yyrestart( FILE *input_file )
1062 void yyrestart( input_file )
1066 void yyFlexLexer::yyrestart( istream* input_file )
1069 if ( ! yy_current_buffer )
1070 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1072 yy_init_buffer( yy_current_buffer, input_file );
1073 yy_load_buffer_state();
1078 #ifdef YY_USE_PROTOS
1079 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1081 void yy_switch_to_buffer( new_buffer )
1082 YY_BUFFER_STATE new_buffer;
1085 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1088 if ( yy_current_buffer == new_buffer )
1091 if ( yy_current_buffer )
1093 /* Flush out information for old buffer. */
1094 *yy_c_buf_p = yy_hold_char;
1095 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1096 yy_current_buffer->yy_n_chars = yy_n_chars;
1099 yy_current_buffer = new_buffer;
1100 yy_load_buffer_state();
1102 /* We don't actually know whether we did this switch during
1103 * EOF (yywrap()) processing, but the only time this flag
1104 * is looked at is after yywrap() is called, so it's safe
1105 * to go ahead and always set it.
1107 yy_did_buffer_switch_on_eof = 1;
1112 #ifdef YY_USE_PROTOS
1113 void yy_load_buffer_state( void )
1115 void yy_load_buffer_state()
1118 void yyFlexLexer::yy_load_buffer_state()
1121 yy_n_chars = yy_current_buffer->yy_n_chars;
1122 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1123 yyin = yy_current_buffer->yy_input_file;
1124 yy_hold_char = *yy_c_buf_p;
1129 #ifdef YY_USE_PROTOS
1130 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1132 YY_BUFFER_STATE yy_create_buffer( file, size )
1137 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1142 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1144 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1146 b->yy_buf_size = size;
1148 /* yy_ch_buf has to be 2 characters longer than the size given because
1149 * we need to put in 2 end-of-buffer characters.
1151 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1152 if ( ! b->yy_ch_buf )
1153 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1155 b->yy_is_our_buffer = 1;
1157 yy_init_buffer( b, file );
1164 #ifdef YY_USE_PROTOS
1165 void yy_delete_buffer( YY_BUFFER_STATE b )
1167 void yy_delete_buffer( b )
1171 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1177 if ( b == yy_current_buffer )
1178 yy_current_buffer = (YY_BUFFER_STATE) 0;
1180 if ( b->yy_is_our_buffer )
1181 yy_flex_free( (void *) b->yy_ch_buf );
1183 yy_flex_free( (void *) b );
1188 #ifndef YY_ALWAYS_INTERACTIVE
1189 #ifndef YY_NEVER_INTERACTIVE
1190 extern int isatty YY_PROTO(( int ));
1194 #ifdef YY_USE_PROTOS
1195 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1197 void yy_init_buffer( b, file )
1203 extern "C" int isatty YY_PROTO(( int ));
1204 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1208 yy_flush_buffer( b );
1210 b->yy_input_file = file;
1211 b->yy_fill_buffer = 1;
1214 #if YY_ALWAYS_INTERACTIVE
1215 b->yy_is_interactive = 1;
1217 #if YY_NEVER_INTERACTIVE
1218 b->yy_is_interactive = 0;
1220 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1224 b->yy_is_interactive = 0;
1230 #ifdef YY_USE_PROTOS
1231 void yy_flush_buffer( YY_BUFFER_STATE b )
1233 void yy_flush_buffer( b )
1238 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1246 /* We always need two end-of-buffer characters. The first causes
1247 * a transition to the end-of-buffer state. The second causes
1248 * a jam in that state.
1250 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1251 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1253 b->yy_buf_pos = &b->yy_ch_buf[0];
1256 b->yy_buffer_status = YY_BUFFER_NEW;
1258 if ( b == yy_current_buffer )
1259 yy_load_buffer_state();
1264 #ifndef YY_NO_SCAN_BUFFER
1266 #ifdef YY_USE_PROTOS
1267 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1269 YY_BUFFER_STATE yy_scan_buffer( base, size )
1277 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1278 base[size-1] != YY_END_OF_BUFFER_CHAR )
1279 /* They forgot to leave room for the EOB's. */
1282 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1284 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1286 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1287 b->yy_buf_pos = b->yy_ch_buf = base;
1288 b->yy_is_our_buffer = 0;
1289 b->yy_input_file = 0;
1290 b->yy_n_chars = b->yy_buf_size;
1291 b->yy_is_interactive = 0;
1293 b->yy_fill_buffer = 0;
1294 b->yy_buffer_status = YY_BUFFER_NEW;
1296 yy_switch_to_buffer( b );
1304 #ifndef YY_NO_SCAN_STRING
1306 #ifdef YY_USE_PROTOS
1307 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1309 YY_BUFFER_STATE yy_scan_string( yy_str )
1310 yyconst char *yy_str;
1314 for ( len = 0; yy_str[len]; ++len )
1317 return yy_scan_bytes( yy_str, len );
1323 #ifndef YY_NO_SCAN_BYTES
1325 #ifdef YY_USE_PROTOS
1326 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1328 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1329 yyconst char *bytes;
1338 /* Get memory for full buffer, including space for trailing EOB's. */
1340 buf = (char *) yy_flex_alloc( n );
1342 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1344 for ( i = 0; i < len; ++i )
1347 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1349 b = yy_scan_buffer( buf, n );
1351 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1353 /* It's okay to grow etc. this buffer, and we should throw it
1354 * away when we're done.
1356 b->yy_is_our_buffer = 1;
1364 #ifndef YY_NO_PUSH_STATE
1366 #ifdef YY_USE_PROTOS
1367 static void yy_push_state( int new_state )
1369 static void yy_push_state( new_state )
1373 void yyFlexLexer::yy_push_state( int new_state )
1376 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1380 yy_start_stack_depth += YY_START_STACK_INCR;
1381 new_size = yy_start_stack_depth * sizeof( int );
1383 if ( ! yy_start_stack )
1384 yy_start_stack = (int *) yy_flex_alloc( new_size );
1387 yy_start_stack = (int *) yy_flex_realloc(
1388 (void *) yy_start_stack, new_size );
1390 if ( ! yy_start_stack )
1392 "out of memory expanding start-condition stack" );
1395 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1402 #ifndef YY_NO_POP_STATE
1404 static void yy_pop_state()
1406 void yyFlexLexer::yy_pop_state()
1409 if ( --yy_start_stack_ptr < 0 )
1410 YY_FATAL_ERROR( "start-condition stack underflow" );
1412 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1417 #ifndef YY_NO_TOP_STATE
1419 static int yy_top_state()
1421 int yyFlexLexer::yy_top_state()
1424 return yy_start_stack[yy_start_stack_ptr - 1];
1428 #ifndef YY_EXIT_FAILURE
1429 #define YY_EXIT_FAILURE 2
1433 #ifdef YY_USE_PROTOS
1434 static void yy_fatal_error( yyconst char msg[] )
1436 static void yy_fatal_error( msg )
1440 (void) fprintf( stderr, "%s\n", msg );
1441 exit( YY_EXIT_FAILURE );
1446 void yyFlexLexer::LexerError( yyconst char msg[] )
1448 cerr << msg << '\n';
1449 exit( YY_EXIT_FAILURE );
1454 /* Redefine yyless() so it works in section 3 code. */
1460 /* Undo effects of setting up yytext. */ \
1461 yytext[yyleng] = yy_hold_char; \
1462 yy_c_buf_p = yytext + n; \
1463 yy_hold_char = *yy_c_buf_p; \
1464 *yy_c_buf_p = '\0'; \
1470 /* Internal utility routines. */
1473 #ifdef YY_USE_PROTOS
1474 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1476 static void yy_flex_strncpy( s1, s2, n )
1483 for ( i = 0; i < n; ++i )
1488 #ifdef YY_NEED_STRLEN
1489 #ifdef YY_USE_PROTOS
1490 static int yy_flex_strlen( yyconst char *s )
1492 static int yy_flex_strlen( s )
1497 for ( n = 0; s[n]; ++n )
1505 #ifdef YY_USE_PROTOS
1506 static void *yy_flex_alloc( yy_size_t size )
1508 static void *yy_flex_alloc( size )
1512 return (void *) malloc( size );
1515 #ifdef YY_USE_PROTOS
1516 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1518 static void *yy_flex_realloc( ptr, size )
1523 /* The cast to (char *) in the following accommodates both
1524 * implementations that use char* generic pointers, and those
1525 * that use void* generic pointers. It works with the latter
1526 * because both ANSI C and C++ allow castless assignment from
1527 * any pointer type to void*, and deal with argument conversions
1528 * as though doing an assignment.
1530 return (void *) realloc( (char *) ptr, size );
1533 #ifdef YY_USE_PROTOS
1534 static void yy_flex_free( void *ptr )
1536 static void yy_flex_free( ptr )