📄 yacc.yy_compile_policy.cc
字号:
#ifndef lintstatic char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28.2.1 2001/07/19 05:46:39 peter Exp $";#endif#include <stdlib.h>#define YYBYACC 1#define YYMAJOR 1#define YYMINOR 9#define YYLEX yylex()#define YYEMPTY -1#define yyclearin (yychar=(YYEMPTY))#define yyerrok (yyerrflag=0)#define YYRECOVERING() (yyerrflag!=0)#if defined(__cplusplus) || __STDC__static int yygrowstack(void);#elsestatic int yygrowstack();#endif#define yyparse yy_compile_policyparse#define yylex yy_compile_policylex#define yyerror yy_compile_policyerror#define yychar yy_compile_policychar#define yyval yy_compile_policyval#define yylval yy_compile_policylval#define yydebug yy_compile_policydebug#define yynerrs yy_compile_policynerrs#define yyerrflag yy_compile_policyerrflag#define yyss yy_compile_policyss#define yyssp yy_compile_policyssp#define yyvs yy_compile_policyvs#define yyvsp yy_compile_policyvsp#define yylhs yy_compile_policylhs#define yylen yy_compile_policylen#define yydefred yy_compile_policydefred#define yydgoto yy_compile_policydgoto#define yysindex yy_compile_policysindex#define yyrindex yy_compile_policyrindex#define yygindex yy_compile_policygindex#define yytable yy_compile_policytable#define yycheck yy_compile_policycheck#define yyname yy_compile_policyname#define yyrule yy_compile_policyrule#define yysslim yy_compile_policysslim#define yystacksize yy_compile_policystacksize#define YYPREFIX "yy_compile_policy"#line 2 "compilepolicy.y"/* * yacc -d -p yy_compile_policy -o yacc.yy_compile_policy.cc compilepolicy.y */#include "policy/policy_module.h"#include "libxorp/xorp.h"#include <list>#include <vector>#include "libproto/config_node_id.hh"#include "policy/configuration.hh"#include "policy/common/policy_utils.hh"#include "policy/test/compilepolicy.hh"extern int yylex(void);extern void yyerror(const char *);extern Configuration _yy_configuration;struct yy_tb { string name; yy_statements* block[3];};static vector<yy_tb*> _yy_terms;static yy_statements* _yy_statements = NULL;/* add blocks to configuration, and delete stuff from memory*/static voidadd_blocks(const string& pname, const string& tname, yy_tb& term){ /* source, action, dest*/ for(int i = 0; i < 3; i++) { yy_statements* statements = term.block[i]; /* empty blocks!*/ if(statements == 0) continue; ConfigNodeId order_generator(0, i); ConfigNodeId prev_order(ConfigNodeId::ZERO()); ConfigNodeId order(ConfigNodeId::ZERO()); for(yy_statements::iterator j = statements->begin(); j != statements->end(); ++j) { yy_statement* statement = *j; order = order_generator.generate_unique_node_id(); order.set_position(prev_order.unique_node_id()); prev_order = order; _yy_configuration.update_term_block(pname, tname, i, order, *statement); delete statement; } delete statements; }}#line 67 "compilepolicy.y"typedef union { char *c_str; yy_statements* statements;} YYSTYPE;#line 116 "yacc.yy_compile_policy.cc"#define YYERRCODE 256#define YY_INT 257#define YY_STR 258#define YY_ID 259#define YY_STATEMENT 260#define YY_SOURCEBLOCK 261#define YY_DESTBLOCK 262#define YY_ACTIONBLOCK 263#define YY_IPV4 264#define YY_IPV4NET 265#define YY_IPV6 266#define YY_IPV6NET 267#define YY_SEMICOLON 268#define YY_LBRACE 269#define YY_RBRACE 270#define YY_POLICY_STATEMENT 271#define YY_TERM 272#define YY_SOURCE 273#define YY_DEST 274#define YY_ACTION 275#define YY_SET 276#define YY_EXPORT 277#define YY_IMPORT 278const short yy_compile_policylhs[] = { -1, 0, 0, 0, 0, 0, 5, 4, 6, 6, 1, 2, 3, 7, 7,};const short yy_compile_policylen[] = { 2, 2, 2, 5, 5, 0, 5, 5, 8, 0, 4, 4, 4, 3, 0,};const short yy_compile_policydefred[] = { 5, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 3, 4, 7, 0, 6, 0, 0, 0, 0, 14, 0, 0, 0, 14, 0, 0, 0, 10, 0, 14, 8, 13, 11, 0, 12,};const short yy_compile_policydgoto[] = { 1, 26, 29, 33, 6, 7, 16, 30,};const short yy_compile_policysindex[] = { 0, -263, -254, -251, -243, -242, 0, 0, -250, -241, -238, -237, 0, -236, -245, -244, -266, -240, 0, 0, 0, -234, 0, -239, -247, -235, -233, 0, -232, -248, -260, 0, -231, -230, -229, 0, -259, 0, 0, 0, 0, -258, 0,};const short yy_compile_policyrindex[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};const short yy_compile_policygindex[] = { 0, 0, 0, 0, 0, 0, 0, -28,};#define YYTABLESIZE 41const short yy_compile_policytable[] = { 34, 34, 34, 36, 20, 8, 21, 9, 2, 41, 35, 40, 42, 3, 4, 5, 10, 11, 13, 12, 14, 15, 17, 18, 19, 23, 25, 32, 22, 0, 24, 0, 0, 0, 27, 0, 0, 31, 37, 39, 38, 28,};const short yy_compile_policycheck[] = { 260, 260, 260, 31, 270, 259, 272, 258, 271, 37, 270, 270, 270, 276, 277, 278, 259, 259, 259, 269, 258, 258, 258, 268, 268, 259, 273, 275, 268, -1, 269, -1, -1, -1, 269, -1, -1, 269, 269, 268, 270, 274,};#define YYFINAL 1#ifndef YYDEBUG#define YYDEBUG 0#endif#define YYMAXTOKEN 278#if YYDEBUGconst char * const yy_compile_policyname[] = {"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"YY_INT","YY_STR","YY_ID","YY_STATEMENT","YY_SOURCEBLOCK","YY_DESTBLOCK","YY_ACTIONBLOCK","YY_IPV4","YY_IPV4NET","YY_IPV6","YY_IPV6NET","YY_SEMICOLON","YY_LBRACE","YY_RBRACE","YY_POLICY_STATEMENT","YY_TERM","YY_SOURCE","YY_DEST","YY_ACTION","YY_SET","YY_EXPORT","YY_IMPORT",};const char * const yy_compile_policyrule[] = {"$accept : configuration","configuration : configuration policy_statement","configuration : configuration set","configuration : configuration YY_EXPORT YY_ID YY_STR YY_SEMICOLON","configuration : configuration YY_IMPORT YY_ID YY_STR YY_SEMICOLON","configuration :","set : YY_SET YY_STR YY_ID YY_STR YY_SEMICOLON","policy_statement : YY_POLICY_STATEMENT YY_ID YY_LBRACE terms YY_RBRACE","terms : terms YY_TERM YY_ID YY_LBRACE source dest action YY_RBRACE","terms :","source : YY_SOURCE YY_LBRACE statements YY_RBRACE","dest : YY_DEST YY_LBRACE statements YY_RBRACE","action : YY_ACTION YY_LBRACE statements YY_RBRACE","statements : statements YY_STATEMENT YY_SEMICOLON","statements :",};#endif#if YYDEBUG#include <stdio.h>#endif#ifdef YYSTACKSIZE#undef YYMAXDEPTH#define YYMAXDEPTH YYSTACKSIZE#else#ifdef YYMAXDEPTH#define YYSTACKSIZE YYMAXDEPTH#else#define YYSTACKSIZE 10000#define YYMAXDEPTH 10000#endif#endif#define YYINITSTACKSIZE 200int yydebug;int yynerrs;int yyerrflag;int yychar;short *yyssp;YYSTYPE *yyvsp;YYSTYPE yyval;YYSTYPE yylval;short *yyss;short *yysslim;YYSTYPE *yyvs;int yystacksize;/* allocate initial stack or double stack size, up to YYMAXDEPTH */static int yygrowstack(){ int newsize, i; short *newss; YYSTYPE *newvs; if ((newsize = yystacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) : (short *)malloc(newsize * sizeof *newss); if (newss == NULL) return -1; yyss = newss; yyssp = newss + i; newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : (YYSTYPE *)malloc(newsize * sizeof *newvs); if (newvs == NULL) return -1; yyvs = newvs; yyvsp = newvs + i; yystacksize = newsize; yysslim = yyss + newsize - 1; return 0;}#define YYABORT goto yyabort#define YYREJECT goto yyabort#define YYACCEPT goto yyaccept#define YYERROR goto yyerrlab#ifndef YYPARSE_PARAM#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG void#define YYPARSE_PARAM_DECL#else /* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG#define YYPARSE_PARAM_DECL#endif /* ANSI-C/C++ */#else /* YYPARSE_PARAM */#ifndef YYPARSE_PARAM_TYPE#define YYPARSE_PARAM_TYPE void *#endif#if defined(__cplusplus) || __STDC__#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM#define YYPARSE_PARAM_DECL#else /* ! ANSI-C/C++ */#define YYPARSE_PARAM_ARG YYPARSE_PARAM#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;#endif /* ANSI-C/C++ */#endif /* ! YYPARSE_PARAM */intyyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL{ register int yym, yyn, yystate;#if YYDEBUG register const char *yys;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -