📄 doslex.c
字号:
static const short int yy_def[37] = { 0, 33, 1, 33, 33, 33, 33, 34, 35, 33, 33, 33, 33, 33, 33, 33, 33, 36, 33, 33, 36, 34, 33, 34, 34, 35, 33, 33, 33, 36, 34, 34, 34, 0, 33, 33, 33 } ;static const short int yy_nxt[76] = { 0, 4, 5, 6, 7, 8, 9, 10, 4, 11, 12, 13, 14, 15, 16, 17, 18, 4, 19, 20, 4, 22, 22, 30, 29, 27, 26, 22, 22, 30, 27, 28, 27, 30, 23, 23, 23, 24, 24, 24, 31, 23, 32, 24, 24, 24, 23, 26, 33, 24, 21, 21, 21, 25, 25, 3, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 } ;static const short int yy_chk[76] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 21, 23, 36, 27, 25, 24, 30, 31, 15, 14, 11, 32, 7, 21, 23, 7, 21, 23, 24, 30, 31, 24, 30, 31, 32, 8, 3, 32, 34, 34, 34, 35, 35, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 } ;static yy_state_type yy_last_accepting_state;static YY_CHAR *yy_last_accepting_cpos;/* the intent behind this definition is that it'll catch * any uses of REJECT which flex missed */#define REJECT reject_used_but_not_detected#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0/* these variables are all declared out here so that section 3 code can * manipulate them *//* points to current character in buffer */static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0;static int yy_init = 1; /* whether we need to initialize */static int yy_start = 0; /* start state number *//* flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */static int yy_did_buffer_switch_on_eof;static yy_state_type yy_get_previous_state YY_PROTO(( void ));static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));static int yy_get_next_buffer YY_PROTO(( void ));static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));void yyrestart YY_PROTO(( FILE *input_file ));void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));void yy_load_buffer_state YY_PROTO(( void ));YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));#define yy_new_buffer yy_create_buffer#ifdef __cplusplus static int yyinput YY_PROTO(( void ));#else static int input YY_PROTO(( void ));#endifYY_DECL { register yy_state_type yy_current_state; register YY_CHAR *yy_cp, *yy_bp; register int yy_act; if ( yy_init ) { YY_USER_INIT; if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( yy_current_buffer ) yy_init_buffer( yy_current_buffer, yyin ); else yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); yy_init = 0; }#if !defined(__VISAGECPP__) while ( 1 ) /* loops until end-of-file is reached */#else os2var = 1; if (os2var == 0) return 0; while ( os2var == 1 ) /* loops until end-of-file is reached */#endif { yy_cp = yy_c_buf_p; /* support of yytext */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of the * current run. */ yy_bp = yy_cp; yy_current_state = yy_start;yy_match: do { register YY_CHAR yy_c = yy_ec[*yy_cp]; 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_cp; } while ( yy_current_state != 33 ); yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state;yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; YY_USER_ACTION;do_action: /* this label is used only to access EOF actions */ switch ( yy_act ) { case 0: /* must backtrack */ { /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; } case 1: { yylval.s = strdup((const char*) yytext); return INTEGER; } case 2: { return EXP; } case 3: { yylval.s = strdup((const char*) yytext); return WORD; } case 4: { int len = strlen((const char*) yytext); yytext[len-1] = 0; yylval.s = strdup((const char*) (yytext+1)); return WORD; } case 5: { yylval.s = strdup((const char*) yytext); return STRING; } case 6: { return OPEN; } case 7: { return CLOSE; } case 8: { return COMMA; } case 9: { return OPEN_SQUARE; } case 10: { return CLOSE_SQUARE; } case 11: { return EQUALS; } case 12: { return PERIOD; } case 13: { break; } case 14: { break; } case 15: { loop:#ifdef __cplusplus while (yyinput() != '*') ; switch (yyinput())#else while (input() != '*') ; switch (input())#endif { case '/': break; case '*': unput('*'); default: goto loop; } break; } case 16: { return ERROR; } case 17: { ECHO; break; } case YY_STATE_EOF(INITIAL): { yyterminate(); } case YY_END_OF_BUFFER: { /* amount of text matched not including the EOB char */ int yy_amount_of_matched_text = yy_cp - yytext - 1; /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; /* note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the end- * of-buffer state). Contrast this with the test in yyinput(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* this was really a NUL */ { yy_state_type yy_next_state; yy_c_buf_p = yytext + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* okay, we're now positioned to make the * NUL transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we * don't want to build jamming into it because * then it will run more slowly) */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext + YY_MORE_ADJ; if ( yy_next_state ) { /* consume the NUL */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* note: because we've taken care in * yy_get_next_buffer() to have set up yytext, * we can now set up yy_c_buf_p so that if some * total hoser (like flex itself) wants * to call the scanner after we return the * YY_NULL, it'll still work - another YY_NULL * will get returned. */ yy_c_buf_p = yytext + YY_MORE_ADJ; yy_act = YY_STATE_EOF((yy_start - 1) / 2); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } } break; case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext + YY_MORE_ADJ; goto yy_find_action; } } break; default:#ifdef FLEX_DEBUG printf( "action # %d\n", yy_act );#endif YY_FATAL_ERROR("fatal flex scanner internal error--no action found" ); } }#if defined(__VISAGECPP__) /* VA complains about proc maybe not returning a value so return one */ return 0;#endif}/* yy_get_next_buffer - try to read in a new buffer * * synopsis * int yy_get_next_buffer(); * * returns a code representing an action * 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(){ register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; register YY_CHAR *source = yytext - 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" ); /* try to read more data */ /* first move last chars to start of buffer */ number_to_move = yy_c_buf_p - yytext; 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; if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; else if ( num_to_read <= 0 ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); /* read in more data */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -