summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-05-17 10:19:54 -0400
committerMorgan Deters <mdeters@cs.nyu.edu>2013-05-17 10:19:54 -0400
commitd6ef5385a8759d708b75077ec7e919eff783a6cf (patch)
tree146f6cd9c25dfd64620396d11e1982d0171efa93
parent3afbf810287fb3f1a99ef907f91f5e93c3b93226 (diff)
Better error on invalid logic strings.
Thanks to David Cok for reporting this issue.
-rw-r--r--library_versions1
-rw-r--r--src/smt/smt_engine.cpp16
-rw-r--r--src/smt/smt_engine.h4
-rw-r--r--src/theory/logic_info.cpp7
4 files changed, 17 insertions, 11 deletions
diff --git a/library_versions b/library_versions
index eac360c34..7174f7b0b 100644
--- a/library_versions
+++ b/library_versions
@@ -53,3 +53,4 @@
1\.2 libcvc4:1:1:1 libcvc4parser:1:1:0 libcvc4compat:1:0:0 libcvc4bindings:1:0:0
1\.2\.1-prerelease libcvc4:1:1:1 libcvc4parser:1:1:0 libcvc4compat:1:0:0 libcvc4bindings:1:0:0
1\.3-prerelease libcvc4:1:1:1 libcvc4parser:1:1:0 libcvc4compat:1:0:0 libcvc4bindings:1:0:0
+# note: SmtEngine::setLogicString() exceptions have changed, bump library version on next release?
diff --git a/src/smt/smt_engine.cpp b/src/smt/smt_engine.cpp
index 908ad05e2..ab4b13d4c 100644
--- a/src/smt/smt_engine.cpp
+++ b/src/smt/smt_engine.cpp
@@ -792,21 +792,21 @@ SmtEngine::~SmtEngine() throw() {
void SmtEngine::setLogic(const LogicInfo& logic) throw(ModalException) {
SmtScope smts(this);
-
d_logic = logic;
setLogicInternal();
}
-void SmtEngine::setLogic(const std::string& s) throw(ModalException) {
+void SmtEngine::setLogic(const std::string& s) throw(ModalException, LogicException) {
SmtScope smts(this);
-
- setLogic(LogicInfo(s));
+ try {
+ setLogic(LogicInfo(s));
+ } catch(IllegalArgumentException& e) {
+ throw LogicException(e.what());
+ }
}
-void SmtEngine::setLogic(const char* logic) throw(ModalException){
- SmtScope smts(this);
-
- setLogic(LogicInfo(string(logic)));
+void SmtEngine::setLogic(const char* logic) throw(ModalException, LogicException) {
+ setLogic(string(logic));
}
LogicInfo SmtEngine::getLogicInfo() const {
diff --git a/src/smt/smt_engine.h b/src/smt/smt_engine.h
index a22e34c21..8266bb1ed 100644
--- a/src/smt/smt_engine.h
+++ b/src/smt/smt_engine.h
@@ -350,12 +350,12 @@ public:
/**
* Set the logic of the script.
*/
- void setLogic(const std::string& logic) throw(ModalException);
+ void setLogic(const std::string& logic) throw(ModalException, LogicException);
/**
* Set the logic of the script.
*/
- void setLogic(const char* logic) throw(ModalException);
+ void setLogic(const char* logic) throw(ModalException, LogicException);
/**
* Set the logic of the script.
diff --git a/src/theory/logic_info.cpp b/src/theory/logic_info.cpp
index dc9de8662..cbd0b510e 100644
--- a/src/theory/logic_info.cpp
+++ b/src/theory/logic_info.cpp
@@ -241,7 +241,12 @@ void LogicInfo::setLogicString(std::string logicString) throw(IllegalArgumentExc
}
if(*p != '\0') {
stringstream err;
- err << "LogicInfo::setLogicString(): junk (\"" << p << "\") at end of logic string: " << logicString;
+ err << "LogicInfo::setLogicString(): ";
+ if(p == logicString) {
+ err << "cannot parse logic string: " << logicString;
+ } else {
+ err << "junk (\"" << p << "\") at end of logic string: " << logicString;
+ }
IllegalArgument(logicString, err.str().c_str());
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback