📄 lex_yy.c
字号:
#ifndef YY_PRESERVE /* the efficient default push-back scheme */static unsigned char yy_save; /* saved yytext[yyleng] */#define YY_USER { /* set up yytext for user */ \ yy_save = yytext[yyleng]; \ yytext[yyleng] = 0; \ }#define YY_SCANNER { /* set up yytext for scanner */ \ yytext[yyleng] = yy_save; \ }#else /* not-so efficient push-back for yytext mungers */static unsigned char yy_save [YYLMAX];static unsigned char *yy_push = yy_save+YYLMAX;#define YY_USER { \ size_t n = yy_end - yyleng; \ yy_push = yy_save+YYLMAX - n; \ if (n > 0) \ memmove(yy_push, yytext+yyleng, n); \ yytext[yyleng] = 0; \ }#define YY_SCANNER { \ size_t n = yy_save+YYLMAX - yy_push; \ if (n > 0) \ memmove(yytext+yyleng, yy_push, n); \ yy_end = yyleng + n; \ }#endif/* * The actual lex scanner (usually yylex(void)). */YYDECL {#line 161 "c:/mks/etc/yylex.c" register int c, i, yyst, yybase; int yyfmin, yyfmax; /* yy_la_act indices of final states */ int yyoldi, yyoleng; /* base i, yyleng before look-ahead */ if (yyin == NULL) /* for silly compilers (yes, I know)*/ yyin = stdin; if (yyout == NULL) yyout = stdout; i = yyleng; YY_SCANNER; yy_again: yyleng = i; /* determine previous char. */ if (i > 0) yy_lastc = yytext[i-1]; /* scan previously accepted token adjusting yylineno */ while (i > 0) if (yytext[--i] == YYNEWLINE) yylineno++; /* adjust pushback */ yy_end -= yyleng; memmove(yytext, yytext+yyleng, (size_t) yy_end); i = 0; yy_contin: yyoldi = i; /* run the state machine until it jams */ for (yy_sbuf[i] = yyst = yy_begin[yy_start + (yy_lastc == YYNEWLINE)]; !(yyst == yy_endst || YY_INTERACTIVE && yy_base[yyst] > yy_nxtmax && yy_default[yyst] == yy_endst); yy_sbuf[++i] = yyst) { YY_DEBUG(gettext("<state %d, i = %d>\n"), yyst, i); if (i >= YYLMAX) YY_FATAL(gettext("Token buffer overflow")); /* get input char */ if (i < yy_end) c = yy_tbuf[i]; /* get pushback char */ else if ((c = yygetc()) != EOF) { yy_end = i+1; yy_tbuf[i] = c = (unsigned char) c; } else /* c == EOF */ { if (i == yyoldi) /* no token */ if (yywrap()) return 0; else goto yy_again; else break; } YY_DEBUG(gettext("<input %d = 0x%02x>\n"), c, c); /* look up next state */ while ((yybase = yy_base[yyst]+c) > yy_nxtmax || yy_check[yybase] != yyst) { if (yyst == yy_endst) goto yy_jammed; yyst = yy_default[yyst]; } yyst = yy_next[yybase]; yy_jammed: ; } YY_DEBUG(gettext("<stopped %d, i = %d>\n"), yyst, i); if (yyst != yy_endst) ++i; yy_search: /* search backward for a final state */ while (--i > yyoldi) { yyst = yy_sbuf[i]; if ((yyfmin = yy_final[yyst]) < (yyfmax = yy_final[yyst+1])) goto yy_found; /* found final state(s) */ } /* no match, default action */ i = yyoldi + 1; output(yy_tbuf[yyoldi]); goto yy_again; yy_found: YY_DEBUG(gettext("<final state %d, i = %d>\n"), yyst, i); yyoleng = i; /* save length for REJECT */ /* pushback look-ahead RHS */ if ((c = (int)(yy_la_act[yyfmin]>>9) - 1) >= 0) { /* trailing context? */ unsigned char *bv = yy_look + c*YY_LA_SIZE; static unsigned char bits [8] = { 1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7 }; while (1) { if (--i < yyoldi) { /* no / */ i = yyoleng; break; } yyst = yy_sbuf[i]; if (bv[(unsigned)yyst/8] & bits[(unsigned)yyst%8]) break; } } /* perform action */ yyleng = i; YY_USER; switch (yy_la_act[yyfmin] & 0777) { case 0:#line 338 "scan.l" { comment(); /* Read in rest of comment. */ } break; case 1:#line 339 "scan.l" { char *temp_file_name; /* Count number of preprocessor statements. */ ++mod_pp; count(); /* Don't know why had to subtract 1. Oh well. */ yylineno = extract_line_number(yytext) - 1; /* Use new file name if present. */ temp_file_name = extract_file_name(yytext); if (temp_file_name != NULL) input_file_orig_name = temp_file_name; } break; case 2:#line 356 "scan.l" { /* For this and the following keywords, do some lexical accounting, fire the keyword trigger in case a rule uses a keyword as a trigger, then return token to parser. */ count(); return(TK_AUTO); } break; case 3:#line 363 "scan.l" { count(); return(TK_BREAK); } break; case 4:#line 364 "scan.l" { count(); return(TK_CASE); } break; case 5:#line 365 "scan.l" { count(); return(TK_CHAR); } break; case 6:#line 366 "scan.l" { count(); return(TK_CONST); } break; case 7:#line 367 "scan.l" { count(); return(TK_CONTINUE); } break; case 8:#line 368 "scan.l" { count(); return(TK_DEFAULT); } break; case 9:#line 369 "scan.l" { count(); return(TK_DO); } break; case 10:#line 370 "scan.l" { count(); return(TK_DOUBLE); } break; case 11:#line 371 "scan.l" { count(); return(TK_ELSE); } break; case 12:#line 372 "scan.l" { count(); return(TK_ENUM); } break; case 13:#line 373 "scan.l" { count(); return(TK_EXTERN); } break; case 14:#line 374 "scan.l" { count(); return(TK_FLOAT); } break; case 15:#line 375 "scan.l" { count(); return(TK_FOR); } break; case 16:#line 376 "scan.l" { count(); return(TK_GOTO); } break; case 17:#line 377 "scan.l" { count(); return(TK_IF); } break; case 18:#line 378 "scan.l" { count(); return(TK_INT); } break; case 19:#line 379 "scan.l" { count(); return(TK_LONG); } break; case 20:#line 380 "scan.l" { count(); return(TK_REGISTER); } break; case 21:#line 381 "scan.l" { count(); return(TK_RETURN); } break; case 22:#line 382 "scan.l" { count(); return(TK_SHORT); } break; case 23:#line 383 "scan.l" { count(); return(TK_SIGNED); } break; case 24:#line 384 "scan.l" { count(); return(TK_SIZEOF); } break; case 25:#line 385 "scan.l" { count(); return(TK_STATIC); } break; case 26:#line 386 "scan.l" { count(); return(TK_STRUCT); } break; case 27:#line 387 "scan.l" { count(); return(TK_SWITCH); } break; case 28:#line 388 "scan.l" { count(); return(TK_TYPEDEF); } break; case 29:#line 389 "scan.l" { count(); return(TK_UNION); } break; case 30:#line 390 "scan.l" { count(); return(TK_UNSIGNED); } break; case 31:#line 391 "scan.l" { count(); return(TK_VOID); } break; case 32:#line 392 "scan.l" { count(); return(TK_VOLATILE); } break; case 33:#line 393 "scan.l" { count(); return(TK_WHILE); } break; case 34:#line 395 "scan.l" { /* If a replacement was provided on the command line for this identifier, rescan input which will now have the replacement characters. Otherwise, do some lexical accounting and return token to parser (this is either an identifier or a typedef type name). */ if (!identifier_defined(yytext)) { count(); return(check_type()); } } break; case 35:#line 412 "scan.l" { /* For this and the following constants and string literals, do some lexical accounting and return token to parser. */ count(); return(TK_CONSTANT); } break; case 36:#line 418 "scan.l" { count(); return(TK_CONSTANT); } break; case 37:#line 419 "scan.l" { count(); return(TK_CONSTANT); } break; case 38:#line 420 "scan.l" { count(); return(TK_CONSTANT); } break; case 39:#line 421 "scan.l" { count(); return(TK_CONSTANT); } break; case 40:#line 422 "scan.l" { count(); return(TK_CONSTANT); } break; case 41:#line 423 "scan.l" { count(); return(TK_CONSTANT); } break; case 42:#line 424 "scan.l" { count(); return(TK_STRING_LITERAL); } break; case 43:#line 426 "scan.l" { /* For this and the following operators, do some lexical accounting and return token to parser. */ count(); return(TK_ELIPSIS); } break; case 44:#line 432 "scan.l" { count(); return(TK_RIGHT_ASSIGN); } break; case 45:#line 433 "scan.l" { count(); return(TK_LEFT_ASSIGN); } break; case 46:#line 434 "scan.l" { count(); return(TK_ADD_ASSIGN); } break; case 47:#line 435 "scan.l" { count(); return(TK_SUB_ASSIGN); } break; case 48:#line 436 "scan.l" { count(); return(TK_MUL_ASSIGN); } break; case 49:#line 437 "scan.l" { count(); return(TK_DIV_ASSIGN); } break; case 50:#line 438 "scan.l" { count(); return(TK_MOD_ASSIGN); } break; case 51:#line 439 "scan.l" { count(); return(TK_AND_ASSIGN); } break; case 52:#line 440 "scan.l" { count(); return(TK_XOR_ASSIGN); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -