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.6 2006/06/11 12:57:31 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" */
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 ));
255 static void yy_flex_free YY_PROTO(( void * ));
257 #define yy_new_buffer yy_create_buffer
259 #define yy_set_interactive(is_interactive) \
261 if ( ! yy_current_buffer ) \
262 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
263 yy_current_buffer->yy_is_interactive = is_interactive; \
266 #define yy_set_bol(at_bol) \
268 if ( ! yy_current_buffer ) \
269 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
270 yy_current_buffer->yy_at_bol = at_bol; \
273 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
275 %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
277 %- Standard (non-C++) definition
278 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
279 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
280 static int yy_get_next_buffer YY_PROTO(( void ));
281 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
284 /* Done after the current pattern has been matched and before the
285 * corresponding action - sets up yytext.
287 #define YY_DO_BEFORE_ACTION \
288 yytext_ptr = yy_bp; \
289 %% code to fiddle yytext and yyleng for yymore() goes here
290 yy_hold_char = *yy_cp; \
292 %% code to copy yytext_ptr to yytext[] goes here, if %array
295 %% data tables for the DFA and the user's section 1 definitions go here
297 /* Macros after this point can all be overridden by user definitions in
301 #ifndef YY_SKIP_YYWRAP
303 extern "C" int yywrap YY_PROTO(( void ));
305 extern int yywrap YY_PROTO(( void ));
311 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
316 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
319 #ifdef YY_NEED_STRLEN
320 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
324 %- Standard (non-C++) definition
326 static int yyinput YY_PROTO(( void ));
328 static int input YY_PROTO(( void ));
334 static int yy_start_stack_ptr = 0;
335 static int yy_start_stack_depth = 0;
336 static int *yy_start_stack = 0;
337 #ifndef YY_NO_PUSH_STATE
338 static void yy_push_state YY_PROTO(( int new_state ));
340 #ifndef YY_NO_POP_STATE
341 static void yy_pop_state YY_PROTO(( void ));
343 #ifndef YY_NO_TOP_STATE
344 static int yy_top_state YY_PROTO(( void ));
348 #define YY_NO_PUSH_STATE 1
349 #define YY_NO_POP_STATE 1
350 #define YY_NO_TOP_STATE 1
353 #ifdef YY_MALLOC_DECL
361 /* Just try to get by without declaring the routines. This will fail
362 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
363 * or sizeof(void*) != sizeof(int).
368 /* Amount of stuff to slurp up with each read. */
369 #ifndef YY_READ_BUF_SIZE
370 #define YY_READ_BUF_SIZE 8192
373 /* Copy whatever the last rule matched to the standard output. */
376 %- Standard (non-C++) definition
377 /* This used to be an fputs(), but since the string might contain NUL's,
378 * we now use fwrite().
380 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
382 #define ECHO LexerOutput( yytext, yyleng )
386 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
387 * is returned in "result".
390 #define YY_INPUT(buf,result,max_size) \
391 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
393 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
394 YY_FATAL_ERROR( "input in flex scanner failed" );
398 /* No semi-colon after return; correct usage is to write "yyterminate();" -
399 * we don't want an extra ';' after the "return" because that will cause
400 * some compilers to complain about unreachable statements.
403 #define yyterminate() return YY_NULL
406 /* Number of entries by which start-condition stack grows. */
407 #ifndef YY_START_STACK_INCR
408 #define YY_START_STACK_INCR 25
411 /* Report a fatal error. */
412 #ifndef YY_FATAL_ERROR
414 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
416 #define YY_FATAL_ERROR(msg) LexerError( msg )
420 /* Default declaration of generated scanner - a define so the user can
421 * easily add parameters.
424 %- Standard (non-C++) definition
425 #define YY_DECL int yylex YY_PROTO(( void ))
427 #define YY_DECL int yyFlexLexer::yylex()
431 /* Code executed at the beginning of each rule, after yytext and yyleng
434 #ifndef YY_USER_ACTION
435 #define YY_USER_ACTION
438 /* Code executed at the end of each rule. */
440 #define YY_BREAK break;
443 %% YY_RULE_SETUP definition goes here
447 register yy_state_type yy_current_state;
448 register char *yy_cp, *yy_bp;
451 %% user's declarations go here
462 yy_start = 1; /* first start state */
478 if ( ! yy_current_buffer )
480 yy_create_buffer( yyin, YY_BUF_SIZE );
482 yy_load_buffer_state();
485 while ( 1 ) /* loops until end-of-file is reached */
487 %% yymore()-related code goes here
490 /* Support of yytext. */
491 *yy_cp = yy_hold_char;
493 /* yy_bp points to the position in yy_ch_buf of the start of
498 %% code to set up and find next match goes here
501 %% code to find the action number goes here
505 %% code for yylineno update goes here
507 do_action: /* This label is used only to access EOF actions. */
509 %% debug code goes here
512 { /* beginning of action switch */
515 case YY_END_OF_BUFFER:
517 /* Amount of text matched not including the EOB char. */
518 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
520 /* Undo the effects of YY_DO_BEFORE_ACTION. */
521 *yy_cp = yy_hold_char;
522 YY_RESTORE_YY_MORE_OFFSET
524 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
526 /* We're scanning a new file or input source. It's
527 * possible that this happened because the user
528 * just pointed yyin at a new source and called
529 * yylex(). If so, then we have to assure
530 * consistency between yy_current_buffer and our
531 * globals. Here is the right place to do so, because
532 * this is the first action (other than possibly a
533 * back-up) that will match for the new input source.
535 yy_n_chars = yy_current_buffer->yy_n_chars;
536 yy_current_buffer->yy_input_file = yyin;
537 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
540 /* Note that here we test for yy_c_buf_p "<=" to the position
541 * of the first EOB in the buffer, since yy_c_buf_p will
542 * already have been incremented past the NUL character
543 * (since all states make transitions on EOB to the
544 * end-of-buffer state). Contrast this with the test
547 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
548 { /* This was really a NUL. */
549 yy_state_type yy_next_state;
551 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
553 yy_current_state = yy_get_previous_state();
555 /* Okay, we're now positioned to make the NUL
556 * transition. We couldn't have
557 * yy_get_previous_state() go ahead and do it
558 * for us because it doesn't know how to deal
559 * with the possibility of jamming (and we don't
560 * want to build jamming into it because then it
561 * will run more slowly).
564 yy_next_state = yy_try_NUL_trans( yy_current_state );
566 yy_bp = yytext_ptr + YY_MORE_ADJ;
570 /* Consume the NUL. */
571 yy_cp = ++yy_c_buf_p;
572 yy_current_state = yy_next_state;
578 %% code to do back-up for compressed tables and set up yy_cp goes here
583 else switch ( yy_get_next_buffer() )
585 case EOB_ACT_END_OF_FILE:
587 yy_did_buffer_switch_on_eof = 0;
591 /* Note: because we've taken care in
592 * yy_get_next_buffer() to have set up
593 * yytext, we can now set up
594 * yy_c_buf_p so that if some total
595 * hoser (like flex itself) wants to
596 * call the scanner after we return the
597 * YY_NULL, it'll still work - another
598 * YY_NULL will get returned.
600 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
602 yy_act = YY_STATE_EOF(YY_START);
608 if ( ! yy_did_buffer_switch_on_eof )
614 case EOB_ACT_CONTINUE_SCAN:
616 yytext_ptr + yy_amount_of_matched_text;
618 yy_current_state = yy_get_previous_state();
621 yy_bp = yytext_ptr + YY_MORE_ADJ;
624 case EOB_ACT_LAST_MATCH:
626 &yy_current_buffer->yy_ch_buf[yy_n_chars];
628 yy_current_state = yy_get_previous_state();
631 yy_bp = yytext_ptr + YY_MORE_ADJ;
639 "fatal flex scanner internal error--no action found" );
640 } /* end of action switch */
641 } /* end of scanning one token */
645 yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
653 yylineno = 1; // this will only get updated if %option yylineno
655 yy_did_buffer_switch_on_eof = 0;
657 yy_looking_for_trail_begin = 0;
660 yy_more_offset = yy_prev_more_offset = 0;
662 yy_start_stack_ptr = yy_start_stack_depth = 0;
665 yy_current_buffer = 0;
667 #ifdef YY_USES_REJECT
668 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
674 yyFlexLexer::~yyFlexLexer()
677 yy_delete_buffer( yy_current_buffer );
680 void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
684 yy_delete_buffer( yy_current_buffer );
685 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
692 #ifdef YY_INTERACTIVE
693 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
695 int yyFlexLexer::LexerInput( char* buf, int max_size )
698 if ( yyin->eof() || yyin->fail() )
701 #ifdef YY_INTERACTIVE
713 (void) yyin->read( buf, max_size );
718 return yyin->gcount();
722 void yyFlexLexer::LexerOutput( const char* buf, int size )
724 (void) yyout->write( buf, size );
728 /* yy_get_next_buffer - try to read in a new buffer
730 * Returns a code representing an action:
731 * EOB_ACT_LAST_MATCH -
732 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
733 * EOB_ACT_END_OF_FILE - end of file
737 static int yy_get_next_buffer()
739 int yyFlexLexer::yy_get_next_buffer()
742 register char *dest = yy_current_buffer->yy_ch_buf;
743 register char *source = yytext_ptr;
744 register int number_to_move, i;
747 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
749 "fatal flex scanner internal error--end of buffer missed" );
751 if ( yy_current_buffer->yy_fill_buffer == 0 )
752 { /* Don't try to fill the buffer, so this is an EOF. */
753 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
755 /* We matched a single character, the EOB, so
756 * treat this as a final EOF.
758 return EOB_ACT_END_OF_FILE;
763 /* We matched some text prior to the EOB, first
766 return EOB_ACT_LAST_MATCH;
770 /* Try to read more data. */
772 /* First move last chars to start of buffer. */
773 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
775 for ( i = 0; i < number_to_move; ++i )
776 *(dest++) = *(source++);
778 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
779 /* don't do the read, it's not guaranteed to return an EOF,
782 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
787 yy_current_buffer->yy_buf_size - number_to_move - 1;
789 while ( num_to_read <= 0 )
790 { /* Not enough room in the buffer - grow it. */
791 #ifdef YY_USES_REJECT
793 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
796 /* just a shorter name for the current buffer */
797 YY_BUFFER_STATE b = yy_current_buffer;
799 int yy_c_buf_p_offset =
800 (int) (yy_c_buf_p - b->yy_ch_buf);
802 if ( b->yy_is_our_buffer )
804 int new_size = b->yy_buf_size * 2;
807 b->yy_buf_size += b->yy_buf_size / 8;
811 b->yy_ch_buf = (char *)
812 /* Include room in for 2 EOB chars. */
813 yy_flex_realloc( (void *) b->yy_ch_buf,
814 b->yy_buf_size + 2 );
817 /* Can't grow it, we don't own it. */
820 if ( ! b->yy_ch_buf )
822 "fatal error - scanner input buffer overflow" );
824 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
826 num_to_read = yy_current_buffer->yy_buf_size -
831 if ( num_to_read > YY_READ_BUF_SIZE )
832 num_to_read = YY_READ_BUF_SIZE;
834 /* Read in more data. */
835 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
836 yy_n_chars, num_to_read );
838 yy_current_buffer->yy_n_chars = yy_n_chars;
841 if ( yy_n_chars == 0 )
843 if ( number_to_move == YY_MORE_ADJ )
845 ret_val = EOB_ACT_END_OF_FILE;
851 ret_val = EOB_ACT_LAST_MATCH;
852 yy_current_buffer->yy_buffer_status =
853 YY_BUFFER_EOF_PENDING;
858 ret_val = EOB_ACT_CONTINUE_SCAN;
860 yy_n_chars += number_to_move;
861 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
862 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
864 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
870 /* yy_get_previous_state - get the state just before the EOB char was reached */
873 static yy_state_type yy_get_previous_state()
875 yy_state_type yyFlexLexer::yy_get_previous_state()
878 register yy_state_type yy_current_state;
879 register char *yy_cp;
881 %% code to get the start state into yy_current_state goes here
883 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
885 %% code to find the next state goes here
888 return yy_current_state;
892 /* yy_try_NUL_trans - try to make a transition on the NUL character
895 * next_state = yy_try_NUL_trans( current_state );
900 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
902 static yy_state_type yy_try_NUL_trans( yy_current_state )
903 yy_state_type yy_current_state;
906 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
909 register int yy_is_jam;
910 %% code to find the next state, and perhaps do backing up, goes here
912 return yy_is_jam ? 0 : yy_current_state;
919 static void yyunput( int c, register char *yy_bp )
921 static void yyunput( c, yy_bp )
923 register char *yy_bp;
926 void yyFlexLexer::yyunput( int c, register char* yy_bp )
929 register char *yy_cp = yy_c_buf_p;
931 /* undo effects of setting up yytext */
932 *yy_cp = yy_hold_char;
934 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
935 { /* need to shift things up to make room */
936 /* +2 for EOB chars. */
937 register int number_to_move = yy_n_chars + 2;
938 register char *dest = &yy_current_buffer->yy_ch_buf[
939 yy_current_buffer->yy_buf_size + 2];
940 register char *source =
941 &yy_current_buffer->yy_ch_buf[number_to_move];
943 while ( source > yy_current_buffer->yy_ch_buf )
946 yy_cp += (int) (dest - source);
947 yy_bp += (int) (dest - source);
948 yy_current_buffer->yy_n_chars =
949 yy_n_chars = yy_current_buffer->yy_buf_size;
951 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
952 YY_FATAL_ERROR( "flex scanner push-back overflow" );
957 %% update yylineno here
960 yy_hold_char = *yy_cp;
964 #endif /* ifndef YY_NO_UNPUT */
975 int yyFlexLexer::yyinput()
980 *yy_c_buf_p = yy_hold_char;
982 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
984 /* yy_c_buf_p now points to the character we want to return.
985 * If this occurs *before* the EOB characters, then it's a
986 * valid NUL; if not, then we've hit the end of the buffer.
988 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
989 /* This was really a NUL. */
993 { /* need more input */
994 int offset = yy_c_buf_p - yytext_ptr;
997 switch ( yy_get_next_buffer() )
999 case EOB_ACT_LAST_MATCH:
1000 /* This happens because yy_g_n_b()
1001 * sees that we've accumulated a
1002 * token and flags that we need to
1003 * try matching the token before
1004 * proceeding. But for input(),
1005 * there's no matching to consider.
1006 * So convert the EOB_ACT_LAST_MATCH
1007 * to EOB_ACT_END_OF_FILE.
1010 /* Reset buffer status. */
1015 case EOB_ACT_END_OF_FILE:
1020 if ( ! yy_did_buffer_switch_on_eof )
1029 case EOB_ACT_CONTINUE_SCAN:
1030 yy_c_buf_p = yytext_ptr + offset;
1036 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1037 *yy_c_buf_p = '\0'; /* preserve yytext */
1038 yy_hold_char = *++yy_c_buf_p;
1040 %% update BOL and yylineno
1047 #ifdef YY_USE_PROTOS
1048 void yyrestart( FILE *input_file )
1050 void yyrestart( input_file )
1054 void yyFlexLexer::yyrestart( istream* input_file )
1057 if ( ! yy_current_buffer )
1058 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1060 yy_init_buffer( yy_current_buffer, input_file );
1061 yy_load_buffer_state();
1066 #ifdef YY_USE_PROTOS
1067 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1069 void yy_switch_to_buffer( new_buffer )
1070 YY_BUFFER_STATE new_buffer;
1073 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1076 if ( yy_current_buffer == new_buffer )
1079 if ( yy_current_buffer )
1081 /* Flush out information for old buffer. */
1082 *yy_c_buf_p = yy_hold_char;
1083 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1084 yy_current_buffer->yy_n_chars = yy_n_chars;
1087 yy_current_buffer = new_buffer;
1088 yy_load_buffer_state();
1090 /* We don't actually know whether we did this switch during
1091 * EOF (yywrap()) processing, but the only time this flag
1092 * is looked at is after yywrap() is called, so it's safe
1093 * to go ahead and always set it.
1095 yy_did_buffer_switch_on_eof = 1;
1100 #ifdef YY_USE_PROTOS
1101 void yy_load_buffer_state( void )
1103 void yy_load_buffer_state()
1106 void yyFlexLexer::yy_load_buffer_state()
1109 yy_n_chars = yy_current_buffer->yy_n_chars;
1110 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1111 yyin = yy_current_buffer->yy_input_file;
1112 yy_hold_char = *yy_c_buf_p;
1117 #ifdef YY_USE_PROTOS
1118 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1120 YY_BUFFER_STATE yy_create_buffer( file, size )
1125 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
1130 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1132 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1134 b->yy_buf_size = size;
1136 /* yy_ch_buf has to be 2 characters longer than the size given because
1137 * we need to put in 2 end-of-buffer characters.
1139 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1140 if ( ! b->yy_ch_buf )
1141 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1143 b->yy_is_our_buffer = 1;
1145 yy_init_buffer( b, file );
1152 #ifdef YY_USE_PROTOS
1153 void yy_delete_buffer( YY_BUFFER_STATE b )
1155 void yy_delete_buffer( b )
1159 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1165 if ( b == yy_current_buffer )
1166 yy_current_buffer = (YY_BUFFER_STATE) 0;
1168 if ( b->yy_is_our_buffer )
1169 yy_flex_free( (void *) b->yy_ch_buf );
1171 yy_flex_free( (void *) b );
1176 #ifdef YY_USE_PROTOS
1177 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1179 void yy_init_buffer( b, file )
1185 extern "C" int isatty YY_PROTO(( int ));
1186 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
1190 yy_flush_buffer( b );
1192 b->yy_input_file = file;
1193 b->yy_fill_buffer = 1;
1196 #if YY_ALWAYS_INTERACTIVE
1197 b->yy_is_interactive = 1;
1199 #if YY_NEVER_INTERACTIVE
1200 b->yy_is_interactive = 0;
1202 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1206 b->yy_is_interactive = 0;
1212 #ifdef YY_USE_PROTOS
1213 void yy_flush_buffer( YY_BUFFER_STATE b )
1215 void yy_flush_buffer( b )
1220 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1228 /* We always need two end-of-buffer characters. The first causes
1229 * a transition to the end-of-buffer state. The second causes
1230 * a jam in that state.
1232 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1233 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1235 b->yy_buf_pos = &b->yy_ch_buf[0];
1238 b->yy_buffer_status = YY_BUFFER_NEW;
1240 if ( b == yy_current_buffer )
1241 yy_load_buffer_state();
1246 #ifndef YY_NO_SCAN_BUFFER
1248 #ifdef YY_USE_PROTOS
1249 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1251 YY_BUFFER_STATE yy_scan_buffer( base, size )
1259 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1260 base[size-1] != YY_END_OF_BUFFER_CHAR )
1261 /* They forgot to leave room for the EOB's. */
1264 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1266 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1268 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1269 b->yy_buf_pos = b->yy_ch_buf = base;
1270 b->yy_is_our_buffer = 0;
1271 b->yy_input_file = 0;
1272 b->yy_n_chars = b->yy_buf_size;
1273 b->yy_is_interactive = 0;
1275 b->yy_fill_buffer = 0;
1276 b->yy_buffer_status = YY_BUFFER_NEW;
1278 yy_switch_to_buffer( b );
1286 #ifndef YY_NO_SCAN_STRING
1288 #ifdef YY_USE_PROTOS
1289 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1291 YY_BUFFER_STATE yy_scan_string( yy_str )
1292 yyconst char *yy_str;
1296 for ( len = 0; yy_str[len]; ++len )
1299 return yy_scan_bytes( yy_str, len );
1305 #ifndef YY_NO_SCAN_BYTES
1307 #ifdef YY_USE_PROTOS
1308 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1310 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1311 yyconst char *bytes;
1320 /* Get memory for full buffer, including space for trailing EOB's. */
1322 buf = (char *) yy_flex_alloc( n );
1324 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1326 for ( i = 0; i < len; ++i )
1329 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1331 b = yy_scan_buffer( buf, n );
1333 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1335 /* It's okay to grow etc. this buffer, and we should throw it
1336 * away when we're done.
1338 b->yy_is_our_buffer = 1;
1346 #ifndef YY_NO_PUSH_STATE
1348 #ifdef YY_USE_PROTOS
1349 static void yy_push_state( int new_state )
1351 static void yy_push_state( new_state )
1355 void yyFlexLexer::yy_push_state( int new_state )
1358 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1362 yy_start_stack_depth += YY_START_STACK_INCR;
1363 new_size = yy_start_stack_depth * sizeof( int );
1365 if ( ! yy_start_stack )
1366 yy_start_stack = (int *) yy_flex_alloc( new_size );
1369 yy_start_stack = (int *) yy_flex_realloc(
1370 (void *) yy_start_stack, new_size );
1372 if ( ! yy_start_stack )
1374 "out of memory expanding start-condition stack" );
1377 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1384 #ifndef YY_NO_POP_STATE
1386 static void yy_pop_state()
1388 void yyFlexLexer::yy_pop_state()
1391 if ( --yy_start_stack_ptr < 0 )
1392 YY_FATAL_ERROR( "start-condition stack underflow" );
1394 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1399 #ifndef YY_NO_TOP_STATE
1401 static int yy_top_state()
1403 int yyFlexLexer::yy_top_state()
1406 return yy_start_stack[yy_start_stack_ptr - 1];
1410 #ifndef YY_EXIT_FAILURE
1411 #define YY_EXIT_FAILURE 2
1415 #ifdef YY_USE_PROTOS
1416 static void yy_fatal_error( yyconst char msg[] )
1418 static void yy_fatal_error( msg )
1422 (void) fprintf( stderr, "%s\n", msg );
1423 exit( YY_EXIT_FAILURE );
1428 void yyFlexLexer::LexerError( yyconst char msg[] )
1430 cerr << msg << '\n';
1431 exit( YY_EXIT_FAILURE );
1436 /* Redefine yyless() so it works in section 3 code. */
1442 /* Undo effects of setting up yytext. */ \
1443 yytext[yyleng] = yy_hold_char; \
1444 yy_c_buf_p = yytext + n; \
1445 yy_hold_char = *yy_c_buf_p; \
1446 *yy_c_buf_p = '\0'; \
1452 /* Internal utility routines. */
1455 #ifdef YY_USE_PROTOS
1456 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1458 static void yy_flex_strncpy( s1, s2, n )
1465 for ( i = 0; i < n; ++i )
1470 #ifdef YY_NEED_STRLEN
1471 #ifdef YY_USE_PROTOS
1472 static int yy_flex_strlen( yyconst char *s )
1474 static int yy_flex_strlen( s )
1479 for ( n = 0; s[n]; ++n )
1487 #ifdef YY_USE_PROTOS
1488 static void *yy_flex_alloc( yy_size_t size )
1490 static void *yy_flex_alloc( size )
1494 return (void *) malloc( size );
1497 #ifdef YY_USE_PROTOS
1498 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1500 static void *yy_flex_realloc( ptr, size )
1505 /* The cast to (char *) in the following accommodates both
1506 * implementations that use char* generic pointers, and those
1507 * that use void* generic pointers. It works with the latter
1508 * because both ANSI C and C++ allow castless assignment from
1509 * any pointer type to void*, and deal with argument conversions
1510 * as though doing an assignment.
1512 return (void *) realloc( (char *) ptr, size );
1515 #ifdef YY_USE_PROTOS
1516 static void yy_flex_free( void *ptr )
1518 static void yy_flex_free( ptr )