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=res.tab.cc.h -p ResParser -o res.tab.cc res.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 "iface_q.h"
\r
40 extern resparse_data *rpd_ptr;
\r
41 extern std::vector<std::string> res_attr_vec;
\r
42 extern std::vector<std::string> res_val_vec;
\r
43 extern std::string res_a, res_v;
\r
52 /* symbolic tokens */
\r
60 /* for FTA definition. */
\r
64 %token <strval> NAME
\r
65 %token <strval> STRING_TOKEN
\r
72 parse_result: resource
\r
76 start_tag res_list end_tag
\r
78 | '<' NAME opt_val_list '/' '>'
\r
79 {startElement(rpd_ptr, $2, res_attr_vec, res_val_vec);
\r
80 endElement(rpd_ptr, $2);
\r
85 '<' NAME opt_val_list '>' {startElement(rpd_ptr, $2, res_attr_vec, res_val_vec);}
\r
89 '<' '/' NAME '>' {endElement(rpd_ptr, $3);}
\r
100 | {res_attr_vec.clear(); res_val_vec.clear();}
\r
104 val {res_attr_vec.clear(); res_attr_vec.push_back(res_a);
\r
105 res_val_vec.clear(); res_val_vec.push_back(res_v); }
\r
106 | val_list val {res_attr_vec.push_back(res_a);
\r
107 res_val_vec.push_back(res_v); }
\r
111 NAME '=' STRING_TOKEN {res_a = $1; res_v = $3;}
\r