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
750 static int yy_get_next_buffer()
752 int yyFlexLexer::yy_get_next_buffer()
755 char *dest = yy_current_buffer->yy_ch_buf;
756 char *source = yytext_ptr;
757 int number_to_move, i;
760 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
762 "fatal flex scanner internal error--end of buffer missed" );
764 if ( yy_current_buffer->yy_fill_buffer == 0 )
765 { /* Don't try to fill the buffer, so this is an EOF. */
766 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
768 /* We matched a single character, the EOB, so
769 * treat this as a final EOF.
771 return EOB_ACT_END_OF_FILE;
776 /* We matched some text prior to the EOB, first
779 return EOB_ACT_LAST_MATCH;
783 /* Try to read more data. */
785 /* First move last chars to start of buffer. */
786 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
788 for ( i = 0; i < number_to_move; ++i )
789 *(dest++) = *(source++);
791 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
792 /* don't do the read, it's not guaranteed to return an EOF,
795 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
800 yy_current_buffer->yy_buf_size - number_to_move - 1;
802 while ( num_to_read <= 0 )
803 { /* Not enough room in the buffer - grow it. */
804 #ifdef YY_USES_REJECT
806 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
809 /* just a shorter name for the current buffer */
810 YY_BUFFER_STATE b = yy_current_buffer;
812 int yy_c_buf_p_offset =
813 (int) (yy_c_buf_p - b->yy_ch_buf);
815 if ( b->yy_is_our_buffer )
817 int new_size = b->yy_buf_size * 2;
820 b->yy_buf_size += b->yy_buf_size / 8;
824 b->yy_ch_buf = (char *)
825 /* Include room in for 2 EOB chars. */
826 yy_flex_realloc( (void *) b->yy_ch_buf,
827 b->yy_buf_size + 2 );
830 /* Can't grow it, we don't own it. */
833 if ( ! b->yy_ch_buf )
835 "fatal error - scanner input buffer overflow" );
837 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
839 num_to_read = yy_current_buffer->yy_buf_size -
844 if ( num_to_read > YY_READ_BUF_SIZE )
845 num_to_read = YY_READ_BUF_SIZE;
847 /* Read in more data. */
848 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
849 yy_n_chars, num_to_read );
851 yy_current_buffer->yy_n_chars = yy_n_chars;
854 if ( yy_n_chars == 0 )
856 if ( number_to_move == YY_MORE_ADJ )
858 ret_val = EOB_ACT_END_OF_FILE;
864 ret_val = EOB_ACT_LAST_MATCH;
865 yy_current_buffer->yy_buffer_status =
866 YY_BUFFER_EOF_PENDING;
871 ret_val = EOB_ACT_CONTINUE_SCAN;
873 yy_n_chars += number_to_move;
874 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
875 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
877 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
883 /* yy_get_previous_state - get the state just before the EOB char was reached */
886 static yy_state_type yy_get_previous_state()
888 yy_state_type yyFlexLexer::yy_get_previous_state()
891 yy_state_type yy_current_state;
894 %% code to get the start state into yy_current_state goes here
896 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
898 %% code to find the next state goes here
901 return yy_current_state;
905 /* yy_try_NUL_trans - try to make a transition on the NUL character
908 * next_state = yy_try_NUL_trans( current_state );
913 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
915 static yy_state_type yy_try_NUL_trans( yy_current_state )
916 yy_state_type yy_current_state;
919 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
923 %% code to find the next state, and perhaps do backing up, goes here
925 return yy_is_jam ? 0 : yy_current_state;
932 static void yyunput( int c, char *yy_bp )
934 static void yyunput( c, yy_bp )
939 void yyFlexLexer::yyunput( int c, char* yy_bp )
942 char *yy_cp = yy_c_buf_p;
944 /* undo effects of setting up yytext */
945 *yy_cp = yy_hold_char;
947 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
948 { /* need to shift things up to make room */
949 /* +2 for EOB chars. */
950 int number_to_move = yy_n_chars + 2;
951 char *dest = &yy_current_buffer->yy_ch_buf[
952 yy_current_buffer->yy_buf_size + 2];
954 &yy_current_buffer->yy_ch_buf[number_to_move];
956 while ( source > yy_current_buffer->yy_ch_buf )
959 yy_cp += (int) (dest - source);
960 yy_bp += (int) (dest - source);
961 yy_current_buffer->yy_n_chars =
962 yy_n_chars = yy_current_buffer->yy_buf_size;
964 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
965 YY_FATAL_ERROR( "flex scanner push-back overflow" );
970 %% update yylineno here
973 yy_hold_char = *yy_cp;
977 #endif /* ifndef YY_NO_UNPUT */
988 int yyFlexLexer::yyinput()
993 *yy_c_buf_p = yy_hold_char;
995 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
997 /* yy_c_buf_p now points to the character we want to return.
998 * If this occurs *before* the EOB characters, then it's a
999 * valid NUL; if not, then we've hit the end of the buffer.
1001 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1002 /* This was really a NUL. */
1006 { /* need more input */
1007 int offset = yy_c_buf_p - yytext_ptr;
1010 switch ( yy_get_next_buffer() )
1012 case EOB_ACT_LAST_MATCH:
1013 /* This happens because yy_g_n_b()
1014 * sees that we've accumulated a
1015 * token and flags that we need to
1016 * try matching the token before
1017 * proceeding. But for input(),
1018 * there's no matching to consider.
1019 * So convert the EOB_ACT_LAST_MATCH
1020 * to EOB_ACT_END_OF_FILE.
1023 /* Reset buffer status. */
1028 case EOB_ACT_END_OF_FILE:
1033 if ( ! yy_did_buffer_switch_on_eof )
1042 case EOB_ACT_CONTINUE_SCAN:
1043 yy_c_buf_p = yytext_ptr + offset;
1049 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1050 *yy_c_buf_p = '\0'; /* preserve yytext */
1051 yy_hold_char = *++yy_c_buf_p;
1053 %% update BOL and yylineno
1060 #ifdef YY_USE_PROTOS
1061 void yyrestart( FILE *input_file )
1063 void yyrestart( input_file )
1067 void yyFlexLexer::yyrestart( istream* input_file )
1070 if ( ! yy_current_buffer )
1071 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1073 yy_init_buffer( yy_current_buffer, input_file );
1074 yy_load_buffer_state();
1079 #ifdef YY_USE_PROTOS
1080 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1082 void yy_switch_to_buffer( new_buffer )
1083 YY_BUFFER_STATE new_buffer;
1086 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1089 if ( yy_current_buffer == new_buffer )
1092 if ( yy_current_buffer )
1094 /* Flush out information for old buffer. */
1095 *yy_c_buf_p = yy_hold_char;
1096 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1097 yy_current_buffer->yy_n_chars = yy_n_chars;
1100 yy_current_buffer = new_buffer;
1101 yy_load_buffer_state();
1103 /* We don't actually know whether we did this switch during
1104 * EOF (yywrap()) processing, but the only time this flag
1105 * is looked at is after yywrap() is called, so it's safe
1106 * to go ahead and always set it.
1108 yy_did_buffer_switch_on_eof = 1;
1113 #ifdef YY_USE_PROTOS
1114 void yy_load_buffer_state( void )
1116 void yy_load_buffer_state()
1119 void yyFlexLexer::yy_load_buffer_state()
1122 yy_n_chars = yy_current_buffer->yy_n_chars;
1123 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1124 yyin = yy_current_buffer->yy_input_file;
1125 yy_hold_char = *yy_c_buf_p;
1130 #ifdef YY_USE_PROTOS
1131 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1133 YY_BUFFER_STATE yy_create_buffer( file, size )
1138 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1143 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1145 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1147 b->yy_buf_size = size;
1149 /* yy_ch_buf has to be 2 characters longer than the size given because
1150 * we need to put in 2 end-of-buffer characters.
1152 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1153 if ( ! b->yy_ch_buf )
1154 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1156 b->yy_is_our_buffer = 1;
1158 yy_init_buffer( b, file );
1165 #ifdef YY_USE_PROTOS
1166 void yy_delete_buffer( YY_BUFFER_STATE b )
1168 void yy_delete_buffer( b )
1172 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1178 if ( b == yy_current_buffer )
1179 yy_current_buffer = (YY_BUFFER_STATE) 0;
1181 if ( b->yy_is_our_buffer )
1182 yy_flex_free( (void *) b->yy_ch_buf );
1184 yy_flex_free( (void *) b );
1189 #ifndef YY_ALWAYS_INTERACTIVE
1190 #ifndef YY_NEVER_INTERACTIVE
1191 extern int isatty YY_PROTO(( int ));
1195 #ifdef YY_USE_PROTOS
1196 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1198 void yy_init_buffer( b, file )
1204 extern "C" int isatty YY_PROTO(( int ));
1205 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1209 yy_flush_buffer( b );
1211 b->yy_input_file = file;
1212 b->yy_fill_buffer = 1;
1215 #if YY_ALWAYS_INTERACTIVE
1216 b->yy_is_interactive = 1;
1218 #if YY_NEVER_INTERACTIVE
1219 b->yy_is_interactive = 0;
1221 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1225 b->yy_is_interactive = 0;
1231 #ifdef YY_USE_PROTOS
1232 void yy_flush_buffer( YY_BUFFER_STATE b )
1234 void yy_flush_buffer( b )
1239 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1247 /* We always need two end-of-buffer characters. The first causes
1248 * a transition to the end-of-buffer state. The second causes
1249 * a jam in that state.
1251 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1252 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1254 b->yy_buf_pos = &b->yy_ch_buf[0];
1257 b->yy_buffer_status = YY_BUFFER_NEW;
1259 if ( b == yy_current_buffer )
1260 yy_load_buffer_state();
1265 #ifndef YY_NO_SCAN_BUFFER
1267 #ifdef YY_USE_PROTOS
1268 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1270 YY_BUFFER_STATE yy_scan_buffer( base, size )
1278 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1279 base[size-1] != YY_END_OF_BUFFER_CHAR )
1280 /* They forgot to leave room for the EOB's. */
1283 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1285 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1287 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1288 b->yy_buf_pos = b->yy_ch_buf = base;
1289 b->yy_is_our_buffer = 0;
1290 b->yy_input_file = 0;
1291 b->yy_n_chars = b->yy_buf_size;
1292 b->yy_is_interactive = 0;
1294 b->yy_fill_buffer = 0;
1295 b->yy_buffer_status = YY_BUFFER_NEW;
1297 yy_switch_to_buffer( b );
1305 #ifndef YY_NO_SCAN_STRING
1307 #ifdef YY_USE_PROTOS
1308 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1310 YY_BUFFER_STATE yy_scan_string( yy_str )
1311 yyconst char *yy_str;
1315 for ( len = 0; yy_str[len]; ++len )
1318 return yy_scan_bytes( yy_str, len );
1324 #ifndef YY_NO_SCAN_BYTES
1326 #ifdef YY_USE_PROTOS
1327 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1329 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1330 yyconst char *bytes;
1339 /* Get memory for full buffer, including space for trailing EOB's. */
1341 buf = (char *) yy_flex_alloc( n );
1343 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1345 for ( i = 0; i < len; ++i )
1348 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1350 b = yy_scan_buffer( buf, n );
1352 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1354 /* It's okay to grow etc. this buffer, and we should throw it
1355 * away when we're done.
1357 b->yy_is_our_buffer = 1;
1365 #ifndef YY_NO_PUSH_STATE
1367 #ifdef YY_USE_PROTOS
1368 static void yy_push_state( int new_state )
1370 static void yy_push_state( new_state )
1374 void yyFlexLexer::yy_push_state( int new_state )
1377 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1381 yy_start_stack_depth += YY_START_STACK_INCR;
1382 new_size = yy_start_stack_depth * sizeof( int );
1384 if ( ! yy_start_stack )
1385 yy_start_stack = (int *) yy_flex_alloc( new_size );
1388 yy_start_stack = (int *) yy_flex_realloc(
1389 (void *) yy_start_stack, new_size );
1391 if ( ! yy_start_stack )
1393 "out of memory expanding start-condition stack" );
1396 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1403 #ifndef YY_NO_POP_STATE
1405 static void yy_pop_state()
1407 void yyFlexLexer::yy_pop_state()
1410 if ( --yy_start_stack_ptr < 0 )
1411 YY_FATAL_ERROR( "start-condition stack underflow" );
1413 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1418 #ifndef YY_NO_TOP_STATE
1420 static int yy_top_state()
1422 int yyFlexLexer::yy_top_state()
1425 return yy_start_stack[yy_start_stack_ptr - 1];
1429 #ifndef YY_EXIT_FAILURE
1430 #define YY_EXIT_FAILURE 2
1434 #ifdef YY_USE_PROTOS
1435 static void yy_fatal_error( yyconst char msg[] )
1437 static void yy_fatal_error( msg )
1441 (void) fprintf( stderr, "%s\n", msg );
1442 exit( YY_EXIT_FAILURE );
1447 void yyFlexLexer::LexerError( yyconst char msg[] )
1449 cerr << msg << '\n';
1450 exit( YY_EXIT_FAILURE );
1455 /* Redefine yyless() so it works in section 3 code. */
1461 /* Undo effects of setting up yytext. */ \
1462 yytext[yyleng] = yy_hold_char; \
1463 yy_c_buf_p = yytext + n; \
1464 yy_hold_char = *yy_c_buf_p; \
1465 *yy_c_buf_p = '\0'; \
1471 /* Internal utility routines. */
1474 #ifdef YY_USE_PROTOS
1475 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1477 static void yy_flex_strncpy( s1, s2, n )
1484 for ( i = 0; i < n; ++i )
1489 #ifdef YY_NEED_STRLEN
1490 #ifdef YY_USE_PROTOS
1491 static int yy_flex_strlen( yyconst char *s )
1493 static int yy_flex_strlen( s )
1498 for ( n = 0; s[n]; ++n )
1506 #ifdef YY_USE_PROTOS
1507 static void *yy_flex_alloc( yy_size_t size )
1509 static void *yy_flex_alloc( size )
1513 return (void *) malloc( size );
1516 #ifdef YY_USE_PROTOS
1517 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1519 static void *yy_flex_realloc( ptr, size )
1524 /* The cast to (char *) in the following accommodates both
1525 * implementations that use char* generic pointers, and those
1526 * that use void* generic pointers. It works with the latter
1527 * because both ANSI C and C++ allow castless assignment from
1528 * any pointer type to void*, and deal with argument conversions
1529 * as though doing an assignment.
1531 return (void *) realloc( (char *) ptr, size );
1534 #ifdef YY_USE_PROTOS
1535 static void yy_flex_free( void *ptr )
1537 static void yy_flex_free( ptr )