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.4 2005/03/02 07:09:38 joerg 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 */
58 #define YY_PROTO(proto) proto
60 #define YY_PROTO(proto) ()
63 /* Returned upon end-of-file. */
66 /* Promotes a possibly negative, possibly signed char to an unsigned
67 * integer for use as an array index. If the signed char is negative,
68 * we want to instead treat it as an 8-bit unsigned char, hence the
71 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
73 /* Enter a start condition. This macro really ought to take a parameter,
74 * but we do it the disgusting crufty way forced on us by the ()-less
75 * definition of BEGIN.
77 #define BEGIN yy_start = 1 + 2 *
79 /* Translate the current start state into a value that can be later handed
80 * to BEGIN to return to the state. The YYSTATE alias is for lex
83 #define YY_START ((yy_start - 1) / 2)
84 #define YYSTATE YY_START
86 /* Action number for EOF rule of a given start state. */
87 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
89 /* Special action meaning "start processing a new file". */
90 #define YY_NEW_FILE yyrestart( yyin )
92 #define YY_END_OF_BUFFER_CHAR 0
94 /* Size of default input buffer. */
95 #define YY_BUF_SIZE 16384
97 typedef struct yy_buffer_state *YY_BUFFER_STATE;
101 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
149 istream* yy_input_file;
152 char *yy_ch_buf; /* input buffer */
153 char *yy_buf_pos; /* current position in input buffer */
155 /* Size of input buffer in bytes, not including room for EOB
158 yy_size_t yy_buf_size;
160 /* Number of characters read into yy_ch_buf, not including EOB
165 /* Whether we "own" the buffer - i.e., we know we created it,
166 * and can realloc() it to grow it, and should free() it to
169 int yy_is_our_buffer;
171 /* Whether this is an "interactive" input source; if so, and
172 * if we're using stdio for input, then we want to use getc()
173 * instead of fread(), to make sure we stop fetching input after
176 int yy_is_interactive;
178 /* Whether we're considered to be at the beginning of a line.
179 * If so, '^' rules will be active on the next match, otherwise
184 /* Whether to try to fill the input buffer when we reach the
189 int yy_buffer_status;
190 #define YY_BUFFER_NEW 0
191 #define YY_BUFFER_NORMAL 1
192 /* When an EOF's been seen but there's still some text to process
193 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
194 * shouldn't try reading from the input source any more. We might
195 * still have a bunch of tokens to match, though, because of
196 * possible backing-up.
198 * When we actually see the EOF, we change the status to "new"
199 * (via yyrestart()), so that the user can continue scanning by
200 * just pointing yyin at a new input file.
202 #define YY_BUFFER_EOF_PENDING 2
205 %- Standard (non-C++) definition
206 static YY_BUFFER_STATE yy_current_buffer = 0;
209 /* We provide macros for accessing buffer states in case in the
210 * future we want to put the buffer states in a more general
213 #define YY_CURRENT_BUFFER yy_current_buffer
216 %- Standard (non-C++) definition
217 /* yy_hold_char holds the character lost when yytext is formed. */
218 static char yy_hold_char;
220 static int yy_n_chars; /* number of characters read into yy_ch_buf */
225 /* Points to current character in buffer. */
226 static char *yy_c_buf_p = (char *) 0;
227 static int yy_init = 1; /* whether we need to initialize */
228 static int yy_start = 0; /* start state number */
230 /* Flag which is used to allow yywrap()'s to do buffer switches
231 * instead of setting up a fresh yyin. A bit of a hack ...
233 static int yy_did_buffer_switch_on_eof;
235 void yyrestart YY_PROTO(( FILE *input_file ));
237 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
238 void yy_load_buffer_state YY_PROTO(( void ));
239 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
240 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
241 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
242 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
243 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
245 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
246 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
247 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
250 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
251 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
252 static void yy_flex_free YY_PROTO(( void * ));
254 #define yy_new_buffer yy_create_buffer
256 #define yy_set_interactive(is_interactive) \
258 if ( ! yy_current_buffer ) \
259 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
260 yy_current_buffer->yy_is_interactive = is_interactive; \
263 #define yy_set_bol(at_bol) \
265 if ( ! yy_current_buffer ) \
266 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
267 yy_current_buffer->yy_at_bol = at_bol; \
270 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
272 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
274 %- Standard (non-C++) definition
275 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
276 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
277 static int yy_get_next_buffer YY_PROTO(( void ));
278 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
281 /* Done after the current pattern has been matched and before the
282 * corresponding action - sets up yytext.
284 #define YY_DO_BEFORE_ACTION \
285 yytext_ptr = yy_bp; \
286 %% code to fiddle yytext and yyleng for yymore() goes here
287 yy_hold_char = *yy_cp; \
289 %% code to copy yytext_ptr to yytext[] goes here, if %array
292 %% data tables for the DFA and the user's section 1 definitions go here
294 /* Macros after this point can all be overridden by user definitions in
298 #ifndef YY_SKIP_YYWRAP
300 extern "C" int yywrap YY_PROTO(( void ));
302 extern int yywrap YY_PROTO(( void ));
308 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
313 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
316 #ifdef YY_NEED_STRLEN
317 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
321 %- Standard (non-C++) definition
323 static int yyinput YY_PROTO(( void ));
325 static int input YY_PROTO(( void ));
331 static int yy_start_stack_ptr = 0;
332 static int yy_start_stack_depth = 0;
333 static int *yy_start_stack = 0;
334 #ifndef YY_NO_PUSH_STATE
335 static void yy_push_state YY_PROTO(( int new_state ));
337 #ifndef YY_NO_POP_STATE
338 static void yy_pop_state YY_PROTO(( void ));
340 #ifndef YY_NO_TOP_STATE
341 static int yy_top_state YY_PROTO(( void ));
345 #define YY_NO_PUSH_STATE 1
346 #define YY_NO_POP_STATE 1
347 #define YY_NO_TOP_STATE 1
350 #ifdef YY_MALLOC_DECL
358 /* Just try to get by without declaring the routines. This will fail
359 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
360 * or sizeof(void*) != sizeof(int).
365 /* Amount of stuff to slurp up with each read. */
366 #ifndef YY_READ_BUF_SIZE
367 #define YY_READ_BUF_SIZE 8192
370 /* Copy whatever the last rule matched to the standard output. */
373 %- Standard (non-C++) definition
374 /* This used to be an fputs(), but since the string might contain NUL's,
375 * we now use fwrite().
377 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
379 #define ECHO LexerOutput( yytext, yyleng )
383 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
384 * is returned in "result".
387 #define YY_INPUT(buf,result,max_size) \
388 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
390 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
391 YY_FATAL_ERROR( "input in flex scanner failed" );
395 /* No semi-colon after return; correct usage is to write "yyterminate();" -
396 * we don't want an extra ';' after the "return" because that will cause
397 * some compilers to complain about unreachable statements.
400 #define yyterminate() return YY_NULL
403 /* Number of entries by which start-condition stack grows. */
404 #ifndef YY_START_STACK_INCR
405 #define YY_START_STACK_INCR 25
408 /* Report a fatal error. */
409 #ifndef YY_FATAL_ERROR
411 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
413 #define YY_FATAL_ERROR(msg) LexerError( msg )
417 /* Default declaration of generated scanner - a define so the user can
418 * easily add parameters.
421 %- Standard (non-C++) definition
422 #define YY_DECL int yylex YY_PROTO(( void ))
424 #define YY_DECL int yyFlexLexer::yylex()
428 /* Code executed at the beginning of each rule, after yytext and yyleng
431 #ifndef YY_USER_ACTION
432 #define YY_USER_ACTION
435 /* Code executed at the end of each rule. */
437 #define YY_BREAK break;
440 %% YY_RULE_SETUP definition goes here
444 register yy_state_type yy_current_state;
445 register char *yy_cp, *yy_bp;
448 %% user's declarations go here
459 yy_start = 1; /* first start state */
475 if ( ! yy_current_buffer )
477 yy_create_buffer( yyin, YY_BUF_SIZE );
479 yy_load_buffer_state();
482 while ( 1 ) /* loops until end-of-file is reached */
484 %% yymore()-related code goes here
487 /* Support of yytext. */
488 *yy_cp = yy_hold_char;
490 /* yy_bp points to the position in yy_ch_buf of the start of
495 %% code to set up and find next match goes here
498 %% code to find the action number goes here
502 %% code for yylineno update goes here
504 do_action: /* This label is used only to access EOF actions. */
506 %% debug code goes here
509 { /* beginning of action switch */
512 case YY_END_OF_BUFFER:
514 /* Amount of text matched not including the EOB char. */
515 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
517 /* Undo the effects of YY_DO_BEFORE_ACTION. */
518 *yy_cp = yy_hold_char;
519 YY_RESTORE_YY_MORE_OFFSET
521 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
523 /* We're scanning a new file or input source. It's
524 * possible that this happened because the user
525 * just pointed yyin at a new source and called
526 * yylex(). If so, then we have to assure
527 * consistency between yy_current_buffer and our
528 * globals. Here is the right place to do so, because
529 * this is the first action (other than possibly a
530 * back-up) that will match for the new input source.
532 yy_n_chars = yy_current_buffer->yy_n_chars;
533 yy_current_buffer->yy_input_file = yyin;
534 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
537 /* Note that here we test for yy_c_buf_p "<=" to the position
538 * of the first EOB in the buffer, since yy_c_buf_p will
539 * already have been incremented past the NUL character
540 * (since all states make transitions on EOB to the
541 * end-of-buffer state). Contrast this with the test
544 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
545 { /* This was really a NUL. */
546 yy_state_type yy_next_state;
548 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
550 yy_current_state = yy_get_previous_state();
552 /* Okay, we're now positioned to make the NUL
553 * transition. We couldn't have
554 * yy_get_previous_state() go ahead and do it
555 * for us because it doesn't know how to deal
556 * with the possibility of jamming (and we don't
557 * want to build jamming into it because then it
558 * will run more slowly).
561 yy_next_state = yy_try_NUL_trans( yy_current_state );
563 yy_bp = yytext_ptr + YY_MORE_ADJ;
567 /* Consume the NUL. */
568 yy_cp = ++yy_c_buf_p;
569 yy_current_state = yy_next_state;
575 %% code to do back-up for compressed tables and set up yy_cp goes here
580 else switch ( yy_get_next_buffer() )
582 case EOB_ACT_END_OF_FILE:
584 yy_did_buffer_switch_on_eof = 0;
588 /* Note: because we've taken care in
589 * yy_get_next_buffer() to have set up
590 * yytext, we can now set up
591 * yy_c_buf_p so that if some total
592 * hoser (like flex itself) wants to
593 * call the scanner after we return the
594 * YY_NULL, it'll still work - another
595 * YY_NULL will get returned.
597 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
599 yy_act = YY_STATE_EOF(YY_START);
605 if ( ! yy_did_buffer_switch_on_eof )
611 case EOB_ACT_CONTINUE_SCAN:
613 yytext_ptr + yy_amount_of_matched_text;
615 yy_current_state = yy_get_previous_state();
618 yy_bp = yytext_ptr + YY_MORE_ADJ;
621 case EOB_ACT_LAST_MATCH:
623 &yy_current_buffer->yy_ch_buf[yy_n_chars];
625 yy_current_state = yy_get_previous_state();
628 yy_bp = yytext_ptr + YY_MORE_ADJ;
636 "fatal flex scanner internal error--no action found" );
637 } /* end of action switch */
638 } /* end of scanning one token */
642 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
650 yylineno = 1; // this will only get updated if %option yylineno
652 yy_did_buffer_switch_on_eof = 0;
654 yy_looking_for_trail_begin = 0;
657 yy_more_offset = yy_prev_more_offset = 0;
659 yy_start_stack_ptr = yy_start_stack_depth = 0;
662 yy_current_buffer = 0;
664 #ifdef YY_USES_REJECT
665 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
671 yyFlexLexer::~yyFlexLexer()
674 yy_delete_buffer( yy_current_buffer );
677 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
681 yy_delete_buffer( yy_current_buffer );
682 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
689 #ifdef YY_INTERACTIVE
690 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
692 int yyFlexLexer::LexerInput( char* buf, int max_size )
695 if ( yyin->eof() || yyin->fail() )
698 #ifdef YY_INTERACTIVE
710 (void) yyin->read( buf, max_size );
715 return yyin->gcount();
719 void yyFlexLexer::LexerOutput( const char* buf, int size )
721 (void) yyout->write( buf, size );
725 /* yy_get_next_buffer - try to read in a new buffer
727 * Returns a code representing an action:
728 * EOB_ACT_LAST_MATCH -
729 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
730 * EOB_ACT_END_OF_FILE - end of file
734 static int yy_get_next_buffer()
736 int yyFlexLexer::yy_get_next_buffer()
739 register char *dest = yy_current_buffer->yy_ch_buf;
740 register char *source = yytext_ptr;
741 register int number_to_move, i;
744 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
746 "fatal flex scanner internal error--end of buffer missed" );
748 if ( yy_current_buffer->yy_fill_buffer == 0 )
749 { /* Don't try to fill the buffer, so this is an EOF. */
750 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
752 /* We matched a single character, the EOB, so
753 * treat this as a final EOF.
755 return EOB_ACT_END_OF_FILE;
760 /* We matched some text prior to the EOB, first
763 return EOB_ACT_LAST_MATCH;
767 /* Try to read more data. */
769 /* First move last chars to start of buffer. */
770 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
772 for ( i = 0; i < number_to_move; ++i )
773 *(dest++) = *(source++);
775 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
776 /* don't do the read, it's not guaranteed to return an EOF,
779 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
784 yy_current_buffer->yy_buf_size - number_to_move - 1;
786 while ( num_to_read <= 0 )
787 { /* Not enough room in the buffer - grow it. */
788 #ifdef YY_USES_REJECT
790 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
793 /* just a shorter name for the current buffer */
794 YY_BUFFER_STATE b = yy_current_buffer;
796 int yy_c_buf_p_offset =
797 (int) (yy_c_buf_p - b->yy_ch_buf);
799 if ( b->yy_is_our_buffer )
801 int new_size = b->yy_buf_size * 2;
804 b->yy_buf_size += b->yy_buf_size / 8;
808 b->yy_ch_buf = (char *)
809 /* Include room in for 2 EOB chars. */
810 yy_flex_realloc( (void *) b->yy_ch_buf,
811 b->yy_buf_size + 2 );
814 /* Can't grow it, we don't own it. */
817 if ( ! b->yy_ch_buf )
819 "fatal error - scanner input buffer overflow" );
821 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
823 num_to_read = yy_current_buffer->yy_buf_size -
828 if ( num_to_read > YY_READ_BUF_SIZE )
829 num_to_read = YY_READ_BUF_SIZE;
831 /* Read in more data. */
832 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
833 yy_n_chars, num_to_read );
835 yy_current_buffer->yy_n_chars = yy_n_chars;
838 if ( yy_n_chars == 0 )
840 if ( number_to_move == YY_MORE_ADJ )
842 ret_val = EOB_ACT_END_OF_FILE;
848 ret_val = EOB_ACT_LAST_MATCH;
849 yy_current_buffer->yy_buffer_status =
850 YY_BUFFER_EOF_PENDING;
855 ret_val = EOB_ACT_CONTINUE_SCAN;
857 yy_n_chars += number_to_move;
858 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
859 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
861 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
867 /* yy_get_previous_state - get the state just before the EOB char was reached */
870 static yy_state_type yy_get_previous_state()
872 yy_state_type yyFlexLexer::yy_get_previous_state()
875 register yy_state_type yy_current_state;
876 register char *yy_cp;
878 %% code to get the start state into yy_current_state goes here
880 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
882 %% code to find the next state goes here
885 return yy_current_state;
889 /* yy_try_NUL_trans - try to make a transition on the NUL character
892 * next_state = yy_try_NUL_trans( current_state );
897 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
899 static yy_state_type yy_try_NUL_trans( yy_current_state )
900 yy_state_type yy_current_state;
903 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
906 register int yy_is_jam;
907 %% code to find the next state, and perhaps do backing up, goes here
909 return yy_is_jam ? 0 : yy_current_state;
916 static void yyunput( int c, register char *yy_bp )
918 static void yyunput( c, yy_bp )
920 register char *yy_bp;
923 void yyFlexLexer::yyunput( int c, register char* yy_bp )
926 register char *yy_cp = yy_c_buf_p;
928 /* undo effects of setting up yytext */
929 *yy_cp = yy_hold_char;
931 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
932 { /* need to shift things up to make room */
933 /* +2 for EOB chars. */
934 register int number_to_move = yy_n_chars + 2;
935 register char *dest = &yy_current_buffer->yy_ch_buf[
936 yy_current_buffer->yy_buf_size + 2];
937 register char *source =
938 &yy_current_buffer->yy_ch_buf[number_to_move];
940 while ( source > yy_current_buffer->yy_ch_buf )
943 yy_cp += (int) (dest - source);
944 yy_bp += (int) (dest - source);
945 yy_current_buffer->yy_n_chars =
946 yy_n_chars = yy_current_buffer->yy_buf_size;
948 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
949 YY_FATAL_ERROR( "flex scanner push-back overflow" );
954 %% update yylineno here
957 yy_hold_char = *yy_cp;
961 #endif /* ifndef YY_NO_UNPUT */
972 int yyFlexLexer::yyinput()
977 *yy_c_buf_p = yy_hold_char;
979 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
981 /* yy_c_buf_p now points to the character we want to return.
982 * If this occurs *before* the EOB characters, then it's a
983 * valid NUL; if not, then we've hit the end of the buffer.
985 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
986 /* This was really a NUL. */
990 { /* need more input */
991 int offset = yy_c_buf_p - yytext_ptr;
994 switch ( yy_get_next_buffer() )
996 case EOB_ACT_LAST_MATCH:
997 /* This happens because yy_g_n_b()
998 * sees that we've accumulated a
999 * token and flags that we need to
1000 * try matching the token before
1001 * proceeding. But for input(),
1002 * there's no matching to consider.
1003 * So convert the EOB_ACT_LAST_MATCH
1004 * to EOB_ACT_END_OF_FILE.
1007 /* Reset buffer status. */
1012 case EOB_ACT_END_OF_FILE:
1017 if ( ! yy_did_buffer_switch_on_eof )
1026 case EOB_ACT_CONTINUE_SCAN:
1027 yy_c_buf_p = yytext_ptr + offset;
1033 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1034 *yy_c_buf_p = '\0'; /* preserve yytext */
1035 yy_hold_char = *++yy_c_buf_p;
1037 %% update BOL and yylineno
1044 #ifdef YY_USE_PROTOS
1045 void yyrestart( FILE *input_file )
1047 void yyrestart( input_file )
1051 void yyFlexLexer::yyrestart( istream* input_file )
1054 if ( ! yy_current_buffer )
1055 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1057 yy_init_buffer( yy_current_buffer, input_file );
1058 yy_load_buffer_state();
1063 #ifdef YY_USE_PROTOS
1064 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1066 void yy_switch_to_buffer( new_buffer )
1067 YY_BUFFER_STATE new_buffer;
1070 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1073 if ( yy_current_buffer == new_buffer )
1076 if ( yy_current_buffer )
1078 /* Flush out information for old buffer. */
1079 *yy_c_buf_p = yy_hold_char;
1080 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1081 yy_current_buffer->yy_n_chars = yy_n_chars;
1084 yy_current_buffer = new_buffer;
1085 yy_load_buffer_state();
1087 /* We don't actually know whether we did this switch during
1088 * EOF (yywrap()) processing, but the only time this flag
1089 * is looked at is after yywrap() is called, so it's safe
1090 * to go ahead and always set it.
1092 yy_did_buffer_switch_on_eof = 1;
1097 #ifdef YY_USE_PROTOS
1098 void yy_load_buffer_state( void )
1100 void yy_load_buffer_state()
1103 void yyFlexLexer::yy_load_buffer_state()
1106 yy_n_chars = yy_current_buffer->yy_n_chars;
1107 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1108 yyin = yy_current_buffer->yy_input_file;
1109 yy_hold_char = *yy_c_buf_p;
1114 #ifdef YY_USE_PROTOS
1115 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1117 YY_BUFFER_STATE yy_create_buffer( file, size )
1122 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1127 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1129 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1131 b->yy_buf_size = size;
1133 /* yy_ch_buf has to be 2 characters longer than the size given because
1134 * we need to put in 2 end-of-buffer characters.
1136 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1137 if ( ! b->yy_ch_buf )
1138 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1140 b->yy_is_our_buffer = 1;
1142 yy_init_buffer( b, file );
1149 #ifdef YY_USE_PROTOS
1150 void yy_delete_buffer( YY_BUFFER_STATE b )
1152 void yy_delete_buffer( b )
1156 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1162 if ( b == yy_current_buffer )
1163 yy_current_buffer = (YY_BUFFER_STATE) 0;
1165 if ( b->yy_is_our_buffer )
1166 yy_flex_free( (void *) b->yy_ch_buf );
1168 yy_flex_free( (void *) b );
1173 #ifdef YY_USE_PROTOS
1174 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1176 void yy_init_buffer( b, file )
1182 extern "C" int isatty YY_PROTO(( int ));
1183 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1187 yy_flush_buffer( b );
1189 b->yy_input_file = file;
1190 b->yy_fill_buffer = 1;
1193 #if YY_ALWAYS_INTERACTIVE
1194 b->yy_is_interactive = 1;
1196 #if YY_NEVER_INTERACTIVE
1197 b->yy_is_interactive = 0;
1199 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1203 b->yy_is_interactive = 0;
1209 #ifdef YY_USE_PROTOS
1210 void yy_flush_buffer( YY_BUFFER_STATE b )
1212 void yy_flush_buffer( b )
1217 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1225 /* We always need two end-of-buffer characters. The first causes
1226 * a transition to the end-of-buffer state. The second causes
1227 * a jam in that state.
1229 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1230 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1232 b->yy_buf_pos = &b->yy_ch_buf[0];
1235 b->yy_buffer_status = YY_BUFFER_NEW;
1237 if ( b == yy_current_buffer )
1238 yy_load_buffer_state();
1243 #ifndef YY_NO_SCAN_BUFFER
1245 #ifdef YY_USE_PROTOS
1246 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1248 YY_BUFFER_STATE yy_scan_buffer( base, size )
1256 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1257 base[size-1] != YY_END_OF_BUFFER_CHAR )
1258 /* They forgot to leave room for the EOB's. */
1261 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1263 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1265 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1266 b->yy_buf_pos = b->yy_ch_buf = base;
1267 b->yy_is_our_buffer = 0;
1268 b->yy_input_file = 0;
1269 b->yy_n_chars = b->yy_buf_size;
1270 b->yy_is_interactive = 0;
1272 b->yy_fill_buffer = 0;
1273 b->yy_buffer_status = YY_BUFFER_NEW;
1275 yy_switch_to_buffer( b );
1283 #ifndef YY_NO_SCAN_STRING
1285 #ifdef YY_USE_PROTOS
1286 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1288 YY_BUFFER_STATE yy_scan_string( yy_str )
1289 yyconst char *yy_str;
1293 for ( len = 0; yy_str[len]; ++len )
1296 return yy_scan_bytes( yy_str, len );
1302 #ifndef YY_NO_SCAN_BYTES
1304 #ifdef YY_USE_PROTOS
1305 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1307 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1308 yyconst char *bytes;
1317 /* Get memory for full buffer, including space for trailing EOB's. */
1319 buf = (char *) yy_flex_alloc( n );
1321 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1323 for ( i = 0; i < len; ++i )
1326 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1328 b = yy_scan_buffer( buf, n );
1330 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1332 /* It's okay to grow etc. this buffer, and we should throw it
1333 * away when we're done.
1335 b->yy_is_our_buffer = 1;
1343 #ifndef YY_NO_PUSH_STATE
1345 #ifdef YY_USE_PROTOS
1346 static void yy_push_state( int new_state )
1348 static void yy_push_state( new_state )
1352 void yyFlexLexer::yy_push_state( int new_state )
1355 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1359 yy_start_stack_depth += YY_START_STACK_INCR;
1360 new_size = yy_start_stack_depth * sizeof( int );
1362 if ( ! yy_start_stack )
1363 yy_start_stack = (int *) yy_flex_alloc( new_size );
1366 yy_start_stack = (int *) yy_flex_realloc(
1367 (void *) yy_start_stack, new_size );
1369 if ( ! yy_start_stack )
1371 "out of memory expanding start-condition stack" );
1374 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1381 #ifndef YY_NO_POP_STATE
1383 static void yy_pop_state()
1385 void yyFlexLexer::yy_pop_state()
1388 if ( --yy_start_stack_ptr < 0 )
1389 YY_FATAL_ERROR( "start-condition stack underflow" );
1391 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1396 #ifndef YY_NO_TOP_STATE
1398 static int yy_top_state()
1400 int yyFlexLexer::yy_top_state()
1403 return yy_start_stack[yy_start_stack_ptr - 1];
1407 #ifndef YY_EXIT_FAILURE
1408 #define YY_EXIT_FAILURE 2
1412 #ifdef YY_USE_PROTOS
1413 static void yy_fatal_error( yyconst char msg[] )
1415 static void yy_fatal_error( msg )
1419 (void) fprintf( stderr, "%s\n", msg );
1420 exit( YY_EXIT_FAILURE );
1425 void yyFlexLexer::LexerError( yyconst char msg[] )
1427 cerr << msg << '\n';
1428 exit( YY_EXIT_FAILURE );
1433 /* Redefine yyless() so it works in section 3 code. */
1439 /* Undo effects of setting up yytext. */ \
1440 yytext[yyleng] = yy_hold_char; \
1441 yy_c_buf_p = yytext + n; \
1442 yy_hold_char = *yy_c_buf_p; \
1443 *yy_c_buf_p = '\0'; \
1449 /* Internal utility routines. */
1452 #ifdef YY_USE_PROTOS
1453 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1455 static void yy_flex_strncpy( s1, s2, n )
1462 for ( i = 0; i < n; ++i )
1467 #ifdef YY_NEED_STRLEN
1468 #ifdef YY_USE_PROTOS
1469 static int yy_flex_strlen( yyconst char *s )
1471 static int yy_flex_strlen( s )
1476 for ( n = 0; s[n]; ++n )
1484 #ifdef YY_USE_PROTOS
1485 static void *yy_flex_alloc( yy_size_t size )
1487 static void *yy_flex_alloc( size )
1491 return (void *) malloc( size );
1494 #ifdef YY_USE_PROTOS
1495 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1497 static void *yy_flex_realloc( ptr, size )
1502 /* The cast to (char *) in the following accommodates both
1503 * implementations that use char* generic pointers, and those
1504 * that use void* generic pointers. It works with the latter
1505 * because both ANSI C and C++ allow castless assignment from
1506 * any pointer type to void*, and deal with argument conversions
1507 * as though doing an assignment.
1509 return (void *) realloc( (char *) ptr, size );
1512 #ifdef YY_USE_PROTOS
1513 static void yy_flex_free( void *ptr )
1515 static void yy_flex_free( ptr )