📄 y_tab.c
字号:
*/ YYABORT; case 3: /* no shift yet; eat a token */#if YYDEBUG /* ** if debugging, look up token in list of ** pairs. 0 and negative shouldn't occur, ** but since timing doesn't matter when ** debugging, it doesn't hurt to leave the ** tests here. */ if ( yydebug ) { register int yy_i; (void)printf( "Error recovery discards " ); if ( yychar == 0 ) (void)printf( "token end-of-file\n" ); else if ( yychar < 0 ) (void)printf( "token -none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) { break; } } (void)printf( "token %s\n", yytoks[yy_i].t_name ); } }#endif /* YYDEBUG */ if ( yychar == 0 ) /* reached EOF. quit */ YYABORT; yychar = -1; goto yy_newstate; } }/* end if ( yy_n == 0 ) */ /* ** reduction by production yy_n ** put stack tops, etc. so things right after switch */#if YYDEBUG /* ** if debugging, print the string that is the user's ** specification of the reduction which is just about ** to be done. */ if ( yydebug ) (void)printf( "Reduce by (%d) \"%s\"\n", yy_n, yyreds[ yy_n ] );#endif yytmp = yy_n; /* value to switch over */ yypvt = yy_pv; /* $vars top of value stack */ /* ** Look in goto table for next state ** Sorry about using yy_state here as temporary ** register variable, but why not, if it works... ** If yyr2[ yy_n ] doesn't have the low order bit ** set, then there is no action to be done for ** this reduction. So, no saving & unsaving of ** registers done. The only difference between the ** code just after the if and the body of the if is ** the goto yy_stack in the body. This way the test ** can be made before the choice of what to do is needed. */ { /* length of production doubled with extra bit */ register int yy_len = yyr2[ yy_n ]; if ( !( yy_len & 01 ) ) { yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } goto yy_stack; } yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } } /* save until reenter driver code */ yystate = yy_state; yyps = yy_ps; yypv = yy_pv; } /* ** code supplied by user is placed in this switch */ switch( yytmp ) { case 2:# line 179 "lua.stx"{pc=basepc=maincode; nlocalvar=0;} break;case 3:# line 179 "lua.stx"{maincode=pc;} break;case 6:# line 184 "lua.stx"{pc=basepc=code; nlocalvar=0;} break;case 7:# line 185 "lua.stx"{ if (lua_debug) { align(Word); code_byte(SETFUNCTION); code_word(yypvt[-5].vWord); code_word(yypvt[-4].vWord); } lua_codeadjust (0); } break;case 8:# line 197 "lua.stx"{ if (lua_debug) code_byte(RESET); code_byte(RETCODE); code_byte(nlocalvar); s_tag(yypvt[-7].vWord) = T_FUNCTION; s_bvalue(yypvt[-7].vWord) = calloc (pc-code, sizeof(Byte)); memcpy (s_bvalue(yypvt[-7].vWord), code, (pc-code)*sizeof(Byte)); } break;case 11:# line 210 "lua.stx"{ ntemp = 0; if (lua_debug) { align(Word); code_byte(SETLINE); code_word(lua_linenumber); } } break;case 15:# line 223 "lua.stx"{ { Byte *elseinit = yypvt[-2].pByte + sizeof(Word)+1; if (pc - elseinit == 0) /* no else */ { pc -= sizeof(Word)+1; /* if (*(pc-1) == NOP) --pc; */ elseinit = pc; } else { *(yypvt[-2].pByte) = JMP; *((Word *)(yypvt[-2].pByte+1)) = pc - elseinit; } *(yypvt[-4].pByte) = IFFJMP; *((Word *)(yypvt[-4].pByte+1)) = elseinit - (yypvt[-4].pByte + sizeof(Word)+1); } } break;case 16:# line 242 "lua.stx"{yyval.pByte = pc;} break;case 17:# line 244 "lua.stx"{ *(yypvt[-3].pByte) = IFFJMP; *((Word *)(yypvt[-3].pByte+1)) = pc - (yypvt[-3].pByte + sizeof(Word)+1); *(yypvt[-1].pByte) = UPJMP; *((Word *)(yypvt[-1].pByte+1)) = pc - yypvt[-6].pByte; } break;case 18:# line 252 "lua.stx"{yyval.pByte = pc;} break;case 19:# line 254 "lua.stx"{ *(yypvt[-0].pByte) = IFFUPJMP; *((Word *)(yypvt[-0].pByte+1)) = pc - yypvt[-4].pByte; } break;case 20:# line 261 "lua.stx"{ { int i; if (yypvt[-0].vInt == 0 || nvarbuffer != ntemp - yypvt[-2].vInt * 2) lua_codeadjust (yypvt[-2].vInt * 2 + nvarbuffer); for (i=nvarbuffer-1; i>=0; i--) lua_codestore (i); if (yypvt[-2].vInt > 1 || (yypvt[-2].vInt == 1 && varbuffer[0] != 0)) lua_codeadjust (0); } } break;case 21:# line 272 "lua.stx"{ lua_codeadjust (0); } break;case 25:# line 279 "lua.stx"{ { Byte *elseinit = yypvt[-1].pByte + sizeof(Word)+1; if (pc - elseinit == 0) /* no else */ { pc -= sizeof(Word)+1; /* if (*(pc-1) == NOP) --pc; */ elseinit = pc; } else { *(yypvt[-1].pByte) = JMP; *((Word *)(yypvt[-1].pByte+1)) = pc - elseinit; } *(yypvt[-3].pByte) = IFFJMP; *((Word *)(yypvt[-3].pByte+1)) = elseinit - (yypvt[-3].pByte + sizeof(Word)+1); } } break;case 26:# line 299 "lua.stx"{yyval.vInt = nlocalvar;} break;case 27:# line 299 "lua.stx"{ntemp = 0;} break;case 28:# line 300 "lua.stx"{ if (nlocalvar != yypvt[-3].vInt) { nlocalvar = yypvt[-3].vInt; lua_codeadjust (0); } } break;case 30:# line 310 "lua.stx"{ if (lua_debug){align(Word);code_byte(SETLINE);code_word(lua_linenumber);}} break;case 31:# line 312 "lua.stx"{ if (lua_debug) code_byte(RESET); code_byte(RETCODE); code_byte(nlocalvar); } break;case 32:# line 319 "lua.stx"{ align(Word); yyval.pByte = pc; code_byte(0); /* open space */ code_word (0); } break;case 33:# line 326 "lua.stx"{ if (yypvt[-0].vInt == 0) {lua_codeadjust (ntemp+1); incr_ntemp();}} break;case 34:# line 329 "lua.stx"{ yyval.vInt = yypvt[-1].vInt; } break;case 35:# line 330 "lua.stx"{ code_byte(EQOP); yyval.vInt = 1; ntemp--;} break;case 36:# line 331 "lua.stx"{ code_byte(LTOP); yyval.vInt = 1; ntemp--;} break;case 37:# line 332 "lua.stx"{ code_byte(LEOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;case 38:# line 333 "lua.stx"{ code_byte(EQOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;case 39:# line 334 "lua.stx"{ code_byte(LEOP); yyval.vInt = 1; ntemp--;} break;case 40:# line 335 "lua.stx"{ code_byte(LTOP); code_byte(NOTOP); yyval.vInt = 1; ntemp--;} break;case 41:# line 336 "lua.stx"{ code_byte(ADDOP); yyval.vInt = 1; ntemp--;} break;case 42:# line 337 "lua.stx"{ code_byte(SUBOP); yyval.vInt = 1; ntemp--;} break;case 43:# line 338 "lua.stx"{ code_byte(MULTOP); yyval.vInt = 1; ntemp--;} break;case 44:# line 339 "lua.stx"{ code_byte(DIVOP); yyval.vInt = 1; ntemp--;} break;case 45:# line 340 "lua.stx"{ code_byte(CONCOP); yyval.vInt = 1; ntemp--;} break;case 46:# line 341 "lua.stx"{ yyval.vInt = 1; } break;case 47:# line 342 "lua.stx"{ code_byte(MINUSOP); yyval.vInt = 1;} break;case 48:# line 344 "lua.stx"{ code_byte(PUSHBYTE); yyval.pByte = pc; code_byte(0); incr_ntemp(); code_byte(CREATEARRAY); } break;case 49:# line 351 "lua.stx"{ *(yypvt[-2].pByte) = yypvt[-0].vInt; if (yypvt[-1].vLong < 0) /* there is no function to be called */ { yyval.vInt = 1; } else { lua_pushvar (yypvt[-1].vLong+1); code_byte(PUSHMARK); incr_ntemp(); code_byte(PUSHOBJECT); incr_ntemp(); code_byte(CALLFUNC); ntemp -= 4; yyval.vInt = 0; if (lua_debug) { align(Word); code_byte(SETLINE); code_word(lua_linenumber); } } } break;case 50:# line 374 "lua.stx"{ code_byte(CREATEARRAY); yyval.vInt = 1; } break;case 51:# line 378 "lua.stx"{ lua_pushvar (yypvt[-0].vLong); yyval.vInt = 1;} break;case 52:# line 379 "lua.stx"{ code_number(yypvt[-0].vFloat); yyval.vInt = 1; } break;case 53:# line 381 "lua.stx"{ align(Word); code_byte(PUSHSTRING); code_word(yypvt[-0].vWord); yyval.vInt = 1; incr_ntemp(); } break;case 54:# line 388 "lua.stx"{code_byte(PUSHNIL); yyval.vInt = 1; incr_ntemp();} break;case 55:# line 390 "lua.stx"{ yyval.vInt = 0; if (lua_debug) { align(Word); code_byte(SETLINE); code_word(lua_linenumber); } } break;case 56:# line 397 "lua.stx"{ code_byte(NOTOP); yyval.vInt = 1;} break;case 57:# line 398 "lua.stx"{code_byte(POP); ntemp--;} break;case 58:# line 399 "lua.stx"{ *(yypvt[-2].pByte) = ONFJMP; *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1); yyval.vInt = 1; } break;case 59:# line 404 "lua.stx"{code_byte(POP); ntemp--;} break;case 60:# line 405 "lua.stx"{ *(yypvt[-2].pByte) = ONTJMP; *((Word *)(yypvt[-2].pByte+1)) = pc - (yypvt[-2].pByte + sizeof(Word)+1); yyval.vInt = 1; } break;case 61:# line 412 "lua.stx"{ code_byte(PUSHNIL); incr_ntemp();} break;case 63:# line 416 "lua.stx"{code_byte(PUSHMARK); yyval.vInt = ntemp; incr_ntemp();} break;case 64:# line 417 "lua.stx"{ code_byte(CALLFUNC); ntemp = yypvt[-3].vInt-1;} break;case 65:# line 419 "lua.stx"{lua_pushvar (yypvt[-0].vLong); } break;case 66:# line 422 "lua.stx"{ yyval.vInt = 1; } break;case 67:# line 423 "lua.stx"{ yyval.vInt = yypvt[-0].vInt; } break;case 68:# line 426 "lua.stx"{ yyval.vInt = yypvt[-0].vInt; } break;case 69:# line 427 "lua.stx"{if (!yypvt[-1].vInt){lua_codeadjust (ntemp+1); incr_ntemp();}} break;case 70:# line 428 "lua.stx"{yyval.vInt = yypvt[-0].vInt;} break;case 73:# line 435 "lua.stx"{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break;case 74:# line 436 "lua.stx"{localvar[nlocalvar]=yypvt[-0].vWord; incr_nlocalvar();} break;case 75:# line 439 "lua.stx"{yyval.vLong=-1;} break;case 76:# line 440 "lua.stx"{yyval.vLong=yypvt[-0].vWord;} break;case 77:# line 443 "lua.stx"{ yyval.vInt = yypvt[-1].vInt; } break;case 78:# line 444 "lua.stx"{ yyval.vInt = yypvt[-1].vInt; } break;case 79:# line 447 "lua.stx"{ yyval.vInt = 0; } break;case 80:# line 448 "lua.stx"{ yyval.vInt = yypvt[-0].vInt; } break;case 81:# line 451 "lua.stx"{yyval.vInt=1;} break;case 82:# line 452 "lua.stx"{yyval.vInt=yypvt[-2].vInt+1;} break;case 83:# line 456 "lua.stx"{ align(Word); code_byte(PUSHSTRING); code_word(lua_findconstant (s_name(yypvt[-0].vWord))); incr_ntemp(); } break;case 84:# line 463 "lua.stx"{ code_byte(STOREFIELD); ntemp-=2; } break;case 85:# line 469 "lua.stx"{ yyval.vInt = 0; } break;case 86:# line 470 "lua.stx"{ yyval.vInt = yypvt[-0].vInt; } break;case 87:# line 473 "lua.stx"{ code_number(1); } break;case 88:# line 473 "lua.stx"{yyval.vInt=1;} break;case 89:# line 474 "lua.stx"{ code_number(yypvt[-1].vInt+1); } break;case 90:# line 475 "lua.stx"{yyval.vInt=yypvt[-3].vInt+1;} break;case 91:# line 479 "lua.stx"{ code_byte(STOREFIELD); ntemp-=2; } break;case 92:# line 486 "lua.stx"{ nvarbuffer = 0; varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer(); yyval.vInt = (yypvt[-0].vLong == 0) ? 1 : 0; } break;case 93:# line 492 "lua.stx"{ varbuffer[nvarbuffer] = yypvt[-0].vLong; incr_nvarbuffer(); yyval.vInt = (yypvt[-0].vLong == 0) ? yypvt[-2].vInt + 1 : yypvt[-2].vInt; } break;case 94:# line 499 "lua.stx"{ int local = lua_localname (yypvt[-0].vWord); if (local == -1) /* global var */ yyval.vLong = yypvt[-0].vWord + 1; /* return positive value */ else yyval.vLong = -(local+1); /* return negative value */ } break;case 95:# line 507 "lua.stx"{lua_pushvar (yypvt[-0].vLong);} break;case 96:# line 508 "lua.stx"{ yyval.vLong = 0; /* indexed variable */ } break;case 97:# line 511 "lua.stx"{lua_pushvar (yypvt[-0].vLong);} break;case 98:# line 512 "lua.stx"{ align(Word); code_byte(PUSHSTRING); code_word(lua_findconstant (s_name(yypvt[-0].vWord))); incr_ntemp(); yyval.vLong = 0; /* indexed variable */ } break;case 99:# line 520 "lua.stx"{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break;case 100:# line 521 "lua.stx"{localvar[nlocalvar]=yypvt[-1].vWord; incr_nlocalvar();} break;case 101:# line 524 "lua.stx"{ code_byte(PUSHNIL); } break;case 102:# line 525 "lua.stx"{ntemp = 0;} break;case 104:# line 528 "lua.stx"{lua_debug = yypvt[-0].vInt;} break; } goto yystack; /* reset registers in driver code */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -