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 $
5 * $FreeBSD: src/usr.bin/lex/flex.skl,v 1.4 1999/10/27 07:56:44 obrien Exp $
6 * $DragonFly: src/usr.bin/lex/flex.skl,v 1.2 2003/06/17 04:29:27 dillon Exp $
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
18 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
34 /* Use prototypes in function declarations. */
37 /* The "const" storage-class-modifier is valid. */
40 #else /* ! __cplusplus */
48 #endif /* ! __cplusplus */
67 #define YY_PROTO(proto) proto
69 #define YY_PROTO(proto) ()
72 /* Returned upon end-of-file. */
75 /* Promotes a possibly negative, possibly signed char to an unsigned
76 * integer for use as an array index. If the signed char is negative,
77 * we want to instead treat it as an 8-bit unsigned char, hence the
80 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
82 /* Enter a start condition. This macro really ought to take a parameter,
83 * but we do it the disgusting crufty way forced on us by the ()-less
84 * definition of BEGIN.
86 #define BEGIN yy_start = 1 + 2 *
88 /* Translate the current start state into a value that can be later handed
89 * to BEGIN to return to the state. The YYSTATE alias is for lex
92 #define YY_START ((yy_start - 1) / 2)
93 #define YYSTATE YY_START
95 /* Action number for EOF rule of a given start state. */
96 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
98 /* Special action meaning "start processing a new file". */
99 #define YY_NEW_FILE yyrestart( yyin )
101 #define YY_END_OF_BUFFER_CHAR 0
103 /* Size of default input buffer. */
104 #define YY_BUF_SIZE 16384
106 typedef struct yy_buffer_state *YY_BUFFER_STATE;
110 extern FILE *yyin, *yyout;
113 #define EOB_ACT_CONTINUE_SCAN 0
114 #define EOB_ACT_END_OF_FILE 1
115 #define EOB_ACT_LAST_MATCH 2
117 /* The funky do-while in the following #define is used to turn the definition
118 * int a single C statement (which needs a semi-colon terminator). This
119 * avoids problems with code like:
121 * if ( condition_holds )
124 * do_something_else();
126 * Prior to using the do-while the compiler would get upset at the
127 * "else" because it interpreted the "if" statement as being all
128 * done when it reached the ';' after the yyless() call.
131 /* Return all but the first 'n' matched characters back to the input stream. */
136 /* Undo effects of setting up yytext. */ \
137 *yy_cp = yy_hold_char; \
138 YY_RESTORE_YY_MORE_OFFSET \
139 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
140 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
144 #define unput(c) yyunput( c, yytext_ptr )
146 /* The following is because we cannot portably get our hands on size_t
147 * (without autoconf's help, which isn't available because we want
148 * flex-generated scanners to compile on their own).
150 typedef unsigned int yy_size_t;
153 struct yy_buffer_state
158 istream* yy_input_file;
161 char *yy_ch_buf; /* input buffer */
162 char *yy_buf_pos; /* current position in input buffer */
164 /* Size of input buffer in bytes, not including room for EOB
167 yy_size_t yy_buf_size;
169 /* Number of characters read into yy_ch_buf, not including EOB
174 /* Whether we "own" the buffer - i.e., we know we created it,
175 * and can realloc() it to grow it, and should free() it to
178 int yy_is_our_buffer;
180 /* Whether this is an "interactive" input source; if so, and
181 * if we're using stdio for input, then we want to use getc()
182 * instead of fread(), to make sure we stop fetching input after
185 int yy_is_interactive;
187 /* Whether we're considered to be at the beginning of a line.
188 * If so, '^' rules will be active on the next match, otherwise
193 /* Whether to try to fill the input buffer when we reach the
198 int yy_buffer_status;
199 #define YY_BUFFER_NEW 0
200 #define YY_BUFFER_NORMAL 1
201 /* When an EOF's been seen but there's still some text to process
202 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
203 * shouldn't try reading from the input source any more. We might
204 * still have a bunch of tokens to match, though, because of
205 * possible backing-up.
207 * When we actually see the EOF, we change the status to "new"
208 * (via yyrestart()), so that the user can continue scanning by
209 * just pointing yyin at a new input file.
211 #define YY_BUFFER_EOF_PENDING 2
214 %- Standard (non-C++) definition
215 static YY_BUFFER_STATE yy_current_buffer = 0;
218 /* We provide macros for accessing buffer states in case in the
219 * future we want to put the buffer states in a more general
222 #define YY_CURRENT_BUFFER yy_current_buffer
225 %- Standard (non-C++) definition
226 /* yy_hold_char holds the character lost when yytext is formed. */
227 static char yy_hold_char;
229 static int yy_n_chars; /* number of characters read into yy_ch_buf */
234 /* Points to current character in buffer. */
235 static char *yy_c_buf_p = (char *) 0;
236 static int yy_init = 1; /* whether we need to initialize */
237 static int yy_start = 0; /* start state number */
239 /* Flag which is used to allow yywrap()'s to do buffer switches
240 * instead of setting up a fresh yyin. A bit of a hack ...
242 static int yy_did_buffer_switch_on_eof;
244 void yyrestart YY_PROTO(( FILE *input_file ));
246 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
247 void yy_load_buffer_state YY_PROTO(( void ));
248 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
249 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
250 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
251 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
252 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
254 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
255 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
256 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
259 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
260 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
261 static void yy_flex_free YY_PROTO(( void * ));
263 #define yy_new_buffer yy_create_buffer
265 #define yy_set_interactive(is_interactive) \
267 if ( ! yy_current_buffer ) \
268 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
269 yy_current_buffer->yy_is_interactive = is_interactive; \
272 #define yy_set_bol(at_bol) \
274 if ( ! yy_current_buffer ) \
275 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
276 yy_current_buffer->yy_at_bol = at_bol; \
279 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
281 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
283 %- Standard (non-C++) definition
284 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
285 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
286 static int yy_get_next_buffer YY_PROTO(( void ));
287 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
290 /* Done after the current pattern has been matched and before the
291 * corresponding action - sets up yytext.
293 #define YY_DO_BEFORE_ACTION \
294 yytext_ptr = yy_bp; \
295 %% code to fiddle yytext and yyleng for yymore() goes here
296 yy_hold_char = *yy_cp; \
298 %% code to copy yytext_ptr to yytext[] goes here, if %array
301 %% data tables for the DFA and the user's section 1 definitions go here
303 /* Macros after this point can all be overridden by user definitions in
307 #ifndef YY_SKIP_YYWRAP
309 extern "C" int yywrap YY_PROTO(( void ));
311 extern int yywrap YY_PROTO(( void ));
317 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
322 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
325 #ifdef YY_NEED_STRLEN
326 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
330 %- Standard (non-C++) definition
332 static int yyinput YY_PROTO(( void ));
334 static int input YY_PROTO(( void ));
340 static int yy_start_stack_ptr = 0;
341 static int yy_start_stack_depth = 0;
342 static int *yy_start_stack = 0;
343 #ifndef YY_NO_PUSH_STATE
344 static void yy_push_state YY_PROTO(( int new_state ));
346 #ifndef YY_NO_POP_STATE
347 static void yy_pop_state YY_PROTO(( void ));
349 #ifndef YY_NO_TOP_STATE
350 static int yy_top_state YY_PROTO(( void ));
354 #define YY_NO_PUSH_STATE 1
355 #define YY_NO_POP_STATE 1
356 #define YY_NO_TOP_STATE 1
359 #ifdef YY_MALLOC_DECL
367 /* Just try to get by without declaring the routines. This will fail
368 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
369 * or sizeof(void*) != sizeof(int).
374 /* Amount of stuff to slurp up with each read. */
375 #ifndef YY_READ_BUF_SIZE
376 #define YY_READ_BUF_SIZE 8192
379 /* Copy whatever the last rule matched to the standard output. */
382 %- Standard (non-C++) definition
383 /* This used to be an fputs(), but since the string might contain NUL's,
384 * we now use fwrite().
386 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
388 #define ECHO LexerOutput( yytext, yyleng )
392 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
393 * is returned in "result".
396 #define YY_INPUT(buf,result,max_size) \
397 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
399 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
400 YY_FATAL_ERROR( "input in flex scanner failed" );
404 /* No semi-colon after return; correct usage is to write "yyterminate();" -
405 * we don't want an extra ';' after the "return" because that will cause
406 * some compilers to complain about unreachable statements.
409 #define yyterminate() return YY_NULL
412 /* Number of entries by which start-condition stack grows. */
413 #ifndef YY_START_STACK_INCR
414 #define YY_START_STACK_INCR 25
417 /* Report a fatal error. */
418 #ifndef YY_FATAL_ERROR
420 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
422 #define YY_FATAL_ERROR(msg) LexerError( msg )
426 /* Default declaration of generated scanner - a define so the user can
427 * easily add parameters.
430 %- Standard (non-C++) definition
431 #define YY_DECL int yylex YY_PROTO(( void ))
433 #define YY_DECL int yyFlexLexer::yylex()
437 /* Code executed at the beginning of each rule, after yytext and yyleng
440 #ifndef YY_USER_ACTION
441 #define YY_USER_ACTION
444 /* Code executed at the end of each rule. */
446 #define YY_BREAK break;
449 %% YY_RULE_SETUP definition goes here
453 register yy_state_type yy_current_state;
454 register char *yy_cp, *yy_bp;
457 %% user's declarations go here
468 yy_start = 1; /* first start state */
484 if ( ! yy_current_buffer )
486 yy_create_buffer( yyin, YY_BUF_SIZE );
488 yy_load_buffer_state();
491 while ( 1 ) /* loops until end-of-file is reached */
493 %% yymore()-related code goes here
496 /* Support of yytext. */
497 *yy_cp = yy_hold_char;
499 /* yy_bp points to the position in yy_ch_buf of the start of
504 %% code to set up and find next match goes here
507 %% code to find the action number goes here
511 %% code for yylineno update goes here
513 do_action: /* This label is used only to access EOF actions. */
515 %% debug code goes here
518 { /* beginning of action switch */
521 case YY_END_OF_BUFFER:
523 /* Amount of text matched not including the EOB char. */
524 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
526 /* Undo the effects of YY_DO_BEFORE_ACTION. */
527 *yy_cp = yy_hold_char;
528 YY_RESTORE_YY_MORE_OFFSET
530 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
532 /* We're scanning a new file or input source. It's
533 * possible that this happened because the user
534 * just pointed yyin at a new source and called
535 * yylex(). If so, then we have to assure
536 * consistency between yy_current_buffer and our
537 * globals. Here is the right place to do so, because
538 * this is the first action (other than possibly a
539 * back-up) that will match for the new input source.
541 yy_n_chars = yy_current_buffer->yy_n_chars;
542 yy_current_buffer->yy_input_file = yyin;
543 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
546 /* Note that here we test for yy_c_buf_p "<=" to the position
547 * of the first EOB in the buffer, since yy_c_buf_p will
548 * already have been incremented past the NUL character
549 * (since all states make transitions on EOB to the
550 * end-of-buffer state). Contrast this with the test
553 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
554 { /* This was really a NUL. */
555 yy_state_type yy_next_state;
557 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
559 yy_current_state = yy_get_previous_state();
561 /* Okay, we're now positioned to make the NUL
562 * transition. We couldn't have
563 * yy_get_previous_state() go ahead and do it
564 * for us because it doesn't know how to deal
565 * with the possibility of jamming (and we don't
566 * want to build jamming into it because then it
567 * will run more slowly).
570 yy_next_state = yy_try_NUL_trans( yy_current_state );
572 yy_bp = yytext_ptr + YY_MORE_ADJ;
576 /* Consume the NUL. */
577 yy_cp = ++yy_c_buf_p;
578 yy_current_state = yy_next_state;
584 %% code to do back-up for compressed tables and set up yy_cp goes here
589 else switch ( yy_get_next_buffer() )
591 case EOB_ACT_END_OF_FILE:
593 yy_did_buffer_switch_on_eof = 0;
597 /* Note: because we've taken care in
598 * yy_get_next_buffer() to have set up
599 * yytext, we can now set up
600 * yy_c_buf_p so that if some total
601 * hoser (like flex itself) wants to
602 * call the scanner after we return the
603 * YY_NULL, it'll still work - another
604 * YY_NULL will get returned.
606 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
608 yy_act = YY_STATE_EOF(YY_START);
614 if ( ! yy_did_buffer_switch_on_eof )
620 case EOB_ACT_CONTINUE_SCAN:
622 yytext_ptr + yy_amount_of_matched_text;
624 yy_current_state = yy_get_previous_state();
627 yy_bp = yytext_ptr + YY_MORE_ADJ;
630 case EOB_ACT_LAST_MATCH:
632 &yy_current_buffer->yy_ch_buf[yy_n_chars];
634 yy_current_state = yy_get_previous_state();
637 yy_bp = yytext_ptr + YY_MORE_ADJ;
645 "fatal flex scanner internal error--no action found" );
646 } /* end of action switch */
647 } /* end of scanning one token */
651 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
659 yylineno = 1; // this will only get updated if %option yylineno
661 yy_did_buffer_switch_on_eof = 0;
663 yy_looking_for_trail_begin = 0;
666 yy_more_offset = yy_prev_more_offset = 0;
668 yy_start_stack_ptr = yy_start_stack_depth = 0;
671 yy_current_buffer = 0;
673 #ifdef YY_USES_REJECT
674 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
680 yyFlexLexer::~yyFlexLexer()
683 yy_delete_buffer( yy_current_buffer );
686 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
690 yy_delete_buffer( yy_current_buffer );
691 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
698 #ifdef YY_INTERACTIVE
699 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
701 int yyFlexLexer::LexerInput( char* buf, int max_size )
704 if ( yyin->eof() || yyin->fail() )
707 #ifdef YY_INTERACTIVE
719 (void) yyin->read( buf, max_size );
724 return yyin->gcount();
728 void yyFlexLexer::LexerOutput( const char* buf, int size )
730 (void) yyout->write( buf, size );
734 /* yy_get_next_buffer - try to read in a new buffer
736 * Returns a code representing an action:
737 * EOB_ACT_LAST_MATCH -
738 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
739 * EOB_ACT_END_OF_FILE - end of file
743 static int yy_get_next_buffer()
745 int yyFlexLexer::yy_get_next_buffer()
748 register char *dest = yy_current_buffer->yy_ch_buf;
749 register char *source = yytext_ptr;
750 register int number_to_move, i;
753 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
755 "fatal flex scanner internal error--end of buffer missed" );
757 if ( yy_current_buffer->yy_fill_buffer == 0 )
758 { /* Don't try to fill the buffer, so this is an EOF. */
759 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
761 /* We matched a single character, the EOB, so
762 * treat this as a final EOF.
764 return EOB_ACT_END_OF_FILE;
769 /* We matched some text prior to the EOB, first
772 return EOB_ACT_LAST_MATCH;
776 /* Try to read more data. */
778 /* First move last chars to start of buffer. */
779 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
781 for ( i = 0; i < number_to_move; ++i )
782 *(dest++) = *(source++);
784 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
785 /* don't do the read, it's not guaranteed to return an EOF,
788 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
793 yy_current_buffer->yy_buf_size - number_to_move - 1;
795 while ( num_to_read <= 0 )
796 { /* Not enough room in the buffer - grow it. */
797 #ifdef YY_USES_REJECT
799 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
802 /* just a shorter name for the current buffer */
803 YY_BUFFER_STATE b = yy_current_buffer;
805 int yy_c_buf_p_offset =
806 (int) (yy_c_buf_p - b->yy_ch_buf);
808 if ( b->yy_is_our_buffer )
810 int new_size = b->yy_buf_size * 2;
813 b->yy_buf_size += b->yy_buf_size / 8;
817 b->yy_ch_buf = (char *)
818 /* Include room in for 2 EOB chars. */
819 yy_flex_realloc( (void *) b->yy_ch_buf,
820 b->yy_buf_size + 2 );
823 /* Can't grow it, we don't own it. */
826 if ( ! b->yy_ch_buf )
828 "fatal error - scanner input buffer overflow" );
830 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
832 num_to_read = yy_current_buffer->yy_buf_size -
837 if ( num_to_read > YY_READ_BUF_SIZE )
838 num_to_read = YY_READ_BUF_SIZE;
840 /* Read in more data. */
841 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
842 yy_n_chars, num_to_read );
844 yy_current_buffer->yy_n_chars = yy_n_chars;
847 if ( yy_n_chars == 0 )
849 if ( number_to_move == YY_MORE_ADJ )
851 ret_val = EOB_ACT_END_OF_FILE;
857 ret_val = EOB_ACT_LAST_MATCH;
858 yy_current_buffer->yy_buffer_status =
859 YY_BUFFER_EOF_PENDING;
864 ret_val = EOB_ACT_CONTINUE_SCAN;
866 yy_n_chars += number_to_move;
867 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
868 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
870 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
876 /* yy_get_previous_state - get the state just before the EOB char was reached */
879 static yy_state_type yy_get_previous_state()
881 yy_state_type yyFlexLexer::yy_get_previous_state()
884 register yy_state_type yy_current_state;
885 register char *yy_cp;
887 %% code to get the start state into yy_current_state goes here
889 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
891 %% code to find the next state goes here
894 return yy_current_state;
898 /* yy_try_NUL_trans - try to make a transition on the NUL character
901 * next_state = yy_try_NUL_trans( current_state );
906 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
908 static yy_state_type yy_try_NUL_trans( yy_current_state )
909 yy_state_type yy_current_state;
912 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
915 register int yy_is_jam;
916 %% code to find the next state, and perhaps do backing up, goes here
918 return yy_is_jam ? 0 : yy_current_state;
925 static void yyunput( int c, register char *yy_bp )
927 static void yyunput( c, yy_bp )
929 register char *yy_bp;
932 void yyFlexLexer::yyunput( int c, register char* yy_bp )
935 register char *yy_cp = yy_c_buf_p;
937 /* undo effects of setting up yytext */
938 *yy_cp = yy_hold_char;
940 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
941 { /* need to shift things up to make room */
942 /* +2 for EOB chars. */
943 register int number_to_move = yy_n_chars + 2;
944 register char *dest = &yy_current_buffer->yy_ch_buf[
945 yy_current_buffer->yy_buf_size + 2];
946 register char *source =
947 &yy_current_buffer->yy_ch_buf[number_to_move];
949 while ( source > yy_current_buffer->yy_ch_buf )
952 yy_cp += (int) (dest - source);
953 yy_bp += (int) (dest - source);
954 yy_current_buffer->yy_n_chars =
955 yy_n_chars = yy_current_buffer->yy_buf_size;
957 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
958 YY_FATAL_ERROR( "flex scanner push-back overflow" );
963 %% update yylineno here
966 yy_hold_char = *yy_cp;
970 #endif /* ifndef YY_NO_UNPUT */
981 int yyFlexLexer::yyinput()
986 *yy_c_buf_p = yy_hold_char;
988 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
990 /* yy_c_buf_p now points to the character we want to return.
991 * If this occurs *before* the EOB characters, then it's a
992 * valid NUL; if not, then we've hit the end of the buffer.
994 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
995 /* This was really a NUL. */
999 { /* need more input */
1000 int offset = yy_c_buf_p - yytext_ptr;
1003 switch ( yy_get_next_buffer() )
1005 case EOB_ACT_LAST_MATCH:
1006 /* This happens because yy_g_n_b()
1007 * sees that we've accumulated a
1008 * token and flags that we need to
1009 * try matching the token before
1010 * proceeding. But for input(),
1011 * there's no matching to consider.
1012 * So convert the EOB_ACT_LAST_MATCH
1013 * to EOB_ACT_END_OF_FILE.
1016 /* Reset buffer status. */
1021 case EOB_ACT_END_OF_FILE:
1026 if ( ! yy_did_buffer_switch_on_eof )
1035 case EOB_ACT_CONTINUE_SCAN:
1036 yy_c_buf_p = yytext_ptr + offset;
1042 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1043 *yy_c_buf_p = '\0'; /* preserve yytext */
1044 yy_hold_char = *++yy_c_buf_p;
1046 %% update BOL and yylineno
1053 #ifdef YY_USE_PROTOS
1054 void yyrestart( FILE *input_file )
1056 void yyrestart( input_file )
1060 void yyFlexLexer::yyrestart( istream* input_file )
1063 if ( ! yy_current_buffer )
1064 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1066 yy_init_buffer( yy_current_buffer, input_file );
1067 yy_load_buffer_state();
1072 #ifdef YY_USE_PROTOS
1073 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1075 void yy_switch_to_buffer( new_buffer )
1076 YY_BUFFER_STATE new_buffer;
1079 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1082 if ( yy_current_buffer == new_buffer )
1085 if ( yy_current_buffer )
1087 /* Flush out information for old buffer. */
1088 *yy_c_buf_p = yy_hold_char;
1089 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1090 yy_current_buffer->yy_n_chars = yy_n_chars;
1093 yy_current_buffer = new_buffer;
1094 yy_load_buffer_state();
1096 /* We don't actually know whether we did this switch during
1097 * EOF (yywrap()) processing, but the only time this flag
1098 * is looked at is after yywrap() is called, so it's safe
1099 * to go ahead and always set it.
1101 yy_did_buffer_switch_on_eof = 1;
1106 #ifdef YY_USE_PROTOS
1107 void yy_load_buffer_state( void )
1109 void yy_load_buffer_state()
1112 void yyFlexLexer::yy_load_buffer_state()
1115 yy_n_chars = yy_current_buffer->yy_n_chars;
1116 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1117 yyin = yy_current_buffer->yy_input_file;
1118 yy_hold_char = *yy_c_buf_p;
1123 #ifdef YY_USE_PROTOS
1124 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1126 YY_BUFFER_STATE yy_create_buffer( file, size )
1131 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1136 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1138 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1140 b->yy_buf_size = size;
1142 /* yy_ch_buf has to be 2 characters longer than the size given because
1143 * we need to put in 2 end-of-buffer characters.
1145 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1146 if ( ! b->yy_ch_buf )
1147 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1149 b->yy_is_our_buffer = 1;
1151 yy_init_buffer( b, file );
1158 #ifdef YY_USE_PROTOS
1159 void yy_delete_buffer( YY_BUFFER_STATE b )
1161 void yy_delete_buffer( b )
1165 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1171 if ( b == yy_current_buffer )
1172 yy_current_buffer = (YY_BUFFER_STATE) 0;
1174 if ( b->yy_is_our_buffer )
1175 yy_flex_free( (void *) b->yy_ch_buf );
1177 yy_flex_free( (void *) b );
1182 #ifndef YY_ALWAYS_INTERACTIVE
1183 #ifndef YY_NEVER_INTERACTIVE
1184 extern int isatty YY_PROTO(( int ));
1188 #ifdef YY_USE_PROTOS
1189 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1191 void yy_init_buffer( b, file )
1197 extern "C" int isatty YY_PROTO(( int ));
1198 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1202 yy_flush_buffer( b );
1204 b->yy_input_file = file;
1205 b->yy_fill_buffer = 1;
1208 #if YY_ALWAYS_INTERACTIVE
1209 b->yy_is_interactive = 1;
1211 #if YY_NEVER_INTERACTIVE
1212 b->yy_is_interactive = 0;
1214 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1218 b->yy_is_interactive = 0;
1224 #ifdef YY_USE_PROTOS
1225 void yy_flush_buffer( YY_BUFFER_STATE b )
1227 void yy_flush_buffer( b )
1232 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1240 /* We always need two end-of-buffer characters. The first causes
1241 * a transition to the end-of-buffer state. The second causes
1242 * a jam in that state.
1244 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1245 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1247 b->yy_buf_pos = &b->yy_ch_buf[0];
1250 b->yy_buffer_status = YY_BUFFER_NEW;
1252 if ( b == yy_current_buffer )
1253 yy_load_buffer_state();
1258 #ifndef YY_NO_SCAN_BUFFER
1260 #ifdef YY_USE_PROTOS
1261 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1263 YY_BUFFER_STATE yy_scan_buffer( base, size )
1271 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1272 base[size-1] != YY_END_OF_BUFFER_CHAR )
1273 /* They forgot to leave room for the EOB's. */
1276 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1278 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1280 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1281 b->yy_buf_pos = b->yy_ch_buf = base;
1282 b->yy_is_our_buffer = 0;
1283 b->yy_input_file = 0;
1284 b->yy_n_chars = b->yy_buf_size;
1285 b->yy_is_interactive = 0;
1287 b->yy_fill_buffer = 0;
1288 b->yy_buffer_status = YY_BUFFER_NEW;
1290 yy_switch_to_buffer( b );
1298 #ifndef YY_NO_SCAN_STRING
1300 #ifdef YY_USE_PROTOS
1301 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1303 YY_BUFFER_STATE yy_scan_string( yy_str )
1304 yyconst char *yy_str;
1308 for ( len = 0; yy_str[len]; ++len )
1311 return yy_scan_bytes( yy_str, len );
1317 #ifndef YY_NO_SCAN_BYTES
1319 #ifdef YY_USE_PROTOS
1320 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1322 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1323 yyconst char *bytes;
1332 /* Get memory for full buffer, including space for trailing EOB's. */
1334 buf = (char *) yy_flex_alloc( n );
1336 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1338 for ( i = 0; i < len; ++i )
1341 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1343 b = yy_scan_buffer( buf, n );
1345 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1347 /* It's okay to grow etc. this buffer, and we should throw it
1348 * away when we're done.
1350 b->yy_is_our_buffer = 1;
1358 #ifndef YY_NO_PUSH_STATE
1360 #ifdef YY_USE_PROTOS
1361 static void yy_push_state( int new_state )
1363 static void yy_push_state( new_state )
1367 void yyFlexLexer::yy_push_state( int new_state )
1370 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1374 yy_start_stack_depth += YY_START_STACK_INCR;
1375 new_size = yy_start_stack_depth * sizeof( int );
1377 if ( ! yy_start_stack )
1378 yy_start_stack = (int *) yy_flex_alloc( new_size );
1381 yy_start_stack = (int *) yy_flex_realloc(
1382 (void *) yy_start_stack, new_size );
1384 if ( ! yy_start_stack )
1386 "out of memory expanding start-condition stack" );
1389 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1396 #ifndef YY_NO_POP_STATE
1398 static void yy_pop_state()
1400 void yyFlexLexer::yy_pop_state()
1403 if ( --yy_start_stack_ptr < 0 )
1404 YY_FATAL_ERROR( "start-condition stack underflow" );
1406 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1411 #ifndef YY_NO_TOP_STATE
1413 static int yy_top_state()
1415 int yyFlexLexer::yy_top_state()
1418 return yy_start_stack[yy_start_stack_ptr - 1];
1422 #ifndef YY_EXIT_FAILURE
1423 #define YY_EXIT_FAILURE 2
1427 #ifdef YY_USE_PROTOS
1428 static void yy_fatal_error( yyconst char msg[] )
1430 static void yy_fatal_error( msg )
1434 (void) fprintf( stderr, "%s\n", msg );
1435 exit( YY_EXIT_FAILURE );
1440 void yyFlexLexer::LexerError( yyconst char msg[] )
1442 cerr << msg << '\n';
1443 exit( YY_EXIT_FAILURE );
1448 /* Redefine yyless() so it works in section 3 code. */
1454 /* Undo effects of setting up yytext. */ \
1455 yytext[yyleng] = yy_hold_char; \
1456 yy_c_buf_p = yytext + n; \
1457 yy_hold_char = *yy_c_buf_p; \
1458 *yy_c_buf_p = '\0'; \
1464 /* Internal utility routines. */
1467 #ifdef YY_USE_PROTOS
1468 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1470 static void yy_flex_strncpy( s1, s2, n )
1477 for ( i = 0; i < n; ++i )
1482 #ifdef YY_NEED_STRLEN
1483 #ifdef YY_USE_PROTOS
1484 static int yy_flex_strlen( yyconst char *s )
1486 static int yy_flex_strlen( s )
1491 for ( n = 0; s[n]; ++n )
1499 #ifdef YY_USE_PROTOS
1500 static void *yy_flex_alloc( yy_size_t size )
1502 static void *yy_flex_alloc( size )
1506 return (void *) malloc( size );
1509 #ifdef YY_USE_PROTOS
1510 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1512 static void *yy_flex_realloc( ptr, size )
1517 /* The cast to (char *) in the following accommodates both
1518 * implementations that use char* generic pointers, and those
1519 * that use void* generic pointers. It works with the latter
1520 * because both ANSI C and C++ allow castless assignment from
1521 * any pointer type to void*, and deal with argument conversions
1522 * as though doing an assignment.
1524 return (void *) realloc( (char *) ptr, size );
1527 #ifdef YY_USE_PROTOS
1528 static void yy_flex_free( void *ptr )
1530 static void yy_flex_free( ptr )