Skip to content
Snippets Groups Projects
Commit f064b9bf authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Parser YAML changes

parent 82bb8ea3
No related branches found
No related tags found
No related merge requests found
Pipeline #4313 passed
...@@ -248,7 +248,8 @@ public: ...@@ -248,7 +248,8 @@ public:
std::vector<std::array<std::string, 3>> getCallbacks(); std::vector<std::array<std::string, 3>> getCallbacks();
std::vector<std::array<std::string, 2>> getProblem(); std::vector<std::array<std::string, 2>> getProblem();
std::map<std::string,std::string> getParams(); std::map<std::string,std::string> getParams();
void parse(bool); void parse();
void parse_freely();
}; };
std::string ParserYAML::generatePath(std::string path){ std::string ParserYAML::generatePath(std::string path){
std::regex r("^/.*"); std::regex r("^/.*");
...@@ -439,27 +440,28 @@ std::map<std::string,std::string> ParserYAML::getParams(){ ...@@ -439,27 +440,28 @@ std::map<std::string,std::string> ParserYAML::getParams(){
std::map<std::string,std::string> rtn = _params; std::map<std::string,std::string> rtn = _params;
return rtn; return rtn;
} }
void ParserYAML::parse(bool freely_parse = false){ void ParserYAML::parse(){
this->_parsing_file.push(generatePath(this->_file)); 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){ if(this->problem.Type() != YAML::NodeType::Undefined){
std::vector<std::string> tags = std::vector<std::string>(); std::vector<std::string> tags = std::vector<std::string>();
this->walkTreeR(this->problem, tags , "problem"); this->walkTreeR(this->problem, tags , "problem");
} }
for(auto it : _paramsSens){ for(auto it : _paramsSens){
std::vector<std::string> tags = std::vector<std::string>(); std::vector<std::string> tags = std::vector<std::string>();
this->walkTreeR(it.n , tags , it._name); this->walkTreeR(it.n , tags , it._name);
} }
for(auto it : _paramsProc){ 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>(); 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(); 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 #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment