📄 parse_conf.cpp
字号:
yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2:#line 74 "parse_conf.y" { } break; case 3:#line 76 "parse_conf.y" { } break; case 4:#line 79 "parse_conf.y" { proc_info->set_cpu_name(yyvsp[0].strval); } break; case 5:#line 82 "parse_conf.y" { proc_info->set_mach_name(yyvsp[0].strval); } break; case 6:#line 85 "parse_conf.y" { proc_info->add_membank(yyvsp[0].mem_t); } break; case 7:#line 88 "parse_conf.y" { proc_info->add_preload(yyvsp[0].pre_t); } break; case 8:#line 91 "parse_conf.y" { proc_info->add_reginit(yyvsp[0].reg_t); } break; case 9:#line 96 "parse_conf.y" { yyval.strval = yyvsp[-1].strval; } break; case 10:#line 101 "parse_conf.y" { yyval.strval = yyvsp[-1].strval; } break; case 11:#line 105 "parse_conf.y" { yyval.mem_t = new membank_info_t; yyval.mem_t->flag = yyvsp[-7].uval | yyvsp[-5].uval; yyval.mem_t->addr = yyvsp[-3].uval; yyval.mem_t->size = yyvsp[-1].uval; } break; case 12:#line 113 "parse_conf.y" { if (yyvsp[0].strval[0]=='I' || yyvsp[0].strval[0]=='i') yyval.uval = MEMBANK_REMAPPED; else yyval.uval = 0; free(yyvsp[0].strval); } break; case 13:#line 119 "parse_conf.y" { yyval.uval = 0; if (strchr(yyvsp[0].strval, 'R') || strchr(yyvsp[0].strval, 'r')) yyval.uval |= MEMBANK_READABLE; if (strchr(yyvsp[0].strval, 'W') || strchr(yyvsp[0].strval, 'w')) yyval.uval |= MEMBANK_WRITABLE; free(yyvsp[0].strval); } break; case 14:#line 127 "parse_conf.y" { yyval.uval = strtoul(yyvsp[0].strval, NULL, 16); free(yyvsp[0].strval); } break; case 15:#line 131 "parse_conf.y" { yyval.uval = strtoul(yyvsp[0].strval, NULL, 10); free(yyvsp[0].strval); } break; case 16:#line 137 "parse_conf.y" { yyval.uval = strtoul(yyvsp[0].strval, NULL, 16); free(yyvsp[0].strval); } break; case 17:#line 141 "parse_conf.y" { yyval.uval = strtoul(yyvsp[0].strval, NULL, 10); free(yyvsp[0].strval); } break; case 18:#line 147 "parse_conf.y" { yyval.pre_t = new preload_info_t; yyval.pre_t->path = yyvsp[-3].strval; yyval.pre_t->addr = yyvsp[-1].uval; yyval.pre_t->type = preload_info_t::PRE_IMG; } break; case 19:#line 153 "parse_conf.y" { yyval.pre_t = new preload_info_t; yyval.pre_t->path = yyvsp[-3].nnstr; yyval.pre_t->addr = yyvsp[-1].uval; yyval.pre_t->type = preload_info_t::PRE_VAL; } break; case 20:#line 159 "parse_conf.y" { yyval.pre_t = new preload_info_t; yyval.pre_t->path = yyvsp[-1].strval; yyval.pre_t->addr = 0; yyval.pre_t->type = preload_info_t::PRE_ELF; } break; case 21:#line 167 "parse_conf.y" { yyval.strval = yyvsp[0].strval; } break; case 22:#line 170 "parse_conf.y" { yyval.strval = yyvsp[0].strval; } break; case 23:#line 175 "parse_conf.y" { yyval.strval = yyvsp[0].strval; } break; case 24:#line 178 "parse_conf.y" { yyval.strval = yyvsp[0].strval; } break; case 25:#line 183 "parse_conf.y" { yyval.nnstr = yyvsp[0].nnstr; } break; case 26:#line 188 "parse_conf.y" { yyval.nnstr = yyvsp[0].nnstr; } break; case 27:#line 191 "parse_conf.y" { yyval.nnstr = convert_int_to_vchar(strtoul(yyvsp[0].strval, NULL, 16)); free(yyvsp[0].strval); } break; case 28:#line 195 "parse_conf.y" { yyval.nnstr = convert_int_to_vchar(strtoul(yyvsp[0].strval, NULL, 10)); free(yyvsp[0].strval); } break; case 29:#line 199 "parse_conf.y" { yyval.nnstr = yyvsp[-1].nnstr; yyval.nnstr->insert(yyval.nnstr->end(), yyvsp[0].nnstr->begin(), yyvsp[0].nnstr->end()); delete yyvsp[0].nnstr; } break; case 30:#line 204 "parse_conf.y" { yyval.nnstr = convert_int_to_vchar(strtoul(yyvsp[0].strval, NULL, 16)); yyval.nnstr->insert(yyval.nnstr->begin(), yyvsp[-1].nnstr->begin(), yyvsp[-1].nnstr->end()); free(yyvsp[0].strval); delete yyvsp[-1].nnstr; } break; case 31:#line 210 "parse_conf.y" { yyval.nnstr = convert_int_to_vchar(strtoul(yyvsp[0].strval, NULL, 10)); yyval.nnstr->insert(yyval.nnstr->begin(), yyvsp[-1].nnstr->begin(), yyvsp[-1].nnstr->end()); free(yyvsp[0].strval); delete yyvsp[-1].nnstr; } break; case 32:#line 219 "parse_conf.y" { yyval.reg_t = new reginit_info_t; yyval.reg_t->id = arm_decode_regname(yyvsp[-3].strval); if (yyval.reg_t->id==-1) { conf_error("Unknown register"); YYABORT; } yyval.reg_t->val = strtoul(yyvsp[-1].strval, NULL, 16); free(yyvsp[-3].strval); free(yyvsp[-1].strval); } break; case 33:#line 231 "parse_conf.y" { yyval.reg_t = new reginit_info_t; yyval.reg_t->id = arm_decode_regname(yyvsp[-3].strval); if (yyval.reg_t->id==-1) { conf_error("Unknown register"); YYABORT; } yyval.reg_t->val = strtoul(yyvsp[-1].strval, NULL, 10); free(yyvsp[-3].strval); free(yyvsp[-1].strval); } break; }/* Line 1000 of yacc.c. */#line 1390 "parse_conf.cpp" yyvsp -= yylen; yyssp -= yylen; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate;/*------------------------------------.| yyerrlab -- here on detecting error |`------------------------------------*/yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs;#if YYERROR_VERBOSE yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); const char* yyprefix; char *yymsg; int yyx; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 0; yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); yycount += 1; if (yycount == 5) { yysize = 0; break; } } yysize += (sizeof ("syntax error, unexpected ") + yystrlen (yytname[yytype])); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); yyprefix = " or "; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("syntax error; also virtual memory exhausted"); } else#endif /* YYERROR_VERBOSE */ yyerror ("syntax error"); } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* If at end of input, pop the error token, then the rest of the stack, then return failure. */ if (yychar == YYEOF) for (;;) { YYPOPSTACK; if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[*yyssp], yyvsp); } } else { YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); yydestruct (yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1;/*---------------------------------------------------.| yyerrorlab -- error raised explicitly by YYERROR. |`---------------------------------------------------*/yyerrorlab:#ifdef __GNUC__ /* Pacify GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) goto yyerrorlab;#endif yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1;/*-------------------------------------------------------------.| yyerrlab1 -- common code for both syntax error and YYERROR. |`-------------------------------------------------------------*/yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; yystate = yyn; goto yynewstate;/*-------------------------------------.| yyacceptlab -- YYACCEPT comes here. |`-------------------------------------*/yyacceptlab: yyresult = 0; goto yyreturn;/*-----------------------------------.| yyabortlab -- YYABORT comes here. |`-----------------------------------*/yyabortlab: yyresult = 1; goto yyreturn;#ifndef yyoverflow/*----------------------------------------------.| yyoverflowlab -- parser overflow comes here. |`----------------------------------------------*/yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */#endifyyreturn:#ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss);#endif return yyresult;}#line 246 "parse_conf.y"void conf_error (char *s){ fprintf(stderr, "Error parsing %s:\n", conf_path); fprintf(stderr, " %s near line %d\n", s, mylineno+1); fprintf(stderr, "Correct the above error first.\n");}static vector<char> *convert_int_to_vchar(uint32_t ival){ vector<char> *ret = new vector<char>;#if TARGET_LITTLE_ENDIAN ret->push_back((char)ival); ret->push_back((char)(ival>>8)); ret->push_back((char)(ival>>16)); ret->push_back((char)(ival>>24));#else ret->push_back((char)(ival>>24)); ret->push_back((char)(ival>>16)); ret->push_back((char)(ival>>8)); ret->push_back((char)ival);#endif return ret;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -