1 /* ------------------------------------------------
\r
2 Copyright 2014 AT&T Intellectual Property
\r
3 Licensed under the Apache License, Version 2.0 (the "License");
\r
4 you may not use this file except in compliance with the License.
\r
5 You may obtain a copy of the License at
\r
7 http://www.apache.org/licenses/LICENSE-2.0
\r
9 Unless required by applicable law or agreed to in writing, software
\r
10 distributed under the License is distributed on an "AS IS" BASIS,
\r
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
12 See the License for the specific language governing permissions and
\r
13 limitations under the License.
\r
14 ------------------------------------------- */
\r
18 bison --verbose --defines=nic.tab.cc.h -p NicParser -o nic.tab.cc nic.y
\r
28 /* Some addn'l includes, necessary but not included by the
\r
29 bison generated code.
\r
34 /* prototypes for the parser callbacks.
\r
37 #include "nic_def.h"
\r
39 extern int NicParserlex();
\r
40 void NicParsererror(char *s);
\r
43 extern nic_property *nicp;
\r
44 extern std::vector<std::string> nic_attr_vec;
\r
45 extern std::vector<std::string> nic_val_vec;
\r
46 extern std::string nic_a, nic_v;
\r
55 /* symbolic tokens */
\r
63 /* for FTA definition. */
\r
67 %token <strval> NAME
\r
68 %token <strval> STRING_TOKEN
\r
69 %token FUNC TYPES UNARY_OPS BINARY_OPS FIELDS OPTIONS
\r
77 opts types unary_ops binary_ops fields fcns
\r
81 OPTIONS opt_val_list ';' {nicp->opta=nic_attr_vec; nicp->optv=nic_val_vec;}
\r
85 TYPES opt_attr_list ';' {nicp->typea=nic_attr_vec;}
\r
89 UNARY_OPS opt_attr_list ';' {nicp->opua=nic_attr_vec;}
\r
93 BINARY_OPS opt_attr_list ';' {nicp->opba=nic_attr_vec;}
\r
97 FIELDS opt_attr_list ';' {nicp->fieldsa=nic_attr_vec;}
\r
101 FUNC opt_attr_list ';' {nicp->funca=nic_attr_vec;}
\r
106 | {nic_attr_vec.clear(); }
\r
110 NAME {nic_attr_vec.clear(); nic_attr_vec.push_back($1); }
\r
111 | STRING_TOKEN {nic_attr_vec.clear(); nic_attr_vec.push_back($1); }
\r
112 | attr_list ',' NAME {nic_attr_vec.push_back($3);}
\r
113 | attr_list ',' STRING_TOKEN {nic_attr_vec.push_back($3);}
\r
118 | {nic_attr_vec.clear(); nic_val_vec.clear();}
\r
122 val {nic_attr_vec.clear(); nic_attr_vec.push_back(nic_a);
\r
123 nic_val_vec.clear(); nic_val_vec.push_back(nic_v); }
\r
124 | val_list ',' val {nic_attr_vec.push_back(nic_a);
\r
125 nic_val_vec.push_back(nic_v); }
\r
129 NAME '=' STRING_TOKEN {nic_a = $1; nic_v = $3;}
\r
130 | NAME '=' NAME {nic_a = $1; nic_v = $3;}
\r