📄 flex.skl
字号:
* EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */%-static int yy_get_next_buffer()%+int yyFlexLexer::yy_get_next_buffer()%* { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr - 1; /* copy prev. char, too */ register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a singled characater, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = yy_c_buf_p - yytext_ptr; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */#ifdef YY_USES_REJECT YY_FATAL_ERROR("input buffer overflow, can't enlarge buffer because scanner uses REJECT" );#else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf; b->yy_buf_size *= 2; b->yy_ch_buf = (char *) yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1;#endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); } if ( yy_n_chars == 0 ) { if ( number_to_move - YY_MORE_ADJ == 1 ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_eof_status = EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; /* yytext begins at the second character in yy_ch_buf; the first * character is the one which preceded it before reading in the latest * buffer; it needs to be kept around in case it's a newline, so * yy_get_previous_state() will have with '^' rules active. */ yytext_ptr = &yy_current_buffer->yy_ch_buf[1]; return ret_val; }/* yy_get_previous_state - get the state just before the EOB char was reached */%-static yy_state_type yy_get_previous_state()%+yy_state_type yyFlexLexer::yy_get_previous_state()%* { register yy_state_type yy_current_state; register char *yy_cp;%% code to get the start state into yy_current_state goes here for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) {%% code to find the next state goes here } return yy_current_state; }/* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */%-#ifdef YY_USE_PROTOSstatic yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )#elsestatic yy_state_type yy_try_NUL_trans( yy_current_state )yy_state_type yy_current_state;#endif%+yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )%* { register int yy_is_jam;%% code to find the next state, and perhaps do backing up, goes here return yy_is_jam ? 0 : yy_current_state; }%-#ifdef YY_USE_PROTOSstatic void yyunput( int c, register char *yy_bp )#elsestatic void yyunput( c, yy_bp )int c;register char *yy_bp;#endif%+void yyFlexLexer::yyunput( int c, register char* yy_bp )%* { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += dest - source; yy_bp += dest - source; yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) yy_cp[-2] = '\n'; *--yy_cp = (char) c;%% update yylineno here, if doing -l /* Note: the formal parameter *must* be called "yy_bp" for this * macro to now work correctly. */ YY_DO_BEFORE_ACTION; /* set up yytext again */ }%-#ifndef input#ifdef __cplusplusstatic int yyinput()#elsestatic int input()#endif%+int yyFlexLexer::yyinput()%* { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ yytext_ptr = yy_c_buf_p; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; return EOF; } YY_NEW_FILE;#ifdef __cplusplus return yyinput();#else return input();#endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; break; case EOB_ACT_LAST_MATCH:#ifdef __cplusplus YY_FATAL_ERROR( "unexpected last match in yyinput()" );#else YY_FATAL_ERROR( "unexpected last match in input()" );#endif } } } c = *yy_c_buf_p; *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; }#endif%-#ifdef YY_USE_PROTOSvoid yyrestart( FILE *input_file )#elsevoid yyrestart( input_file )FILE *input_file;#endif%+void yyFlexLexer::yyrestart( istream* input_file )%* { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); }%-#ifdef YY_USE_PROTOSvoid yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )#elsevoid yy_switch_to_buffer( new_buffer )YY_BUFFER_STATE new_buffer;#endif%+void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )%* { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; }%-#ifdef YY_USE_PROTOSvoid yy_load_buffer_state( void )#elsevoid yy_load_buffer_state()#endif%+void yyFlexLexer::yy_load_buffer_state()%* { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; }%-#ifdef YY_USE_PROTOSYY_BUFFER_STATE yy_create_buffer( FILE *file, int size )#elseYY_BUFFER_STATE yy_create_buffer( file, size )FILE *file;int size;#endif%+YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )%* { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); return b; }%-#ifdef YY_USE_PROTOSvoid yy_delete_buffer( YY_BUFFER_STATE b )#elsevoid yy_delete_buffer( b )YY_BUFFER_STATE b;#endif%+void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )%* { if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); }%-#ifdef YY_USE_PROTOSvoid yy_init_buffer( YY_BUFFER_STATE b, FILE *file )#elsevoid yy_init_buffer( b, file )YY_BUFFER_STATE b;FILE *file;#endif%+void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )%* { b->yy_input_file = file; /* We put in the '\n' and start reading from [1] so that an * initial match-at-newline will be true. */ b->yy_ch_buf[0] = '\n'; b->yy_n_chars = 1; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[1];%- b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;%+ b->yy_is_interactive = 0;%* b->yy_fill_buffer = 1; b->yy_eof_status = EOF_NOT_SEEN; }%-#ifdef YY_USE_PROTOSstatic void yy_push_state( int new_state )#elsestatic void yy_push_state( new_state )int new_state;#endif%+void yyFlexLexer::yy_push_state( int new_state )%* { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { int new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); }%-static void yy_pop_state()%+void yyFlexLexer::yy_pop_state()%* { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); }%-static int yy_top_state()%+int yyFlexLexer::yy_top_state()%* { return yy_start_stack[yy_start_stack_ptr - 1]; }%-#ifdef YY_USE_PROTOSstatic void yy_fatal_error( const char msg[] )#elsestatic void yy_fatal_error( msg )char msg[];#endif { (void) fprintf( stderr, "%s\n", msg ); exit( 1 ); }%+void yyFlexLexer::LexerError( const char msg[] ) { cerr << msg << '\n'; exit( 1 ); }%*/* Redefine yyless() so it works in section 3 code. */#undef yyless#define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 )/* Internal utility routines. */#ifndef yytext_ptr#ifdef YY_USE_PROTOSstatic void yy_flex_strcpy( char *s1, const char *s2 )#elsestatic void yy_flex_strcpy( s1, s2 )char *s1;const char *s2;#endif { while ( (*(s1++) = *(s2++)) ) ; }#endif#ifdef YY_USE_PROTOSstatic void *yy_flex_alloc( unsigned int size )#elsestatic void *yy_flex_alloc( size )unsigned int size;#endif { return (void *) malloc( size ); }#ifdef YY_USE_PROTOSstatic void *yy_flex_realloc( void *ptr, unsigned int size )#elsestatic void *yy_flex_realloc( ptr, size )void *ptr;unsigned int size;#endif { return (void *) realloc( ptr, size ); }#ifdef YY_USE_PROTOSstatic void yy_flex_free( void *ptr )#elsestatic void yy_flex_free( ptr )void *ptr;#endif { free( ptr ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -