summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel/lua
diff options
context:
space:
mode:
authorStefan Radomski <github@mintwerk.de>2017-01-18 17:15:46 (GMT)
committerStefan Radomski <github@mintwerk.de>2017-01-18 17:15:46 (GMT)
commitfc78cfdc4d1f5bba8dbd6a412f23651e185cb191 (patch)
treedd32929c07e6c19250f2e8fde1e73712bab0c6fb /src/uscxml/plugins/datamodel/lua
parent01ee860a88b5c8cf25fb7dcc145662d2c27f3ebe (diff)
downloaduscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.zip
uscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.tar.gz
uscxml-fc78cfdc4d1f5bba8dbd6a412f23651e185cb191.tar.bz2
Worked on passing even more IRP tests
Diffstat (limited to 'src/uscxml/plugins/datamodel/lua')
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp24
-rw-r--r--src/uscxml/plugins/datamodel/lua/LuaDataModel.h10
2 files changed, 13 insertions, 21 deletions
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
index 2ad89b5..ad35f80 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp
@@ -349,9 +349,12 @@ Data LuaDataModel::evalAsData(const std::string& content) {
throw originalError; // we will assume syntax error and throw
}
- if (retVals == 0)
+#if 1
+ // Note: Empty result is not an error test302, but how to do test488?
+ if (retVals == 0 && !isValidSyntax(trimmedExpr)) {
throw originalError; // we will assume syntax error and throw
-
+ }
+#endif
try {
if (retVals == 1) {
@@ -446,7 +449,7 @@ bool LuaDataModel::isDeclared(const std::string& expr) {
}
-void LuaDataModel::assign(const std::string& location, const Data& data) {
+void LuaDataModel::assign(const std::string& location, const Data& data, const std::map<std::string, std::string>& attr) {
if (location.length() == 0) {
ERROR_EXECUTION_THROW("Assign element has neither id nor location");
}
@@ -539,7 +542,7 @@ void LuaDataModel::assign(const std::string& location, const Data& data) {
}
}
-void LuaDataModel::init(const std::string& location, const Data& data) {
+void LuaDataModel::init(const std::string& location, const Data& data, const std::map<std::string, std::string>& attr) {
luabridge::setGlobal(_luaState, luabridge::Nil(), location.c_str());
assign(location, data);
}
@@ -582,17 +585,4 @@ Data LuaDataModel::getAsData(const std::string& content) {
return data;
}
-
-std::string LuaDataModel::andExpressions(std::list<std::string> exprs) {
- std::stringstream exprSS;
- std::list<std::string>::const_iterator listIter;
- std::string andExpr;
- for (listIter = exprs.begin(); listIter != exprs.end(); listIter++) {
- exprSS << andExpr << *listIter;
- andExpr = " && ";
- }
- return exprSS.str();
-}
-
-
}
diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
index 7b7121f..85d7b53 100644
--- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
+++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.h
@@ -77,10 +77,12 @@ public:
virtual bool isDeclared(const std::string& expr);
- virtual void assign(const std::string& location, const Data& data);
- virtual void init(const std::string& location, const Data& data);
-
- virtual std::string andExpressions(std::list<std::string>);
+ virtual void assign(const std::string& location,
+ const Data& data,
+ const std::map<std::string, std::string>& attr = std::map<std::string, std::string>());
+ virtual void init(const std::string& location,
+ const Data& data,
+ const std::map<std::string, std::string>& attr = std::map<std::string, std::string>());
protected: