1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $NetBSD: flex.skl,v 1.24 2009/07/20 21:13:28 christos Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
16 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
32 /* Use prototypes in function declarations. */
35 /* The "const" storage-class-modifier is valid. */
38 #else /* ! __cplusplus */
46 #endif /* ! __cplusplus */
65 #define YY_PROTO(proto) proto
67 #define YY_PROTO(proto) ()
70 /* Returned upon end-of-file. */
73 /* Promotes a possibly negative, possibly signed char to an unsigned
74 * integer for use as an array index. If the signed char is negative,
75 * we want to instead treat it as an 8-bit unsigned char, hence the
78 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
80 /* Enter a start condition. This macro really ought to take a parameter,
81 * but we do it the disgusting crufty way forced on us by the ()-less
82 * definition of BEGIN.
84 #define BEGIN yy_start = 1 + 2 *
86 /* Translate the current start state into a value that can be later handed
87 * to BEGIN to return to the state. The YYSTATE alias is for lex
90 #define YY_START ((yy_start - 1) / 2)
91 #define YYSTATE YY_START
93 /* Action number for EOF rule of a given start state. */
94 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
96 /* Special action meaning "start processing a new file". */
97 #define YY_NEW_FILE yyrestart( yyin )
99 #define YY_END_OF_BUFFER_CHAR 0
101 /* Size of default input buffer. */
102 #define YY_BUF_SIZE 16384
104 typedef struct yy_buffer_state *YY_BUFFER_STATE;
108 extern FILE *yyin, *yyout;
111 #define EOB_ACT_CONTINUE_SCAN 0
112 #define EOB_ACT_END_OF_FILE 1
113 #define EOB_ACT_LAST_MATCH 2
115 /* The funky do-while in the following #define is used to turn the definition
116 * int a single C statement (which needs a semi-colon terminator). This
117 * avoids problems with code like:
119 * if ( condition_holds )
122 * do_something_else();
124 * Prior to using the do-while the compiler would get upset at the
125 * "else" because it interpreted the "if" statement as being all
126 * done when it reached the ';' after the yyless() call.
129 /* Return all but the first 'n' matched characters back to the input stream. */
134 /* Undo effects of setting up yytext. */ \
135 *yy_cp = yy_hold_char; \
136 YY_RESTORE_YY_MORE_OFFSET \
137 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
138 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
142 #define unput(c) yyunput( c, yytext_ptr )
144 /* The following is because we cannot portably get our hands on size_t
145 * (without autoconf's help, which isn't available because we want
146 * flex-generated scanners to compile on their own).
148 typedef unsigned int yy_size_t;
151 struct yy_buffer_state
156 std::istream* yy_input_file;
159 char *yy_ch_buf; /* input buffer */
160 char *yy_buf_pos; /* current position in input buffer */
162 /* Size of input buffer in bytes, not including room for EOB
165 yy_size_t yy_buf_size;
167 /* Number of characters read into yy_ch_buf, not including EOB
172 /* Whether we "own" the buffer - i.e., we know we created it,
173 * and can realloc() it to grow it, and should free() it to
176 int yy_is_our_buffer;
178 /* Whether this is an "interactive" input source; if so, and
179 * if we're using stdio for input, then we want to use getc()
180 * instead of fread(), to make sure we stop fetching input after
183 int yy_is_interactive;
185 /* Whether we're considered to be at the beginning of a line.
186 * If so, '^' rules will be active on the next match, otherwise
191 /* Whether to try to fill the input buffer when we reach the
196 int yy_buffer_status;
197 #define YY_BUFFER_NEW 0
198 #define YY_BUFFER_NORMAL 1
199 /* When an EOF's been seen but there's still some text to process
200 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
201 * shouldn't try reading from the input source any more. We might
202 * still have a bunch of tokens to match, though, because of
203 * possible backing-up.
205 * When we actually see the EOF, we change the status to "new"
206 * (via yyrestart()), so that the user can continue scanning by
207 * just pointing yyin at a new input file.
209 #define YY_BUFFER_EOF_PENDING 2
212 %- Standard (non-C++) definition
213 static YY_BUFFER_STATE yy_current_buffer = 0;
216 /* We provide macros for accessing buffer states in case in the
217 * future we want to put the buffer states in a more general
220 #define YY_CURRENT_BUFFER yy_current_buffer
223 %- Standard (non-C++) definition
224 /* yy_hold_char holds the character lost when yytext is formed. */
225 static char yy_hold_char;
227 static int yy_n_chars; /* number of characters read into yy_ch_buf */
232 /* Points to current character in buffer. */
233 static char *yy_c_buf_p = (char *) 0;
234 static int yy_init = 1; /* whether we need to initialize */
235 static int yy_start = 0; /* start state number */
237 /* Flag which is used to allow yywrap()'s to do buffer switches
238 * instead of setting up a fresh yyin. A bit of a hack ...
240 static int yy_did_buffer_switch_on_eof;
242 void yyrestart YY_PROTO(( FILE *input_file ));
244 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
245 void yy_load_buffer_state YY_PROTO(( void ));
246 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
247 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
248 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
249 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
250 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
252 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
253 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
254 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, yy_size_t len ));
256 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, int size ));
257 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
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 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
282 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ))
284 __attribute__((__unused__))
287 static void yy_flex_free YY_PROTO(( void * ));
289 %- Standard (non-C++) definition
290 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
291 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
292 static int yy_get_next_buffer YY_PROTO(( void ));
293 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
296 /* Done after the current pattern has been matched and before the
297 * corresponding action - sets up yytext.
299 #define YY_DO_BEFORE_ACTION \
300 yytext_ptr = yy_bp; \
301 %% code to fiddle yytext and yyleng for yymore() goes here
302 yy_hold_char = *yy_cp; \
304 %% code to copy yytext_ptr to yytext[] goes here, if %array
307 %% data tables for the DFA and the user's section 1 definitions go here
309 /* Macros after this point can all be overridden by user definitions in
313 #ifndef YY_SKIP_YYWRAP
315 extern "C" int yywrap YY_PROTO(( void ));
317 extern int yywrap YY_PROTO(( void ));
323 static void yyunput YY_PROTO(( int c, char *buf_ptr ))
325 __attribute__((__unused__))
332 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, yy_size_t ));
335 #ifdef YY_NEED_STRLEN
336 static yy_size_t yy_flex_strlen YY_PROTO(( yyconst char * ));
340 %- Standard (non-C++) definition
342 static int yyinput YY_PROTO(( void ));
344 static int input YY_PROTO(( void ));
350 static int yy_start_stack_ptr = 0;
351 static int yy_start_stack_depth = 0;
352 static int *yy_start_stack = 0;
353 #ifndef YY_NO_PUSH_STATE
354 static void yy_push_state YY_PROTO(( int new_state ));
356 #ifndef YY_NO_POP_STATE
357 static void yy_pop_state YY_PROTO(( void ));
359 #ifndef YY_NO_TOP_STATE
360 static int yy_top_state YY_PROTO(( void ));
364 #define YY_NO_PUSH_STATE 1
365 #define YY_NO_POP_STATE 1
366 #define YY_NO_TOP_STATE 1
369 #ifdef YY_MALLOC_DECL
377 /* Just try to get by without declaring the routines. This will fail
378 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
379 * or sizeof(void*) != sizeof(int).
384 /* Amount of stuff to slurp up with each read. */
385 #ifndef YY_READ_BUF_SIZE
386 #define YY_READ_BUF_SIZE 8192
389 /* Copy whatever the last rule matched to the standard output. */
392 %- Standard (non-C++) definition
393 /* This used to be an fputs(), but since the string might contain NUL's,
394 * we now use fwrite().
396 #define ECHO (void) fwrite( yytext, (size_t)yyleng, 1, yyout )
398 #define ECHO LexerOutput( yytext, yyleng )
402 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
403 * is returned in "result".
406 #define YY_INPUT(buf,result,max_size) \
407 %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
409 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
410 YY_FATAL_ERROR( "input in flex scanner failed" );
414 /* No semi-colon after return; correct usage is to write "yyterminate();" -
415 * we don't want an extra ';' after the "return" because that will cause
416 * some compilers to complain about unreachable statements.
419 #define yyterminate() return YY_NULL
422 /* Number of entries by which start-condition stack grows. */
423 #ifndef YY_START_STACK_INCR
424 #define YY_START_STACK_INCR 25
427 /* Report a fatal error. */
428 #ifndef YY_FATAL_ERROR
430 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
432 #define YY_FATAL_ERROR(msg) LexerError( msg )
436 /* Default declaration of generated scanner - a define so the user can
437 * easily add parameters.
440 %- Standard (non-C++) definition
441 #define YY_DECL int yylex YY_PROTO(( void ))
443 #define YY_DECL int yyFlexLexer::yylex()
447 /* Code executed at the beginning of each rule, after yytext and yyleng
450 #ifndef YY_USER_ACTION
451 #define YY_USER_ACTION
454 /* Code executed at the end of each rule. */
456 #define YY_BREAK /*LINTED*/break;
459 %% YY_RULE_SETUP definition goes here
463 register yy_state_type yy_current_state;
464 register char *yy_cp, *yy_bp;
467 %% user's declarations go here
469 #if defined(YY_USES_REJECT) && (defined(__GNUC__) || defined(lint))
470 /* XXX: shut up `unused label' warning with %options yylineno */
471 if (/*CONSTCOND*/0 && yy_full_match)
483 yy_start = 1; /* first start state */
499 if ( ! yy_current_buffer )
501 yy_create_buffer( yyin, YY_BUF_SIZE );
503 yy_load_buffer_state();
506 while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */
508 %% yymore()-related code goes here
511 /* Support of yytext. */
512 *yy_cp = yy_hold_char;
514 /* yy_bp points to the position in yy_ch_buf of the start of
519 %% code to set up and find next match goes here
522 %% code to find the action number goes here
526 %% code for yylineno update goes here
528 do_action: /* This label is used only to access EOF actions. */
530 %% debug code goes here
533 { /* beginning of action switch */
536 case YY_END_OF_BUFFER:
538 /* Amount of text matched not including the EOB char. */
539 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
541 /* Undo the effects of YY_DO_BEFORE_ACTION. */
542 *yy_cp = yy_hold_char;
543 YY_RESTORE_YY_MORE_OFFSET
545 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
547 /* We're scanning a new file or input source. It's
548 * possible that this happened because the user
549 * just pointed yyin at a new source and called
550 * yylex(). If so, then we have to assure
551 * consistency between yy_current_buffer and our
552 * globals. Here is the right place to do so, because
553 * this is the first action (other than possibly a
554 * back-up) that will match for the new input source.
556 yy_n_chars = yy_current_buffer->yy_n_chars;
557 yy_current_buffer->yy_input_file = yyin;
558 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
561 /* Note that here we test for yy_c_buf_p "<=" to the position
562 * of the first EOB in the buffer, since yy_c_buf_p will
563 * already have been incremented past the NUL character
564 * (since all states make transitions on EOB to the
565 * end-of-buffer state). Contrast this with the test
568 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
569 { /* This was really a NUL. */
570 yy_state_type yy_next_state;
572 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
574 yy_current_state = yy_get_previous_state();
576 /* Okay, we're now positioned to make the NUL
577 * transition. We couldn't have
578 * yy_get_previous_state() go ahead and do it
579 * for us because it doesn't know how to deal
580 * with the possibility of jamming (and we don't
581 * want to build jamming into it because then it
582 * will run more slowly).
585 yy_next_state = yy_try_NUL_trans( yy_current_state );
587 yy_bp = yytext_ptr + YY_MORE_ADJ;
591 /* Consume the NUL. */
592 yy_cp = ++yy_c_buf_p;
593 yy_current_state = yy_next_state;
599 %% code to do back-up for compressed tables and set up yy_cp goes here
604 else switch ( yy_get_next_buffer() )
606 case EOB_ACT_END_OF_FILE:
608 yy_did_buffer_switch_on_eof = 0;
612 /* Note: because we've taken care in
613 * yy_get_next_buffer() to have set up
614 * yytext, we can now set up
615 * yy_c_buf_p so that if some total
616 * hoser (like flex itself) wants to
617 * call the scanner after we return the
618 * YY_NULL, it'll still work - another
619 * YY_NULL will get returned.
621 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
623 yy_act = YY_STATE_EOF(YY_START);
629 if ( ! yy_did_buffer_switch_on_eof )
635 case EOB_ACT_CONTINUE_SCAN:
637 yytext_ptr + yy_amount_of_matched_text;
639 yy_current_state = yy_get_previous_state();
642 yy_bp = yytext_ptr + YY_MORE_ADJ;
645 case EOB_ACT_LAST_MATCH:
647 &yy_current_buffer->yy_ch_buf[yy_n_chars];
649 yy_current_state = yy_get_previous_state();
652 yy_bp = yytext_ptr + YY_MORE_ADJ;
660 "fatal flex scanner internal error--no action found" );
661 } /* end of action switch */
662 } /* end of scanning one token */
666 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
674 yylineno = 1; // this will only get updated if %option yylineno
676 yy_did_buffer_switch_on_eof = 0;
678 yy_looking_for_trail_begin = 0;
681 yy_more_offset = yy_prev_more_offset = 0;
683 yy_start_stack_ptr = yy_start_stack_depth = 0;
686 yy_current_buffer = 0;
688 #ifdef YY_USES_REJECT
689 yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
695 yyFlexLexer::~yyFlexLexer()
698 yy_delete_buffer( yy_current_buffer );
701 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
705 yy_delete_buffer( yy_current_buffer );
706 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
713 #ifdef YY_INTERACTIVE
714 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
716 int yyFlexLexer::LexerInput( char* buf, int max_size )
719 if ( yyin->eof() || yyin->fail() )
722 #ifdef YY_INTERACTIVE
734 (void) yyin->read( buf, max_size );
739 return yyin->gcount();
743 void yyFlexLexer::LexerOutput( const char* buf, int size )
745 (void) yyout->write( buf, size );
749 /* yy_get_next_buffer - try to read in a new buffer
751 * Returns a code representing an action:
752 * EOB_ACT_LAST_MATCH -
753 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
754 * EOB_ACT_END_OF_FILE - end of file
758 static int yy_get_next_buffer()
760 int yyFlexLexer::yy_get_next_buffer()
763 register char *dest = yy_current_buffer->yy_ch_buf;
764 register char *source = yytext_ptr;
765 register int number_to_move, i;
768 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
770 "fatal flex scanner internal error--end of buffer missed" );
772 if ( yy_current_buffer->yy_fill_buffer == 0 )
773 { /* Don't try to fill the buffer, so this is an EOF. */
774 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
776 /* We matched a single character, the EOB, so
777 * treat this as a final EOF.
779 return EOB_ACT_END_OF_FILE;
784 /* We matched some text prior to the EOB, first
787 return EOB_ACT_LAST_MATCH;
791 /* Try to read more data. */
793 /* First move last chars to start of buffer. */
794 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
796 for ( i = 0; i < number_to_move; ++i )
797 *(dest++) = *(source++);
799 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
800 /* don't do the read, it's not guaranteed to return an EOF,
803 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
808 yy_current_buffer->yy_buf_size - number_to_move - 1;
810 while ( num_to_read <= 0 )
811 { /* Not enough room in the buffer - grow it. */
812 #ifdef YY_USES_REJECT
814 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
817 /* just a shorter name for the current buffer */
818 YY_BUFFER_STATE b = yy_current_buffer;
820 int yy_c_buf_p_offset =
821 (int) (yy_c_buf_p - b->yy_ch_buf);
823 if ( b->yy_is_our_buffer )
825 int new_size = b->yy_buf_size * 2;
828 b->yy_buf_size += b->yy_buf_size / 8;
832 b->yy_ch_buf = (char *)
833 /* Include room in for 2 EOB chars. */
834 yy_flex_realloc( (void *) b->yy_ch_buf,
835 b->yy_buf_size + 2 );
838 /* Can't grow it, we don't own it. */
841 if ( ! b->yy_ch_buf )
843 "fatal error - scanner input buffer overflow" );
845 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
847 num_to_read = yy_current_buffer->yy_buf_size -
852 if ( num_to_read > YY_READ_BUF_SIZE )
853 num_to_read = YY_READ_BUF_SIZE;
855 /* Read in more data. */
856 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
857 yy_n_chars, num_to_read );
859 yy_current_buffer->yy_n_chars = yy_n_chars;
862 if ( yy_n_chars == 0 )
864 if ( number_to_move == YY_MORE_ADJ )
866 ret_val = EOB_ACT_END_OF_FILE;
872 ret_val = EOB_ACT_LAST_MATCH;
873 yy_current_buffer->yy_buffer_status =
874 YY_BUFFER_EOF_PENDING;
879 ret_val = EOB_ACT_CONTINUE_SCAN;
881 yy_n_chars += number_to_move;
882 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
883 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
885 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
891 /* yy_get_previous_state - get the state just before the EOB char was reached */
894 static yy_state_type yy_get_previous_state()
896 yy_state_type yyFlexLexer::yy_get_previous_state()
899 register yy_state_type yy_current_state;
900 register char *yy_cp;
902 %% code to get the start state into yy_current_state goes here
904 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
906 %% code to find the next state goes here
909 return yy_current_state;
913 /* yy_try_NUL_trans - try to make a transition on the NUL character
916 * next_state = yy_try_NUL_trans( current_state );
921 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
923 static yy_state_type yy_try_NUL_trans( yy_current_state )
924 yy_state_type yy_current_state;
927 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
930 register int yy_is_jam;
931 %% code to find the next state, and perhaps do backing up, goes here
933 return yy_is_jam ? 0 : yy_current_state;
940 static void yyunput( int c, register char *yy_bp )
942 static void yyunput( c, yy_bp )
944 register char *yy_bp;
947 void yyFlexLexer::yyunput( int c, register char* yy_bp )
950 register char *yy_cp = yy_c_buf_p;
952 /* undo effects of setting up yytext */
953 *yy_cp = yy_hold_char;
955 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
956 { /* need to shift things up to make room */
957 /* +2 for EOB chars. */
958 register int number_to_move = yy_n_chars + 2;
959 register char *dest = &yy_current_buffer->yy_ch_buf[
960 yy_current_buffer->yy_buf_size + 2];
961 register char *source =
962 &yy_current_buffer->yy_ch_buf[number_to_move];
964 while ( source > yy_current_buffer->yy_ch_buf )
967 yy_cp += (int) (dest - source);
968 yy_bp += (int) (dest - source);
969 yy_current_buffer->yy_n_chars =
970 yy_n_chars = yy_current_buffer->yy_buf_size;
972 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
973 YY_FATAL_ERROR( "flex scanner push-back overflow" );
978 %% update yylineno here
981 yy_hold_char = *yy_cp;
985 #endif /* ifndef YY_NO_UNPUT */
992 static int yyinput YY_PROTO(( void ))
994 static int input YY_PROTO(( void ))
997 int yyFlexLexer::yyinput(void)
1002 *yy_c_buf_p = yy_hold_char;
1004 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1006 /* yy_c_buf_p now points to the character we want to return.
1007 * If this occurs *before* the EOB characters, then it's a
1008 * valid NUL; if not, then we've hit the end of the buffer.
1010 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1011 /* This was really a NUL. */
1015 { /* need more input */
1016 int offset = yy_c_buf_p - yytext_ptr;
1019 switch ( yy_get_next_buffer() )
1021 case EOB_ACT_LAST_MATCH:
1022 /* This happens because yy_g_n_b()
1023 * sees that we've accumulated a
1024 * token and flags that we need to
1025 * try matching the token before
1026 * proceeding. But for input(),
1027 * there's no matching to consider.
1028 * So convert the EOB_ACT_LAST_MATCH
1029 * to EOB_ACT_END_OF_FILE.
1032 /* Reset buffer status. */
1037 case EOB_ACT_END_OF_FILE:
1042 if ( ! yy_did_buffer_switch_on_eof )
1051 case EOB_ACT_CONTINUE_SCAN:
1052 yy_c_buf_p = yytext_ptr + offset;
1058 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1059 *yy_c_buf_p = '\0'; /* preserve yytext */
1060 yy_hold_char = *++yy_c_buf_p;
1062 %% update BOL and yylineno
1067 #endif /* ifndef YY_NO_INPUT */
1072 #ifdef YY_USE_PROTOS
1073 void yyrestart( FILE *input_file )
1075 void yyrestart( input_file )
1079 void yyFlexLexer::yyrestart( std::istream* input_file )
1082 if ( ! yy_current_buffer )
1083 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1085 yy_init_buffer( yy_current_buffer, input_file );
1086 yy_load_buffer_state();
1091 #ifdef YY_USE_PROTOS
1092 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1094 void yy_switch_to_buffer( new_buffer )
1095 YY_BUFFER_STATE new_buffer;
1098 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1101 if ( yy_current_buffer == new_buffer )
1104 if ( yy_current_buffer )
1106 /* Flush out information for old buffer. */
1107 *yy_c_buf_p = yy_hold_char;
1108 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1109 yy_current_buffer->yy_n_chars = yy_n_chars;
1112 yy_current_buffer = new_buffer;
1113 yy_load_buffer_state();
1115 /* We don't actually know whether we did this switch during
1116 * EOF (yywrap()) processing, but the only time this flag
1117 * is looked at is after yywrap() is called, so it's safe
1118 * to go ahead and always set it.
1120 yy_did_buffer_switch_on_eof = 1;
1125 #ifdef YY_USE_PROTOS
1126 void yy_load_buffer_state( void )
1128 void yy_load_buffer_state()
1131 void yyFlexLexer::yy_load_buffer_state()
1134 yy_n_chars = yy_current_buffer->yy_n_chars;
1135 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1136 yyin = yy_current_buffer->yy_input_file;
1137 yy_hold_char = *yy_c_buf_p;
1142 #ifdef YY_USE_PROTOS
1143 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1145 YY_BUFFER_STATE yy_create_buffer( file, size )
1150 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1155 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1157 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1159 b->yy_buf_size = size;
1161 /* yy_ch_buf has to be 2 characters longer than the size given because
1162 * we need to put in 2 end-of-buffer characters.
1164 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1165 if ( ! b->yy_ch_buf )
1166 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1168 b->yy_is_our_buffer = 1;
1170 yy_init_buffer( b, file );
1177 #ifdef YY_USE_PROTOS
1178 void yy_delete_buffer( YY_BUFFER_STATE b )
1180 void yy_delete_buffer( b )
1184 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1190 if ( b == yy_current_buffer )
1191 yy_current_buffer = (YY_BUFFER_STATE) 0;
1193 if ( b->yy_is_our_buffer )
1194 yy_flex_free( (void *) b->yy_ch_buf );
1196 yy_flex_free( (void *) b );
1201 #ifndef YY_ALWAYS_INTERACTIVE
1202 #ifndef YY_NEVER_INTERACTIVE
1207 #ifdef YY_USE_PROTOS
1208 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1210 void yy_init_buffer( b, file )
1216 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1220 yy_flush_buffer( b );
1222 b->yy_input_file = file;
1223 b->yy_fill_buffer = 1;
1226 #if YY_ALWAYS_INTERACTIVE
1227 b->yy_is_interactive = 1;
1229 #if YY_NEVER_INTERACTIVE
1230 b->yy_is_interactive = 0;
1232 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1236 b->yy_is_interactive = 0;
1242 #ifdef YY_USE_PROTOS
1243 void yy_flush_buffer( YY_BUFFER_STATE b )
1245 void yy_flush_buffer( b )
1250 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1258 /* We always need two end-of-buffer characters. The first causes
1259 * a transition to the end-of-buffer state. The second causes
1260 * a jam in that state.
1262 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1263 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1265 b->yy_buf_pos = &b->yy_ch_buf[0];
1268 b->yy_buffer_status = YY_BUFFER_NEW;
1270 if ( b == yy_current_buffer )
1271 yy_load_buffer_state();
1276 #ifndef YY_NO_SCAN_BUFFER
1278 #ifdef YY_USE_PROTOS
1279 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1281 YY_BUFFER_STATE yy_scan_buffer( base, size )
1289 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1290 base[size-1] != YY_END_OF_BUFFER_CHAR )
1291 /* They forgot to leave room for the EOB's. */
1294 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1296 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1298 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1299 b->yy_buf_pos = b->yy_ch_buf = base;
1300 b->yy_is_our_buffer = 0;
1301 b->yy_input_file = 0;
1302 b->yy_n_chars = b->yy_buf_size;
1303 b->yy_is_interactive = 0;
1305 b->yy_fill_buffer = 0;
1306 b->yy_buffer_status = YY_BUFFER_NEW;
1308 yy_switch_to_buffer( b );
1313 YY_BUFFER_STATE yy_scan_buffer( char *base, int size )
1315 return yy_scan_buffer(base, (yy_size_t) size);
1322 #ifndef YY_NO_SCAN_STRING
1324 #ifdef YY_USE_PROTOS
1325 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1327 YY_BUFFER_STATE yy_scan_string( yy_str )
1328 yyconst char *yy_str;
1332 for ( len = 0; yy_str[len]; ++len )
1335 return yy_scan_bytes( yy_str, len );
1341 #ifndef YY_NO_SCAN_BYTES
1343 #ifdef YY_USE_PROTOS
1344 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, yy_size_t len )
1346 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1347 yyconst char *bytes;
1355 /* Get memory for full buffer, including space for trailing EOB's. */
1357 buf = (char *) yy_flex_alloc( n );
1359 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1361 for ( i = 0; i < len; ++i )
1364 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1366 b = yy_scan_buffer( buf, n );
1368 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1370 /* It's okay to grow etc. this buffer, and we should throw it
1371 * away when we're done.
1373 b->yy_is_our_buffer = 1;
1378 YY_BUFFER_STATE yy_scan_bytes( yyconst char *base, int size )
1380 return yy_scan_bytes(base, (yy_size_t) size);
1387 #ifndef YY_NO_PUSH_STATE
1389 #ifdef YY_USE_PROTOS
1390 static void yy_push_state( int new_state )
1392 static void yy_push_state( new_state )
1396 void yyFlexLexer::yy_push_state( int new_state )
1399 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1403 yy_start_stack_depth += YY_START_STACK_INCR;
1404 new_size = yy_start_stack_depth * sizeof( int );
1406 if ( ! yy_start_stack )
1407 yy_start_stack = (int *) yy_flex_alloc( new_size );
1410 yy_start_stack = (int *) yy_flex_realloc(
1411 (void *) yy_start_stack, new_size );
1413 if ( ! yy_start_stack )
1415 "out of memory expanding start-condition stack" );
1418 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1425 #ifndef YY_NO_POP_STATE
1427 static void yy_pop_state()
1429 void yyFlexLexer::yy_pop_state()
1432 if ( --yy_start_stack_ptr < 0 )
1433 YY_FATAL_ERROR( "start-condition stack underflow" );
1435 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1440 #ifndef YY_NO_TOP_STATE
1442 static int yy_top_state()
1444 int yyFlexLexer::yy_top_state()
1447 return yy_start_stack[yy_start_stack_ptr - 1];
1451 #ifndef YY_EXIT_FAILURE
1452 #define YY_EXIT_FAILURE 2
1456 #ifdef YY_USE_PROTOS
1457 static void yy_fatal_error( yyconst char msg[] )
1459 static void yy_fatal_error( msg )
1463 (void) fprintf( stderr, "%s\n", msg );
1464 exit( YY_EXIT_FAILURE );
1469 void yyFlexLexer::LexerError( yyconst char msg[] )
1471 std::cerr << msg << std::endl;
1472 exit( YY_EXIT_FAILURE );
1477 /* Redefine yyless() so it works in section 3 code. */
1483 /* Undo effects of setting up yytext. */ \
1484 yytext[yyleng] = yy_hold_char; \
1485 yy_c_buf_p = yytext + n; \
1486 yy_hold_char = *yy_c_buf_p; \
1487 *yy_c_buf_p = '\0'; \
1493 /* Internal utility routines. */
1496 #ifdef YY_USE_PROTOS
1497 static void yy_flex_strncpy( char *s1, yyconst char *s2, yy_size_t n )
1499 static void yy_flex_strncpy( s1, s2, n )
1505 register yy_size_t i;
1506 for ( i = 0; i < n; ++i )
1511 #ifdef YY_NEED_STRLEN
1512 #ifdef YY_USE_PROTOS
1513 static yy_size_t yy_flex_strlen( yyconst char *s )
1515 static yy_size_t yy_flex_strlen( s )
1519 register yy_size_t n;
1520 for ( n = 0; s[n]; ++n )
1528 #ifdef YY_USE_PROTOS
1529 static void *yy_flex_alloc( yy_size_t size )
1531 static void *yy_flex_alloc( size )
1535 return (void *) malloc( size );
1538 #ifdef YY_USE_PROTOS
1539 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1541 static void *yy_flex_realloc( ptr, size )
1546 /* The cast to (char *) in the following accommodates both
1547 * implementations that use char* generic pointers, and those
1548 * that use void* generic pointers. It works with the latter
1549 * because both ANSI C and C++ allow castless assignment from
1550 * any pointer type to void*, and deal with argument conversions
1551 * as though doing an assignment.
1553 return (void *) realloc( (char *) ptr, size );
1556 #ifdef YY_USE_PROTOS
1557 static void yy_flex_free( void *ptr )
1559 static void yy_flex_free( ptr )