diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-23 13:25:42 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-01-23 13:25:42 (GMT) |
commit | 7f05246786b587f0301cbf9aa1d66783747b8828 (patch) | |
tree | d24d7598ed6dfe7951248a29b7931e9c74d64a80 /src/uscxml | |
parent | a1ad371e696289b022484c87c9d191180b132d18 (diff) | |
download | uscxml-7f05246786b587f0301cbf9aa1d66783747b8828.zip uscxml-7f05246786b587f0301cbf9aa1d66783747b8828.tar.gz uscxml-7f05246786b587f0301cbf9aa1d66783747b8828.tar.bz2 |
Fixed a bug with brackets
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp index 9bd8d9e..b32fecf 100644 --- a/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp +++ b/src/uscxml/plugins/datamodel/prolog/swi/SWIDataModel.cpp @@ -327,9 +327,11 @@ void SWIDataModel::setEvent(const Event& event) { void SWIDataModel::assertFromData(const Data& data, const std::string& expr, size_t nesting) { if (data.atom.size() > 0) { + // terminal branch, this is where we assert + std::stringstream ss; - ss << expr << "("; - nesting++; + ss << expr; +// nesting++; if (data.type == Data::VERBATIM) { ss << "\"" << data.atom << "\""; @@ -340,6 +342,8 @@ void SWIDataModel::assertFromData(const Data& data, const std::string& expr, siz for (size_t i = 0; i < nesting; i++) { ss << ")"; } + +// std::cout << ss.str() << std::endl; PlCall("assert", PlCompound(ss.str().c_str())); return; } @@ -347,7 +351,8 @@ 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()) { - assertFromData(compIter->second, expr + "(" + compIter->first, nesting + 1); + assert(compIter->first.length() > 0); + assertFromData(compIter->second, expr + compIter->first + "(", nesting + 1); compIter++; } } |