📄 doslex.c
字号:
if ( yy_n_chars == 0 ) { if ( number_to_move == 1 ) { ret_val = EOB_ACT_END_OF_FILE; yy_current_buffer->yy_eof_status = EOF_DONE; } 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 = &yy_current_buffer->yy_ch_buf[1]; return ( ret_val );}/* yy_get_previous_state - get the state just before the EOB char was reached * * synopsis * yy_state_type yy_get_previous_state(); */static yy_state_type yy_get_previous_state(){ register yy_state_type yy_current_state; register YY_CHAR *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = yy_def[yy_current_state]; if ( yy_current_state >= 34 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } 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( register yy_state_type yy_current_state )#elsestatic yy_state_type yy_try_NUL_trans( yy_current_state )register yy_state_type yy_current_state;#endif{ register int yy_is_jam; register YY_CHAR *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = yy_def[yy_current_state]; if ( yy_current_state >= 34 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 33); return ( yy_is_jam ? 0 : yy_current_state );}#ifdef YY_USE_PROTOSstatic void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )#elsestatic void yyunput( c, yy_bp )YY_CHAR c;register YY_CHAR *yy_bp;#endif{ register YY_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 */ register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ register YY_CHAR *dest = &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; register YY_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 = c; /* note: the formal parameter *must* be called "yy_bp" for this * macro to now work correctly */ YY_DO_BEFORE_ACTION; /* set up yytext again */}#ifdef __cplusplusstatic int yyinput()#elsestatic int input()#endif{ int c; YY_CHAR *yy_cp = yy_c_buf_p; *yy_cp = 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 = 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 + 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 + 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_hold_char = *++yy_c_buf_p; return ( c );}#ifdef YY_USE_PROTOSvoid yyrestart( FILE *input_file )#elsevoid yyrestart( input_file )FILE *input_file;#endif{ 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{ 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{ yy_n_chars = yy_current_buffer->yy_n_chars; yytext = 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 b; b = (YY_BUFFER_STATE) malloc( 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 = (YY_CHAR *) malloc( (unsigned) (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{ if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; free( (char *) b->yy_ch_buf ); free( (char *) 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{ 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_eof_status = EOF_NOT_SEEN;}/* # line 108 "lexer.l" */#ifdef FLEX_SCANNER static int lex_input() { return input(); }#else /* BSD/AT&T lex */ #ifndef input #error "Sorry, but need either flex or AT&T lex" #endif static int lex_input() { return input(); } /* # undef unput # define unput(_c) my_unput(_c) */ # undef input # define input() my_input() static int my_unput(char c) { if (lex_read_from_string) { /* Make sure we have something */ if (lex_string_ptr) { if (c == '\n') yylineno--; lex_string_ptr--; } } else { yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar; /* unput(c); Causes infinite recursion! */ } return c; }#endif/* Public */void LexFromFile(FILE *fd){ lex_read_from_string = 0; yyin = fd; /* Don't know why this is necessary, but otherwise * lex only works _once_! */#ifdef FLEX_SCANNER yy_init = 1;#endif}void LexFromString(char *buffer){ lex_read_from_string = 1; lex_buffer = buffer; lex_buffer_length = strlen((const char*) buffer); lex_string_ptr = 0; /* Don't know why this is necessary, but otherwise * lex only works _once_! */#ifdef FLEX_SCANNER yy_init = 1;#endif}static int my_input( void ){ if (lex_read_from_string) { if (lex_string_ptr == lex_buffer_length) { return 0; } else { char c = lex_buffer[lex_string_ptr++];#ifndef FLEX_SCANNER if (c == '\n') yylineno++;#endif return c; } } else { return lex_input(); }}void wxExprCleanUp(){ if (yy_current_buffer) yy_delete_buffer(yy_current_buffer);}#ifdef __VISUALC__ #pragma warning(pop)#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -