summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp17
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++;
}
}