X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fftacmp%2Fxml.y;h=cf45ff4dc7bd77a3a5ca25be7c220f1ff010b2a8;hb=f1754ecea2eab7bd0a302042ac82eb11667b166c;hp=54cef1b79f7b99a00747793274559d409e708b38;hpb=07495effe193ca3f73c3bf0ce417068f9ac9dcdd;p=com%2Fgs-lite.git diff --git a/src/ftacmp/xml.y b/src/ftacmp/xml.y index 54cef1b..cf45ff4 100644 --- a/src/ftacmp/xml.y +++ b/src/ftacmp/xml.y @@ -1,122 +1,122 @@ -/* ------------------------------------------------ -Copyright 2014 AT&T Intellectual Property - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ------------------------------------------- */ - -/* - MUST COMPILE WITH - bison --verbose -d -p xmlParser -o xml.tab.cc xml.y - - (or equivalent). -*/ - -%{ - - -#include - -/* Some addn'l includes, necessary but not included by the - bison generated code. -*/ - -#include - -/* prototypes for the parser callbacks. -*/ - -#include "xml_t.h" - - -extern std::vector xml_attr_vec; -extern std::vector xml_val_vec; -extern std::string xml_a, xml_v; -extern xml_t *xml_leaves; - -extern int xmlParserdebug; -extern void xmlParsererror(char *s); -extern int xmlParserlex(); - - -#define YYDEBUG 1 - -%} - - - /* symbolic tokens */ - -%union { - int intval; - double floatval; - char *strval; - int subtok; - - /* for FTA definition. */ - -} - -%token NAME -%token STRING_TOKEN - - - - -%% - -parse_result: resource - ; - -resource: - start_tag xml_list end_tag - | start_tag end_tag - | '<' NAME opt_val_list '/' '>' - {xml_leaves->add_leaf(new xml_leaf_t($2, xml_attr_vec, xml_val_vec)); - } - ; - -start_tag: - '<' NAME opt_val_list '>' - ; - -end_tag: - '<' '/' NAME '>' - ; - - -xml_list: - resource - | xml_list resource - ; - -opt_val_list: - val_list - | {xml_attr_vec.clear(); xml_val_vec.clear();} - ; - -val_list: - val {xml_attr_vec.clear(); xml_attr_vec.push_back(xml_a); - xml_val_vec.clear(); xml_val_vec.push_back(xml_v); } - | val_list val {xml_attr_vec.push_back(xml_a); - xml_val_vec.push_back(xml_v); } - ; - -val: - NAME '=' STRING_TOKEN {xml_a = $1; xml_v = $3;} - ; - - - - - -%% - - +/* ------------------------------------------------ +Copyright 2014 AT&T Intellectual Property + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ------------------------------------------- */ + +/* + MUST COMPILE WITH + bison --verbose -d -p xmlParser -o xml.tab.cc xml.y + + (or equivalent). +*/ + +%{ + + +#include + +/* Some addn'l includes, necessary but not included by the + bison generated code. +*/ + +#include + +/* prototypes for the parser callbacks. +*/ + +#include "xml_t.h" + + +extern std::vector xml_attr_vec; +extern std::vector xml_val_vec; +extern std::string xml_a, xml_v; +extern xml_t *xml_leaves; + +extern int xmlParserdebug; +extern void xmlParsererror(char *s); +extern int xmlParserlex(); + + +#define YYDEBUG 1 + +%} + + + /* symbolic tokens */ + +%union { + int intval; + double floatval; + char *strval; + int subtok; + + /* for FTA definition. */ + +} + +%token NAME +%token STRING_TOKEN + + + + +%% + +parse_result: resource + ; + +resource: + start_tag xml_list end_tag + | start_tag end_tag + | '<' NAME opt_val_list '/' '>' + {xml_leaves->add_leaf(new xml_leaf_t($2, xml_attr_vec, xml_val_vec)); + } + ; + +start_tag: + '<' NAME opt_val_list '>' + ; + +end_tag: + '<' '/' NAME '>' + ; + + +xml_list: + resource + | xml_list resource + ; + +opt_val_list: + val_list + | {xml_attr_vec.clear(); xml_val_vec.clear();} + ; + +val_list: + val {xml_attr_vec.clear(); xml_attr_vec.push_back(xml_a); + xml_val_vec.clear(); xml_val_vec.push_back(xml_v); } + | val_list val {xml_attr_vec.push_back(xml_a); + xml_val_vec.push_back(xml_v); } + ; + +val: + NAME '=' STRING_TOKEN {xml_a = $1; xml_v = $3;} + ; + + + + + +%% + +