📄 m2-exp.tab.c
字号:
** "error", pop stack */#if YYDEBUG# define _POP_ "Error recovery pops state %d, uncovers state %d\n" if ( yydebug ) (void)printf( _POP_, *yy_ps, yy_ps[-1] );# undef _POP_#endif yy_ps--; yy_pv--; } /* ** there is no state on stack with "error" as ** a valid shift. give up. */ 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 3:# line 199 "./m2-exp.y"{ write_exp_elt_opcode(OP_TYPE); write_exp_elt_type(yypvt[-0].tval); write_exp_elt_opcode(OP_TYPE); } break;case 4:# line 208 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_IND); } break;case 5:# line 211 "./m2-exp.y"{ number_sign = -1; } break;case 6:# line 213 "./m2-exp.y"{ number_sign = 1; write_exp_elt_opcode (UNOP_NEG); } break;case 7:# line 218 "./m2-exp.y"{ write_exp_elt_opcode(UNOP_PLUS); } break;case 8:# line 222 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_ZEROP); } break;case 11:# line 230 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_CAP); } break;case 12:# line 234 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_ORD); } break;case 13:# line 238 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_ABS); } break;case 14:# line 242 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_HIGH); } break;case 15:# line 246 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_MIN); write_exp_elt_type (yypvt[-1].tval); write_exp_elt_opcode (UNOP_MIN); } break;case 16:# line 252 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_MAX); write_exp_elt_type (yypvt[-1].tval); write_exp_elt_opcode (UNOP_MIN); } break;case 17:# line 258 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_FLOAT); } break;case 18:# line 262 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_VAL); write_exp_elt_type (yypvt[-3].tval); write_exp_elt_opcode (BINOP_VAL); } break;case 19:# line 268 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_CHR); } break;case 20:# line 272 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_ODD); } break;case 21:# line 276 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_TRUNC); } break;case 22:# line 280 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_SIZEOF); } break;case 23:# line 285 "./m2-exp.y"{ write_exp_elt_opcode(UNOP_PREINCREMENT); } break;case 24:# line 289 "./m2-exp.y"{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); write_exp_elt_opcode(BINOP_ADD); write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;case 25:# line 295 "./m2-exp.y"{ write_exp_elt_opcode(UNOP_PREDECREMENT);} break;case 26:# line 299 "./m2-exp.y"{ write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); write_exp_elt_opcode(BINOP_SUB); write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;case 27:# line 305 "./m2-exp.y"{ write_exp_elt_opcode (STRUCTOP_STRUCT); write_exp_string (yypvt[-0].sval); write_exp_elt_opcode (STRUCTOP_STRUCT); } break;case 29:# line 314 "./m2-exp.y"{ error("Sets are not implemented.");} break;case 30:# line 318 "./m2-exp.y"{ error("Sets are not implemented.");} break;case 31:# line 322 "./m2-exp.y"{ error("Sets are not implemented.");} break;case 32:# line 325 "./m2-exp.y"{ error("Sets are not implemented.");} break;case 33:# line 327 "./m2-exp.y"{ error("Sets are not implemented.");} break;case 34:# line 336 "./m2-exp.y"{ start_arglist(); } break;case 35:# line 338 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT); write_exp_elt_longcst ((LONGEST) end_arglist()); write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT); } break;case 36:# line 346 "./m2-exp.y"{ start_arglist (); } break;case 37:# line 348 "./m2-exp.y"{ write_exp_elt_opcode (OP_FUNCALL); write_exp_elt_longcst ((LONGEST) end_arglist ()); write_exp_elt_opcode (OP_FUNCALL); } break;case 39:# line 357 "./m2-exp.y"{ arglist_len = 1; } break;case 40:# line 361 "./m2-exp.y"{ arglist_len++; } break;case 41:# line 366 "./m2-exp.y"{ arglist_len = 1; } break;case 42:# line 371 "./m2-exp.y"{ arglist_len++; } break;case 43:# line 376 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_MEMVAL); write_exp_elt_type (yypvt[-2].tval); write_exp_elt_opcode (UNOP_MEMVAL); } break;case 44:# line 382 "./m2-exp.y"{ write_exp_elt_opcode (UNOP_CAST); write_exp_elt_type (yypvt[-3].tval); write_exp_elt_opcode (UNOP_CAST); } break;case 45:# line 388 "./m2-exp.y"{ } break;case 46:# line 396 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_REPEAT); } break;case 47:# line 400 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_MUL); } break;case 48:# line 404 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_DIV); } break;case 49:# line 408 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_INTDIV); } break;case 50:# line 412 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_REM); } break;case 51:# line 416 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_ADD); } break;case 52:# line 420 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_SUB); } break;case 53:# line 424 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_EQUAL); } break;case 54:# line 428 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_NOTEQUAL); } break;case 55:# line 430 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_NOTEQUAL); } break;case 56:# line 434 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_LEQ); } break;case 57:# line 438 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_GEQ); } break;case 58:# line 442 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_LESS); } break;case 59:# line 446 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_GTR); } break;case 60:# line 450 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_AND); } break;case 61:# line 454 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_AND); } break;case 62:# line 458 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_OR); } break;case 63:# line 462 "./m2-exp.y"{ write_exp_elt_opcode (BINOP_ASSIGN); } break;case 64:# line 469 "./m2-exp.y"{ write_exp_elt_opcode (OP_BOOL); write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval); write_exp_elt_opcode (OP_BOOL); } break;case 65:# line 475 "./m2-exp.y"{ write_exp_elt_opcode (OP_BOOL); write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval); write_exp_elt_opcode (OP_BOOL); } break;case 66:# line 481 "./m2-exp.y"{ write_exp_elt_opcode (OP_LONG); write_exp_elt_type (builtin_type_m2_int); write_exp_elt_longcst ((LONGEST) yypvt[-0].lval); write_exp_elt_opcode (OP_LONG); } break;case 67:# line 488 "./m2-exp.y"{ write_exp_elt_opcode (OP_LONG); write_exp_elt_type (builtin_type_m2_card); write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval); write_exp_elt_opcode (OP_LONG); } break;case 68:# line 497 "./m2-exp.y"{ write_exp_elt_opcode (OP_LONG); write_exp_elt_type (builtin_type_m2_char); write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval); write_exp_elt_opcode (OP_LONG); } break;case 69:# line 505 "./m2-exp.y"{ write_exp_elt_opcode (OP_DOUBLE); write_exp_elt_type (builtin_type_m2_real); write_exp_elt_dblcst (yypvt[-0].dval); write_exp_elt_opcode (OP_DOUBLE); } break;case 71:# line 516 "./m2-exp.y"{ write_exp_elt_opcode (OP_LAST); write_exp_elt_longcst ((LONGEST) yypvt[-0].lval); write_exp_elt_opcode (OP_LAST); } break;case 72:# line 522 "./m2-exp.y"{ write_exp_elt_opcode (OP_REGISTER); write_exp_elt_longcst ((LONGEST) yypvt[-0].lval); write_exp_elt_opcode (OP_REGISTER); } break;case 73:# line 528 "./m2-exp.y"{ write_exp_elt_opcode (OP_LONG); write_exp_elt_type (builtin_type_int); write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yypvt[-1].tval)); write_exp_elt_opcode (OP_LONG); } break;case 74:# line 535 "./m2-exp.y"{ write_exp_elt_opcode (OP_M2_STRING); write_exp_string (yypvt[-0].sval); write_exp_elt_opcode (OP_M2_STRING); } break;case 75:# line 542 "./m2-exp.y"{ yyval.bval = SYMBOL_BLOCK_VALUE(yypvt[-0].sym); } break;case 76:# line 546 "./m2-exp.y"{ struct symbol *sym = lookup_symbol (copy_name (yypvt[-0].sval), expression_context_block, VAR_NAMESPACE, 0, NULL); yyval.sym = sym;} break;case 77:# line 555 "./m2-exp.y"{ struct symbol *tem = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval, VAR_NAMESPACE, 0, NULL); if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK) error ("No function \"%s\" in specified context.", copy_name (yypvt[-0].sval)); yyval.sym = tem; } break;case 78:# line 567 "./m2-exp.y"{ write_exp_elt_opcode(OP_VAR_VALUE); write_exp_elt_sym (yypvt[-0].sym); write_exp_elt_opcode (OP_VAR_VALUE); } break;case 79:# line 574 "./m2-exp.y"{ write_exp_elt_opcode (OP_INTERNALVAR); write_exp_elt_intern (yypvt[-0].ivar); write_exp_elt_opcode (OP_INTERNALVAR); } break;case 80:# line 581 "./m2-exp.y"{ struct symbol *sym; sym = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval, VAR_NAMESPACE, 0, NULL); if (sym == 0) error ("No symbol \"%s\" in specified context.", copy_name (yypvt[-0].sval)); write_exp_elt_opcode (OP_VAR_VALUE); write_exp_elt_sym (sym); write_exp_elt_opcode (OP_VAR_VALUE); } break;case 81:# line 595 "./m2-exp.y"{ struct symbol *sym; int is_a_field_of_this; sym = lookup_symbol (copy_name (yypvt[-0].sval), expression_context_block, VAR_NAMESPACE, &is_a_field_of_this, NULL); if (sym) { switch (sym->class) { case LOC_REGISTER: case LOC_ARG: case LOC_LOCAL: case LOC_REF_ARG: case LOC_REGPARM: case LOC_LOCAL_ARG: if (innermost_block == 0 || contained_in (block_found, innermost_block)) innermost_block = block_found; break; case LOC_UNDEF: case LOC_CONST: case LOC_STATIC: case LOC_TYPEDEF: case LOC_LABEL: /* maybe should go above? */ case LOC_BLOCK: case LOC_CONST_BYTES: /* These are listed so gcc -Wall will reveal un-handled cases. */ break; } write_exp_elt_opcode (OP_VAR_VALUE); write_exp_elt_sym (sym); write_exp_elt_opcode (OP_VAR_VALUE); } else { struct minimal_symbol *msymbol; register char *arg = copy_name (yypvt[-0].sval); msymbol = lookup_minimal_symbol (arg, (struct objfile *) NULL); if (msymbol != NULL) { write_exp_elt_opcode (OP_LONG); write_exp_elt_type (builtin_type_int); write_exp_elt_longcst ((LONGEST) msymbol -> address); write_exp_elt_opcode (OP_LONG); write_exp_elt_opcode (UNOP_MEMVAL); if (msymbol -> type == mst_data || msymbol -> type == mst_bss) write_exp_elt_type (builtin_type_int); else if (msymbol -> type == mst_text) write_exp_elt_type (lookup_function_type (builtin_type_int)); else write_exp_elt_type (builtin_type_char); write_exp_elt_opcode (UNOP_MEMVAL); } else if (!have_full_symbols () && !have_partial_symbols ()) error ("No symbol table is loaded. Use the \"symbol-file\" command."); else error ("No symbol \"%s\" in current context.", copy_name (yypvt[-0].sval)); } } break;case 82:# line 668 "./m2-exp.y"{ yyval.tval = lookup_typename (copy_name (yypvt[-0].sval), expression_context_block, 0); } break; } goto yystack; /* reset registers in driver code */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -