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.7 2008/05/01 20:01:24 swildner 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" */
35 /* Use prototypes in function declarations. */
38 /* The "const" storage-class-modifier is valid. */
41 #else /* ! __cplusplus */
51 #endif /* ! __cplusplus */
61 #define YY_PROTO(proto) proto
63 #define YY_PROTO(proto) ()
66 /* Returned upon end-of-file. */
69 /* Promotes a possibly negative, possibly signed char to an unsigned
70 * integer for use as an array index. If the signed char is negative,
71 * we want to instead treat it as an 8-bit unsigned char, hence the
74 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
76 /* Enter a start condition. This macro really ought to take a parameter,
77 * but we do it the disgusting crufty way forced on us by the ()-less
78 * definition of BEGIN.
80 #define BEGIN yy_start = 1 + 2 *
82 /* Translate the current start state into a value that can be later handed
83 * to BEGIN to return to the state. The YYSTATE alias is for lex
86 #define YY_START ((yy_start - 1) / 2)
87 #define YYSTATE YY_START
89 /* Action number for EOF rule of a given start state. */
90 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
92 /* Special action meaning "start processing a new file". */
93 #define YY_NEW_FILE yyrestart( yyin )
95 #define YY_END_OF_BUFFER_CHAR 0
97 /* Size of default input buffer. */
98 #define YY_BUF_SIZE 16384
100 typedef struct yy_buffer_state *YY_BUFFER_STATE;
104 extern FILE *yyin, *yyout;
107 #define EOB_ACT_CONTINUE_SCAN 0
108 #define EOB_ACT_END_OF_FILE 1
109 #define EOB_ACT_LAST_MATCH 2
111 /* The funky do-while in the following #define is used to turn the definition
112 * int a single C statement (which needs a semi-colon terminator). This
113 * avoids problems with code like:
115 * if ( condition_holds )
118 * do_something_else();
120 * Prior to using the do-while the compiler would get upset at the
121 * "else" because it interpreted the "if" statement as being all
122 * done when it reached the ';' after the yyless() call.
125 /* Return all but the first 'n' matched characters back to the input stream. */
130 /* Undo effects of setting up yytext. */ \
131 *yy_cp = yy_hold_char; \
132 YY_RESTORE_YY_MORE_OFFSET \
133 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
134 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
138 #define unput(c) yyunput( c, yytext_ptr )
140 /* The following is because we cannot portably get our hands on size_t
141 * (without autoconf's help, which isn't available because we want
142 * flex-generated scanners to compile on their own).
144 typedef unsigned int yy_size_t;
147 struct yy_buffer_state
152 istream* yy_input_file;
155 char *yy_ch_buf; /* input buffer */
156 char *yy_buf_pos; /* current position in input buffer */
158 /* Size of input buffer in bytes, not including room for EOB
161 yy_size_t yy_buf_size;
163 /* Number of characters read into yy_ch_buf, not including EOB
168 /* Whether we "own" the buffer - i.e., we know we created it,
169 * and can realloc() it to grow it, and should free() it to
172 int yy_is_our_buffer;
174 /* Whether this is an "interactive" input source; if so, and
175 * if we're using stdio for input, then we want to use getc()
176 * instead of fread(), to make sure we stop fetching input after
179 int yy_is_interactive;
181 /* Whether we're considered to be at the beginning of a line.
182 * If so, '^' rules will be active on the next match, otherwise
187 /* Whether to try to fill the input buffer when we reach the
192 int yy_buffer_status;
193 #define YY_BUFFER_NEW 0
194 #define YY_BUFFER_NORMAL 1
195 /* When an EOF's been seen but there's still some text to process
196 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
197 * shouldn't try reading from the input source any more. We might
198 * still have a bunch of tokens to match, though, because of
199 * possible backing-up.
201 * When we actually see the EOF, we change the status to "new"
202 * (via yyrestart()), so that the user can continue scanning by
203 * just pointing yyin at a new input file.
205 #define YY_BUFFER_EOF_PENDING 2
208 %- Standard (non-C++) definition
209 static YY_BUFFER_STATE yy_current_buffer = 0;
212 /* We provide macros for accessing buffer states in case in the
213 * future we want to put the buffer states in a more general
216 #define YY_CURRENT_BUFFER yy_current_buffer
219 %- Standard (non-C++) definition
220 /* yy_hold_char holds the character lost when yytext is formed. */
221 static char yy_hold_char;
223 static int yy_n_chars; /* number of characters read into yy_ch_buf */
228 /* Points to current character in buffer. */
229 static char *yy_c_buf_p = (char *) 0;
230 static int yy_init = 1; /* whether we need to initialize */
231 static int yy_start = 0; /* start state number */
233 /* Flag which is used to allow yywrap()'s to do buffer switches
234 * instead of setting up a fresh yyin. A bit of a hack ...
236 static int yy_did_buffer_switch_on_eof;
238 void yyrestart YY_PROTO(( FILE *input_file ));
240 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
241 void yy_load_buffer_state YY_PROTO(( void ));
242 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
243 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
244 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
245 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
246 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
248 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
249 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
250 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
253 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
254 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ))
256 __attribute__((__unused__))
259 static void yy_flex_free YY_PROTO(( void * ));
261 #define yy_new_buffer yy_create_buffer
263 #define yy_set_interactive(is_interactive) \
265 if ( ! yy_current_buffer ) \
266 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
267 yy_current_buffer->yy_is_interactive = is_interactive; \
270 #define yy_set_bol(at_bol) \
272 if ( ! yy_current_buffer ) \
273 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
274 yy_current_buffer->yy_at_bol = at_bol; \
277 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
279 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
281 %- Standard (non-C++) definition
282 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
283 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
284 static int yy_get_next_buffer YY_PROTO(( void ));
285 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
288 /* Done after the current pattern has been matched and before the
289 * corresponding action - sets up yytext.
291 #define YY_DO_BEFORE_ACTION \
292 yytext_ptr = yy_bp; \
293 %% code to fiddle yytext and yyleng for yymore() goes here
294 yy_hold_char = *yy_cp; \
296 %% code to copy yytext_ptr to yytext[] goes here, if %array
299 %% data tables for the DFA and the user's section 1 definitions go here
301 /* Macros after this point can all be overridden by user definitions in
305 #ifndef YY_SKIP_YYWRAP
307 extern "C" int yywrap YY_PROTO(( void ));
309 extern int yywrap YY_PROTO(( void ));
315 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
320 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
323 #ifdef YY_NEED_STRLEN
324 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
328 %- Standard (non-C++) definition
330 static int yyinput YY_PROTO(( void ));
332 static int input YY_PROTO(( void ));
338 static int yy_start_stack_ptr = 0;
339 static int yy_start_stack_depth = 0;
340 static int *yy_start_stack = 0;
341 #ifndef YY_NO_PUSH_STATE
342 static void yy_push_state YY_PROTO(( int new_state ));
344 #ifndef YY_NO_POP_STATE
345 static void yy_pop_state YY_PROTO(( void ));
347 #ifndef YY_NO_TOP_STATE
348 static int yy_top_state YY_PROTO(( void ));
352 #define YY_NO_PUSH_STATE 1
353 #define YY_NO_POP_STATE 1
354 #define YY_NO_TOP_STATE 1
357 #ifdef YY_MALLOC_DECL
365 /* Just try to get by without declaring the routines. This will fail
366 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
367 * or sizeof(void*) != sizeof(int).
372 /* Amount of stuff to slurp up with each read. */
373 #ifndef YY_READ_BUF_SIZE
374 #define YY_READ_BUF_SIZE 8192
377 /* Copy whatever the last rule matched to the standard output. */
380 %- Standard (non-C++) definition
381 /* This used to be an fputs(), but since the string might contain NUL's,
382 * we now use fwrite().
384 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
386 #define ECHO LexerOutput( yytext, yyleng )
390 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
391 * is returned in "result".
394 #define YY_INPUT(buf,result,max_size) \
395 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
397 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
398 YY_FATAL_ERROR( "input in flex scanner failed" );
402 /* No semi-colon after return; correct usage is to write "yyterminate();" -
403 * we don't want an extra ';' after the "return" because that will cause
404 * some compilers to complain about unreachable statements.
407 #define yyterminate() return YY_NULL
410 /* Number of entries by which start-condition stack grows. */
411 #ifndef YY_START_STACK_INCR
412 #define YY_START_STACK_INCR 25
415 /* Report a fatal error. */
416 #ifndef YY_FATAL_ERROR
418 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
420 #define YY_FATAL_ERROR(msg) LexerError( msg )
424 /* Default declaration of generated scanner - a define so the user can
425 * easily add parameters.
428 %- Standard (non-C++) definition
429 #define YY_DECL int yylex YY_PROTO(( void ))
431 #define YY_DECL int yyFlexLexer::yylex()
435 /* Code executed at the beginning of each rule, after yytext and yyleng
438 #ifndef YY_USER_ACTION
439 #define YY_USER_ACTION
442 /* Code executed at the end of each rule. */
444 #define YY_BREAK break;
447 %% YY_RULE_SETUP definition goes here
451 register yy_state_type yy_current_state;
452 register char *yy_cp, *yy_bp;
455 %% user's declarations go here
466 yy_start = 1; /* first start state */
482 if ( ! yy_current_buffer )
484 yy_create_buffer( yyin, YY_BUF_SIZE );
486 yy_load_buffer_state();
489 while ( 1 ) /* loops until end-of-file is reached */
491 %% yymore()-related code goes here
494 /* Support of yytext. */
495 *yy_cp = yy_hold_char;
497 /* yy_bp points to the position in yy_ch_buf of the start of
502 %% code to set up and find next match goes here
505 %% code to find the action number goes here
509 %% code for yylineno update goes here
511 do_action: /* This label is used only to access EOF actions. */
513 %% debug code goes here
516 { /* beginning of action switch */
519 case YY_END_OF_BUFFER:
521 /* Amount of text matched not including the EOB char. */
522 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
524 /* Undo the effects of YY_DO_BEFORE_ACTION. */
525 *yy_cp = yy_hold_char;
526 YY_RESTORE_YY_MORE_OFFSET
528 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
530 /* We're scanning a new file or input source. It's
531 * possible that this happened because the user
532 * just pointed yyin at a new source and called
533 * yylex(). If so, then we have to assure
534 * consistency between yy_current_buffer and our
535 * globals. Here is the right place to do so, because
536 * this is the first action (other than possibly a
537 * back-up) that will match for the new input source.
539 yy_n_chars = yy_current_buffer->yy_n_chars;
540 yy_current_buffer->yy_input_file = yyin;
541 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
544 /* Note that here we test for yy_c_buf_p "<=" to the position
545 * of the first EOB in the buffer, since yy_c_buf_p will
546 * already have been incremented past the NUL character
547 * (since all states make transitions on EOB to the
548 * end-of-buffer state). Contrast this with the test
551 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
552 { /* This was really a NUL. */
553 yy_state_type yy_next_state;
555 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
557 yy_current_state = yy_get_previous_state();
559 /* Okay, we're now positioned to make the NUL
560 * transition. We couldn't have
561 * yy_get_previous_state() go ahead and do it
562 * for us because it doesn't know how to deal
563 * with the possibility of jamming (and we don't
564 * want to build jamming into it because then it
565 * will run more slowly).
568 yy_next_state = yy_try_NUL_trans( yy_current_state );
570 yy_bp = yytext_ptr + YY_MORE_ADJ;
574 /* Consume the NUL. */
575 yy_cp = ++yy_c_buf_p;
576 yy_current_state = yy_next_state;
582 %% code to do back-up for compressed tables and set up yy_cp goes here
587 else switch ( yy_get_next_buffer() )
589 case EOB_ACT_END_OF_FILE:
591 yy_did_buffer_switch_on_eof = 0;
595 /* Note: because we've taken care in
596 * yy_get_next_buffer() to have set up
597 * yytext, we can now set up
598 * yy_c_buf_p so that if some total
599 * hoser (like flex itself) wants to
600 * call the scanner after we return the
601 * YY_NULL, it'll still work - another
602 * YY_NULL will get returned.
604 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
606 yy_act = YY_STATE_EOF(YY_START);
612 if ( ! yy_did_buffer_switch_on_eof )
618 case EOB_ACT_CONTINUE_SCAN:
620 yytext_ptr + yy_amount_of_matched_text;
622 yy_current_state = yy_get_previous_state();
625 yy_bp = yytext_ptr + YY_MORE_ADJ;
628 case EOB_ACT_LAST_MATCH:
630 &yy_current_buffer->yy_ch_buf[yy_n_chars];
632 yy_current_state = yy_get_previous_state();
635 yy_bp = yytext_ptr + YY_MORE_ADJ;
643 "fatal flex scanner internal error--no action found" );
644 } /* end of action switch */
645 } /* end of scanning one token */
649 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
657 yylineno = 1; // this will only get updated if %option yylineno
659 yy_did_buffer_switch_on_eof = 0;
661 yy_looking_for_trail_begin = 0;
664 yy_more_offset = yy_prev_more_offset = 0;
666 yy_start_stack_ptr = yy_start_stack_depth = 0;
669 yy_current_buffer = 0;
671 #ifdef YY_USES_REJECT
672 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
678 yyFlexLexer::~yyFlexLexer()
681 yy_delete_buffer( yy_current_buffer );
684 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
688 yy_delete_buffer( yy_current_buffer );
689 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
696 #ifdef YY_INTERACTIVE
697 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
699 int yyFlexLexer::LexerInput( char* buf, int max_size )
702 if ( yyin->eof() || yyin->fail() )
705 #ifdef YY_INTERACTIVE
717 (void) yyin->read( buf, max_size );
722 return yyin->gcount();
726 void yyFlexLexer::LexerOutput( const char* buf, int size )
728 (void) yyout->write( buf, size );
732 /* yy_get_next_buffer - try to read in a new buffer
734 * Returns a code representing an action:
735 * EOB_ACT_LAST_MATCH -
736 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
737 * EOB_ACT_END_OF_FILE - end of file
741 static int yy_get_next_buffer()
743 int yyFlexLexer::yy_get_next_buffer()
746 register char *dest = yy_current_buffer->yy_ch_buf;
747 register char *source = yytext_ptr;
748 register int number_to_move, i;
751 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
753 "fatal flex scanner internal error--end of buffer missed" );
755 if ( yy_current_buffer->yy_fill_buffer == 0 )
756 { /* Don't try to fill the buffer, so this is an EOF. */
757 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
759 /* We matched a single character, the EOB, so
760 * treat this as a final EOF.
762 return EOB_ACT_END_OF_FILE;
767 /* We matched some text prior to the EOB, first
770 return EOB_ACT_LAST_MATCH;
774 /* Try to read more data. */
776 /* First move last chars to start of buffer. */
777 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
779 for ( i = 0; i < number_to_move; ++i )
780 *(dest++) = *(source++);
782 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
783 /* don't do the read, it's not guaranteed to return an EOF,
786 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
791 yy_current_buffer->yy_buf_size - number_to_move - 1;
793 while ( num_to_read <= 0 )
794 { /* Not enough room in the buffer - grow it. */
795 #ifdef YY_USES_REJECT
797 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
800 /* just a shorter name for the current buffer */
801 YY_BUFFER_STATE b = yy_current_buffer;
803 int yy_c_buf_p_offset =
804 (int) (yy_c_buf_p - b->yy_ch_buf);
806 if ( b->yy_is_our_buffer )
808 int new_size = b->yy_buf_size * 2;
811 b->yy_buf_size += b->yy_buf_size / 8;
815 b->yy_ch_buf = (char *)
816 /* Include room in for 2 EOB chars. */
817 yy_flex_realloc( (void *) b->yy_ch_buf,
818 b->yy_buf_size + 2 );
821 /* Can't grow it, we don't own it. */
824 if ( ! b->yy_ch_buf )
826 "fatal error - scanner input buffer overflow" );
828 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
830 num_to_read = yy_current_buffer->yy_buf_size -
835 if ( num_to_read > YY_READ_BUF_SIZE )
836 num_to_read = YY_READ_BUF_SIZE;
838 /* Read in more data. */
839 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
840 yy_n_chars, num_to_read );
842 yy_current_buffer->yy_n_chars = yy_n_chars;
845 if ( yy_n_chars == 0 )
847 if ( number_to_move == YY_MORE_ADJ )
849 ret_val = EOB_ACT_END_OF_FILE;
855 ret_val = EOB_ACT_LAST_MATCH;
856 yy_current_buffer->yy_buffer_status =
857 YY_BUFFER_EOF_PENDING;
862 ret_val = EOB_ACT_CONTINUE_SCAN;
864 yy_n_chars += number_to_move;
865 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
866 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
868 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
874 /* yy_get_previous_state - get the state just before the EOB char was reached */
877 static yy_state_type yy_get_previous_state()
879 yy_state_type yyFlexLexer::yy_get_previous_state()
882 register yy_state_type yy_current_state;
883 register char *yy_cp;
885 %% code to get the start state into yy_current_state goes here
887 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
889 %% code to find the next state goes here
892 return yy_current_state;
896 /* yy_try_NUL_trans - try to make a transition on the NUL character
899 * next_state = yy_try_NUL_trans( current_state );
904 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
906 static yy_state_type yy_try_NUL_trans( yy_current_state )
907 yy_state_type yy_current_state;
910 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
913 register int yy_is_jam;
914 %% code to find the next state, and perhaps do backing up, goes here
916 return yy_is_jam ? 0 : yy_current_state;
923 static void yyunput( int c, register char *yy_bp )
925 static void yyunput( c, yy_bp )
927 register char *yy_bp;
930 void yyFlexLexer::yyunput( int c, register char* yy_bp )
933 register char *yy_cp = yy_c_buf_p;
935 /* undo effects of setting up yytext */
936 *yy_cp = yy_hold_char;
938 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
939 { /* need to shift things up to make room */
940 /* +2 for EOB chars. */
941 register int number_to_move = yy_n_chars + 2;
942 register char *dest = &yy_current_buffer->yy_ch_buf[
943 yy_current_buffer->yy_buf_size + 2];
944 register char *source =
945 &yy_current_buffer->yy_ch_buf[number_to_move];
947 while ( source > yy_current_buffer->yy_ch_buf )
950 yy_cp += (int) (dest - source);
951 yy_bp += (int) (dest - source);
952 yy_current_buffer->yy_n_chars =
953 yy_n_chars = yy_current_buffer->yy_buf_size;
955 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
956 YY_FATAL_ERROR( "flex scanner push-back overflow" );
961 %% update yylineno here
964 yy_hold_char = *yy_cp;
968 #endif /* ifndef YY_NO_UNPUT */
979 int yyFlexLexer::yyinput()
984 *yy_c_buf_p = yy_hold_char;
986 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
988 /* yy_c_buf_p now points to the character we want to return.
989 * If this occurs *before* the EOB characters, then it's a
990 * valid NUL; if not, then we've hit the end of the buffer.
992 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
993 /* This was really a NUL. */
997 { /* need more input */
998 int offset = yy_c_buf_p - yytext_ptr;
1001 switch ( yy_get_next_buffer() )
1003 case EOB_ACT_LAST_MATCH:
1004 /* This happens because yy_g_n_b()
1005 * sees that we've accumulated a
1006 * token and flags that we need to
1007 * try matching the token before
1008 * proceeding. But for input(),
1009 * there's no matching to consider.
1010 * So convert the EOB_ACT_LAST_MATCH
1011 * to EOB_ACT_END_OF_FILE.
1014 /* Reset buffer status. */
1019 case EOB_ACT_END_OF_FILE:
1024 if ( ! yy_did_buffer_switch_on_eof )
1033 case EOB_ACT_CONTINUE_SCAN:
1034 yy_c_buf_p = yytext_ptr + offset;
1040 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1041 *yy_c_buf_p = '\0'; /* preserve yytext */
1042 yy_hold_char = *++yy_c_buf_p;
1044 %% update BOL and yylineno
1051 #ifdef YY_USE_PROTOS
1052 void yyrestart( FILE *input_file )
1054 void yyrestart( input_file )
1058 void yyFlexLexer::yyrestart( istream* input_file )
1061 if ( ! yy_current_buffer )
1062 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1064 yy_init_buffer( yy_current_buffer, input_file );
1065 yy_load_buffer_state();
1070 #ifdef YY_USE_PROTOS
1071 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1073 void yy_switch_to_buffer( new_buffer )
1074 YY_BUFFER_STATE new_buffer;
1077 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1080 if ( yy_current_buffer == new_buffer )
1083 if ( yy_current_buffer )
1085 /* Flush out information for old buffer. */
1086 *yy_c_buf_p = yy_hold_char;
1087 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1088 yy_current_buffer->yy_n_chars = yy_n_chars;
1091 yy_current_buffer = new_buffer;
1092 yy_load_buffer_state();
1094 /* We don't actually know whether we did this switch during
1095 * EOF (yywrap()) processing, but the only time this flag
1096 * is looked at is after yywrap() is called, so it's safe
1097 * to go ahead and always set it.
1099 yy_did_buffer_switch_on_eof = 1;
1104 #ifdef YY_USE_PROTOS
1105 void yy_load_buffer_state( void )
1107 void yy_load_buffer_state()
1110 void yyFlexLexer::yy_load_buffer_state()
1113 yy_n_chars = yy_current_buffer->yy_n_chars;
1114 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1115 yyin = yy_current_buffer->yy_input_file;
1116 yy_hold_char = *yy_c_buf_p;
1121 #ifdef YY_USE_PROTOS
1122 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1124 YY_BUFFER_STATE yy_create_buffer( file, size )
1129 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1134 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1136 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1138 b->yy_buf_size = size;
1140 /* yy_ch_buf has to be 2 characters longer than the size given because
1141 * we need to put in 2 end-of-buffer characters.
1143 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1144 if ( ! b->yy_ch_buf )
1145 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1147 b->yy_is_our_buffer = 1;
1149 yy_init_buffer( b, file );
1156 #ifdef YY_USE_PROTOS
1157 void yy_delete_buffer( YY_BUFFER_STATE b )
1159 void yy_delete_buffer( b )
1163 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1169 if ( b == yy_current_buffer )
1170 yy_current_buffer = (YY_BUFFER_STATE) 0;
1172 if ( b->yy_is_our_buffer )
1173 yy_flex_free( (void *) b->yy_ch_buf );
1175 yy_flex_free( (void *) b );
1180 #ifdef YY_USE_PROTOS
1181 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1183 void yy_init_buffer( b, file )
1189 extern "C" int isatty YY_PROTO(( int ));
1190 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1194 yy_flush_buffer( b );
1196 b->yy_input_file = file;
1197 b->yy_fill_buffer = 1;
1200 #if YY_ALWAYS_INTERACTIVE
1201 b->yy_is_interactive = 1;
1203 #if YY_NEVER_INTERACTIVE
1204 b->yy_is_interactive = 0;
1206 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1210 b->yy_is_interactive = 0;
1216 #ifdef YY_USE_PROTOS
1217 void yy_flush_buffer( YY_BUFFER_STATE b )
1219 void yy_flush_buffer( b )
1224 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1232 /* We always need two end-of-buffer characters. The first causes
1233 * a transition to the end-of-buffer state. The second causes
1234 * a jam in that state.
1236 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1237 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1239 b->yy_buf_pos = &b->yy_ch_buf[0];
1242 b->yy_buffer_status = YY_BUFFER_NEW;
1244 if ( b == yy_current_buffer )
1245 yy_load_buffer_state();
1250 #ifndef YY_NO_SCAN_BUFFER
1252 #ifdef YY_USE_PROTOS
1253 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1255 YY_BUFFER_STATE yy_scan_buffer( base, size )
1263 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1264 base[size-1] != YY_END_OF_BUFFER_CHAR )
1265 /* They forgot to leave room for the EOB's. */
1268 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1270 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1272 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1273 b->yy_buf_pos = b->yy_ch_buf = base;
1274 b->yy_is_our_buffer = 0;
1275 b->yy_input_file = 0;
1276 b->yy_n_chars = b->yy_buf_size;
1277 b->yy_is_interactive = 0;
1279 b->yy_fill_buffer = 0;
1280 b->yy_buffer_status = YY_BUFFER_NEW;
1282 yy_switch_to_buffer( b );
1290 #ifndef YY_NO_SCAN_STRING
1292 #ifdef YY_USE_PROTOS
1293 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1295 YY_BUFFER_STATE yy_scan_string( yy_str )
1296 yyconst char *yy_str;
1300 for ( len = 0; yy_str[len]; ++len )
1303 return yy_scan_bytes( yy_str, len );
1309 #ifndef YY_NO_SCAN_BYTES
1311 #ifdef YY_USE_PROTOS
1312 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1314 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1315 yyconst char *bytes;
1324 /* Get memory for full buffer, including space for trailing EOB's. */
1326 buf = (char *) yy_flex_alloc( n );
1328 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1330 for ( i = 0; i < len; ++i )
1333 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1335 b = yy_scan_buffer( buf, n );
1337 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1339 /* It's okay to grow etc. this buffer, and we should throw it
1340 * away when we're done.
1342 b->yy_is_our_buffer = 1;
1350 #ifndef YY_NO_PUSH_STATE
1352 #ifdef YY_USE_PROTOS
1353 static void yy_push_state( int new_state )
1355 static void yy_push_state( new_state )
1359 void yyFlexLexer::yy_push_state( int new_state )
1362 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1366 yy_start_stack_depth += YY_START_STACK_INCR;
1367 new_size = yy_start_stack_depth * sizeof( int );
1369 if ( ! yy_start_stack )
1370 yy_start_stack = (int *) yy_flex_alloc( new_size );
1373 yy_start_stack = (int *) yy_flex_realloc(
1374 (void *) yy_start_stack, new_size );
1376 if ( ! yy_start_stack )
1378 "out of memory expanding start-condition stack" );
1381 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1388 #ifndef YY_NO_POP_STATE
1390 static void yy_pop_state()
1392 void yyFlexLexer::yy_pop_state()
1395 if ( --yy_start_stack_ptr < 0 )
1396 YY_FATAL_ERROR( "start-condition stack underflow" );
1398 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1403 #ifndef YY_NO_TOP_STATE
1405 static int yy_top_state()
1407 int yyFlexLexer::yy_top_state()
1410 return yy_start_stack[yy_start_stack_ptr - 1];
1414 #ifndef YY_EXIT_FAILURE
1415 #define YY_EXIT_FAILURE 2
1419 #ifdef YY_USE_PROTOS
1420 static void yy_fatal_error( yyconst char msg[] )
1422 static void yy_fatal_error( msg )
1426 (void) fprintf( stderr, "%s\n", msg );
1427 exit( YY_EXIT_FAILURE );
1432 void yyFlexLexer::LexerError( yyconst char msg[] )
1434 cerr << msg << '\n';
1435 exit( YY_EXIT_FAILURE );
1440 /* Redefine yyless() so it works in section 3 code. */
1446 /* Undo effects of setting up yytext. */ \
1447 yytext[yyleng] = yy_hold_char; \
1448 yy_c_buf_p = yytext + n; \
1449 yy_hold_char = *yy_c_buf_p; \
1450 *yy_c_buf_p = '\0'; \
1456 /* Internal utility routines. */
1459 #ifdef YY_USE_PROTOS
1460 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1462 static void yy_flex_strncpy( s1, s2, n )
1469 for ( i = 0; i < n; ++i )
1474 #ifdef YY_NEED_STRLEN
1475 #ifdef YY_USE_PROTOS
1476 static int yy_flex_strlen( yyconst char *s )
1478 static int yy_flex_strlen( s )
1483 for ( n = 0; s[n]; ++n )
1491 #ifdef YY_USE_PROTOS
1492 static void *yy_flex_alloc( yy_size_t size )
1494 static void *yy_flex_alloc( size )
1498 return (void *) malloc( size );
1501 #ifdef YY_USE_PROTOS
1502 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1504 static void *yy_flex_realloc( ptr, size )
1509 /* The cast to (char *) in the following accommodates both
1510 * implementations that use char* generic pointers, and those
1511 * that use void* generic pointers. It works with the latter
1512 * because both ANSI C and C++ allow castless assignment from
1513 * any pointer type to void*, and deal with argument conversions
1514 * as though doing an assignment.
1516 return (void *) realloc( (char *) ptr, size );
1519 #ifdef YY_USE_PROTOS
1520 static void yy_flex_free( void *ptr )
1522 static void yy_flex_free( ptr )