diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-23 16:27:01 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-23 16:27:01 (GMT) |
commit | 956db4a059f5151b883f8d6febea3d2a7fd56104 (patch) | |
tree | b7e15e9b084c746903b82ea14e6d16113e214836 /src/uscxml | |
parent | 7f05246786b587f0301cbf9aa1d66783747b8828 (diff) | |
download | uscxml-956db4a059f5151b883f8d6febea3d2a7fd56104.zip uscxml-956db4a059f5151b883f8d6febea3d2a7fd56104.tar.gz uscxml-956db4a059f5151b883f8d6febea3d2a7fd56104.tar.bz2 |
Separate special chars in data key into separate compound terms
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index b32fecf..78b6a6f 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -351,8 +351,21 @@ void SWIDataModel::assertFromData(const Data& data, const std::string& expr, siz if (data.compound.size() > 0) { std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); while(compIter != data.compound.end()) { - assert(compIter->first.length() > 0); - assertFromData(compIter->second, expr + compIter->first + "(", nesting + 1); +// std::cout << compIter->first << std::endl; + std::stringstream prefix; + size_t prefixNesting = 0; + size_t oldPos = 0; + size_t pos = 0; + while((pos = compIter->first.find_first_of(",.(-", oldPos)) != std::string::npos) { + prefix << compIter->first.substr(oldPos, pos - oldPos) << "("; + prefixNesting++; + oldPos = pos + 1; + } + if (oldPos != compIter->first.size()) { + prefix << compIter->first.substr(oldPos, compIter->first.size() - oldPos) << "("; + prefixNesting++; + } + assertFromData(compIter->second, expr + prefix.str(), nesting + prefixNesting); compIter++; } } |