From f064b9bf2d6a1c3b2a5b1856d1583ffc7ac43bb3 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Mon, 26 Aug 2019 09:15:05 +0200 Subject: [PATCH] Parser YAML changes --- include/core/yaml/parser_yaml.hpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/include/core/yaml/parser_yaml.hpp b/include/core/yaml/parser_yaml.hpp index ffda58f91..643d5d1fd 100644 --- a/include/core/yaml/parser_yaml.hpp +++ b/include/core/yaml/parser_yaml.hpp @@ -248,7 +248,8 @@ public: std::vector<std::array<std::string, 3>> getCallbacks(); std::vector<std::array<std::string, 2>> getProblem(); std::map<std::string,std::string> getParams(); - void parse(bool); + void parse(); + void parse_freely(); }; std::string ParserYAML::generatePath(std::string path){ std::regex r("^/.*"); @@ -439,27 +440,28 @@ std::map<std::string,std::string> ParserYAML::getParams(){ std::map<std::string,std::string> rtn = _params; return rtn; } -void ParserYAML::parse(bool freely_parse = false){ +void ParserYAML::parse(){ this->_parsing_file.push(generatePath(this->_file)); - if(not freely_parse){ - this->parseFirstLevel(this->_file); + this->parseFirstLevel(this->_file); if(this->problem.Type() != YAML::NodeType::Undefined){ - std::vector<std::string> tags = std::vector<std::string>(); - this->walkTreeR(this->problem, tags , "problem"); + std::vector<std::string> tags = std::vector<std::string>(); + this->walkTreeR(this->problem, tags , "problem"); } for(auto it : _paramsSens){ - std::vector<std::string> tags = std::vector<std::string>(); - this->walkTreeR(it.n , tags , it._name); + std::vector<std::string> tags = std::vector<std::string>(); + this->walkTreeR(it.n , tags , it._name); } for(auto it : _paramsProc){ - std::vector<std::string> tags = std::vector<std::string>(); - this->walkTreeR(it.n , tags , it._name); - } - }else{ std::vector<std::string> tags = std::vector<std::string>(); - this->walkTreeR(loadYAML(this->_file), tags, ""); + this->walkTreeR(it.n , tags , it._name); } this->_parsing_file.pop(); } +void ParserYAML::parse_freely(){ + this->_parsing_file.push(generatePath(this->_file)); + std::vector<std::string> tags = std::vector<std::string>(); + this->walkTreeR(loadYAML(this->_file), tags, ""); + this->_parsing_file.pop(); +} #endif -- GitLab