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 -d -p xmlParser -o xml.tab.cc xml.y
28 /* Some addn'l includes, necessary but not included by the
34 /* prototypes for the parser callbacks.
40 extern std::vector<std::string> xml_attr_vec;
41 extern std::vector<std::string> xml_val_vec;
42 extern std::string xml_a, xml_v;
43 extern xml_t *xml_leaves;
45 extern int xmlParserdebug;
46 extern void xmlParsererror(char *s);
47 extern int xmlParserlex();
63 /* for FTA definition. */
68 %token <strval> STRING_TOKEN
75 parse_result: resource
79 start_tag xml_list end_tag
81 | '<' NAME opt_val_list '/' '>'
82 {xml_leaves->add_leaf(new xml_leaf_t($2, xml_attr_vec, xml_val_vec));
87 '<' NAME opt_val_list '>'
102 | {xml_attr_vec.clear(); xml_val_vec.clear();}
106 val {xml_attr_vec.clear(); xml_attr_vec.push_back(xml_a);
107 xml_val_vec.clear(); xml_val_vec.push_back(xml_v); }
108 | val_list val {xml_attr_vec.push_back(xml_a);
109 xml_val_vec.push_back(xml_v); }
113 NAME '=' STRING_TOKEN {xml_a = $1; xml_v = $3;}