📄 lex.yy.c
字号:
#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ }\\#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* end tables serialization structures and prototypes *//* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL_IS_OURS 1extern int yylex (void);#define YY_DECL int yylex (void)#endif /* !YY_DECL *//* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endif#define YY_RULE_SETUP \ YY_USER_ACTION/** The main scanner function which does all the work. */YY_DECL{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 34 "spl.l"#line 695 "lex.yy.c" if ( !(yy_init) ) { (yy_init) = 1;#ifdef YY_USER_INIT YY_USER_INIT;#endif if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { yyensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin,YY_BUF_SIZE ); } yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { 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_SC_TO_UI(*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 = (int) yy_def[yy_current_state]; if ( yy_current_state >= 58 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 167 );yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = (yy_last_accepting_cpos); yy_current_state = (yy_last_accepting_state); yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION;do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* 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:YY_RULE_SETUP#line 35 "spl.l"{ int c; /* DUMP_SOURCE */ while ((c = input())) { if (c == '}') { break; } else if (c == '\n') { line_no ++; } } if (c == EOF) parse_error("Unexpected EOF.",""); } YY_BREAKcase 2:YY_RULE_SETUP#line 56 "spl.l"{ DUMP_SOURCE yylval.num = stoi(yytext, 10); if (dump_token) { printf("token: cINTEGER, yylval.num = %d.\n", yylval.num); } return cINTEGER; } YY_BREAKcase 3:YY_RULE_SETUP#line 66 "spl.l"{ DUMP_SOURCE yylval.num = stoi(yytext, 8); if (dump_token) { printf("token: cINTEGER, yylval.num = %d.\n", yylval.num); } return cINTEGER; } YY_BREAKcase 4:YY_RULE_SETUP#line 76 "spl.l"{ DUMP_SOURCE yylval.num = stoi(yytext, 16); if (dump_token) { printf("token: cINTEGER, yylval.num = %d.\n", yylval.num); } return cINTEGER; } YY_BREAKcase 5:YY_RULE_SETUP#line 86 "spl.l"{ DUMP_SOURCE strncpy(yylval.p_char, yytext, NAME_LEN); if (dump_token) { printf("token: cREAL, yylval.p_char = %s.\n", yylval.p_char); } return cREAL; } YY_BREAKcase 6:/* rule 6 can match eol */YY_RULE_SETUP#line 96 "spl.l"{ DUMP_SOURCE strncpy(yylval.p_char, yytext, NAME_LEN); if (dump_token) { printf("token: cCHAR, yylval.p_char = %s.\n", yylval.p_char); } return cCHAR; } YY_BREAKcase 7:/* rule 7 can match eol */YY_RULE_SETUP#line 106 "spl.l"{ DUMP_SOURCE strncpy(yylval.p_char, yytext, NAME_LEN); if (dump_token) { printf("token: cSTRING, yylval.p_char = %s.\n", yylval.p_char); } return cSTRING; } YY_BREAKcase 8:YY_RULE_SETUP#line 116 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oLP.\n"); } return oLP; } YY_BREAKcase 9:YY_RULE_SETUP#line 122 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oRP.\n"); } return oRP; } YY_BREAKcase 10:YY_RULE_SETUP#line 128 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oLB.\n"); } return oLB; } YY_BREAKcase 11:YY_RULE_SETUP#line 134 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oRB.\n"); } return oRB; } YY_BREAKcase 12:YY_RULE_SETUP#line 140 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oPLUS.\n"); } return oPLUS; } YY_BREAKcase 13:YY_RULE_SETUP#line 146 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oMINUS.\n"); } return oMINUS; } YY_BREAKcase 14:YY_RULE_SETUP#line 152 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oMUL.\n"); } return oMUL; } YY_BREAKcase 15:YY_RULE_SETUP#line 158 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oDIV.\n"); } return oDIV; } YY_BREAKcase 16:YY_RULE_SETUP#line 164 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oASSIGN.\n"); } return oASSIGN; } YY_BREAKcase 17:YY_RULE_SETUP#line 170 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oEQUAL.\n"); } return oEQUAL; } YY_BREAKcase 18:YY_RULE_SETUP#line 176 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oLT.\n"); } return oLT; } YY_BREAKcase 19:YY_RULE_SETUP#line 182 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oGT.\n"); } return oGT; } YY_BREAKcase 20:YY_RULE_SETUP#line 188 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oLE.\n"); } return oLE; } YY_BREAKcase 21:YY_RULE_SETUP#line 194 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oGE.\n"); } return oGE; } YY_BREAKcase 22:YY_RULE_SETUP#line 200 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oUNEQU.\n"); } return oUNEQU; } YY_BREAKcase 23:YY_RULE_SETUP#line 206 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oCOMMA.\n"); } return oCOMMA; } YY_BREAKcase 24:YY_RULE_SETUP#line 212 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oSEMI.\n"); } return oSEMI; } YY_BREAKcase 25:YY_RULE_SETUP#line 218 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oCOLON.\n"); } return oCOLON; } YY_BREAKcase 26:YY_RULE_SETUP#line 224 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oQUOTE.\n"); } return oQUOTE; } YY_BREAKcase 27:YY_RULE_SETUP#line 230 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oDOTDOT.\n"); } return oDOTDOT; } YY_BREAKcase 28:YY_RULE_SETUP#line 236 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oDOT.\n"); } return oDOT; } YY_BREAKcase 29:YY_RULE_SETUP#line 242 "spl.l"{ DUMP_SOURCE if (dump_token) { printf("token: oARROW.\n"); } return oARROW; } YY_BREAKcase 30:YY_RULE_SETUP#line 248 "spl.l"{ DUMP_SOURCE strncpy(yylval.p_char, yytext, NAME_LEN); return id_or_keyword(yytext); } YY_BREAKcase 31:/* rule 31 can match eol */YY_RULE_SETUP#line 253 "spl.l"{ line_no++; line_pos = 0; line_buf[line_pos] = 0; } YY_BREAKcase 32:YY_RULE_SETUP#line 258 "spl.l"{ DUMP_SOURCE } YY_BREAKcase 33:YY_RULE_SETUP#line 261 "spl.l"ECHO; YY_BREAK#line 1133 "lex.yy.c"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 = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* 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 input(). */ if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -