1 /* ------------------------------------------------
2 Copyright 2014 AT&T Intellectual Property
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ------------------------------------------- */
18 bison --verbose --defines=res.tab.cc.h -p ResParser -o res.tab.cc res.y
28 /* Some addn'l includes, necessary but not included by the
34 /* prototypes for the parser callbacks.
40 extern resparse_data *rpd_ptr;
41 extern std::vector<std::string> res_attr_vec;
42 extern std::vector<std::string> res_val_vec;
43 extern std::string res_a, res_v;
60 /* for FTA definition. */
65 %token <strval> STRING_TOKEN
72 parse_result: resource
76 start_tag res_list end_tag
78 | '<' NAME opt_val_list '/' '>'
79 {startElement(rpd_ptr, $2, res_attr_vec, res_val_vec);
80 endElement(rpd_ptr, $2);
85 '<' NAME opt_val_list '>' {startElement(rpd_ptr, $2, res_attr_vec, res_val_vec);}
89 '<' '/' NAME '>' {endElement(rpd_ptr, $3);}
100 | {res_attr_vec.clear(); res_val_vec.clear();}
104 val {res_attr_vec.clear(); res_attr_vec.push_back(res_a);
105 res_val_vec.clear(); res_val_vec.push_back(res_v); }
106 | val_list val {res_attr_vec.push_back(res_a);
107 res_val_vec.push_back(res_v); }
111 NAME '=' STRING_TOKEN {res_a = $1; res_v = $3;}