📄 yacc.yy_compile_policy.cc
字号:
if ((yys = getenv("YYDEBUG"))) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; }#endif yynerrs = 0; yyerrflag = 0; yychar = (-1); if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0;yyloop: if ((yyn = yydefred[yystate])) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); }#endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) {#if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]);#endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; yychar = (-1); if (yyerrflag > 0) --yyerrflag; goto yyloop; } if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery;#if defined(lint) || defined(__GNUC__) goto yynewerror;#endifyynewerror: yyerror("syntax error");#if defined(lint) || defined(__GNUC__) goto yyerrlab;#endifyyerrlab: ++yynerrs;yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) {#if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);#endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else {#if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yyssp);#endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); }#endif yychar = (-1); goto yyloop; }yyreduce:#if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]);#endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) {case 3:#line 89 "compilepolicy.y"{ list<string> tmp; string proto = yyvsp[-2].c_str; string pols = yyvsp[-1].c_str; free(yyvsp[-2].c_str); free(yyvsp[-1].c_str); policy_utils::str_to_list(pols,tmp); _yy_configuration.update_exports(proto,tmp); }break;case 4:#line 103 "compilepolicy.y"{ list<string> tmp; string proto = yyvsp[-2].c_str; string pols = yyvsp[-1].c_str; free(yyvsp[-2].c_str); free(yyvsp[-1].c_str); policy_utils::str_to_list(pols,tmp); _yy_configuration.update_imports(proto,tmp); }break;case 6:#line 120 "compilepolicy.y"{ string type = yyvsp[-3].c_str; string id = yyvsp[-2].c_str; string sets = yyvsp[-1].c_str; free(yyvsp[-3].c_str); free(yyvsp[-2].c_str); free(yyvsp[-1].c_str); _yy_configuration.create_set(id); _yy_configuration.update_set(type, id, sets); }break;case 7:#line 134 "compilepolicy.y"{ string pname = yyvsp[-3].c_str; free(yyvsp[-3].c_str); _yy_configuration.create_policy(pname); ConfigNodeId order_generator(ConfigNodeId::ZERO()); ConfigNodeId prev_order(ConfigNodeId::ZERO()); ConfigNodeId order(ConfigNodeId::ZERO()); for(vector<yy_tb*>::iterator i = _yy_terms.begin(); i != _yy_terms.end(); ++i) { yy_tb* term = *i; string& tname = term->name; order = order_generator.generate_unique_node_id(); order.set_position(prev_order.unique_node_id()); prev_order = order; _yy_configuration.create_term(pname, order, tname); add_blocks(pname, tname, *term); delete term; } _yy_terms.clear(); }break;case 8:#line 166 "compilepolicy.y"{ yy_tb* tb = new yy_tb; tb->name = yyvsp[-5].c_str; tb->block[0] = yyvsp[-3].statements; tb->block[1] = yyvsp[-2].statements; tb->block[2] = yyvsp[-1].statements; free(yyvsp[-5].c_str); _yy_terms.push_back(tb); }break;case 10:#line 182 "compilepolicy.y"{ yy_statements* tmp = _yy_statements; _yy_statements = NULL; yyval.statements = tmp; }break;case 11:#line 191 "compilepolicy.y"{ yy_statements* tmp = _yy_statements; _yy_statements = NULL; yyval.statements = tmp; }break;case 12:#line 200 "compilepolicy.y"{ yy_statements* tmp = _yy_statements; _yy_statements = NULL; yyval.statements = tmp; }break;case 13:#line 208 "compilepolicy.y"{ if (_yy_statements == NULL) { _yy_statements = new yy_statements; } yy_statement* statement = new yy_statement(yyvsp[-1].c_str); statement->append(";"); free(yyvsp[-1].c_str); _yy_statements->push_back(statement); }break;#line 577 "yacc.yy_compile_policy.cc" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) {#if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL);#endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); }#endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym];#if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \to state %d\n", YYPREFIX, *yyssp, yystate);#endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop;yyoverflow: yyerror("yacc stack overflow");yyabort: return (1);yyaccept: return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -