summaryrefslogtreecommitdiff
path: root/src/main/interactive_shell.cpp
diff options
context:
space:
mode:
authorAbdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com>2020-09-22 22:12:17 -0500
committerGitHub <noreply@github.com>2020-09-22 22:12:17 -0500
commit5c062833d435e3dde5db3a8223c379a3e8cca520 (patch)
tree6be788d43297565e4a7bc769b45ec54930abb8df /src/main/interactive_shell.cpp
parent56f2e6dc41fa5fbeff1755978fa1854e800846b5 (diff)
Refactor Commands to use the Public API. (#5105)
This is work towards eliminating the Expr layer. This PR does the following: Replace Expr/Type with Term/Sort in the API for commands. Remove the command export functionality which is not supported. Since many commands now call the Solver functions instead of the SmtEngine ones, their behavior may be a slightly different. For example, (get-unsat-assumptions) now only works in incremental mode. In some cases, CVC4 will not recover from non-fatal errors.
Diffstat (limited to 'src/main/interactive_shell.cpp')
-rw-r--r--src/main/interactive_shell.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/main/interactive_shell.cpp b/src/main/interactive_shell.cpp
index 121513856..b798d03ee 100644
--- a/src/main/interactive_shell.cpp
+++ b/src/main/interactive_shell.cpp
@@ -309,34 +309,56 @@ restart:
CommandSequence *cmd_seq = new CommandSequence();
Command *cmd;
- try {
- while( (cmd = d_parser->nextCommand()) ) {
+ try
+ {
+ while ((cmd = d_parser->nextCommand()))
+ {
cmd_seq->addCommand(cmd);
- if(dynamic_cast<QuitCommand*>(cmd) != NULL) {
+ if (dynamic_cast<QuitCommand*>(cmd) != NULL)
+ {
d_quit = true;
break;
- } else {
+ }
+ else
+ {
#if HAVE_LIBEDITLINE
- if(dynamic_cast<DeclareFunctionCommand*>(cmd) != NULL) {
- s_declarations.insert(dynamic_cast<DeclareFunctionCommand*>(cmd)->getSymbol());
- } else if(dynamic_cast<DefineFunctionCommand*>(cmd) != NULL) {
- s_declarations.insert(dynamic_cast<DefineFunctionCommand*>(cmd)->getSymbol());
- } else if(dynamic_cast<DeclareTypeCommand*>(cmd) != NULL) {
- s_declarations.insert(dynamic_cast<DeclareTypeCommand*>(cmd)->getSymbol());
- } else if(dynamic_cast<DefineTypeCommand*>(cmd) != NULL) {
- s_declarations.insert(dynamic_cast<DefineTypeCommand*>(cmd)->getSymbol());
+ if (dynamic_cast<DeclareFunctionCommand*>(cmd) != NULL)
+ {
+ s_declarations.insert(
+ dynamic_cast<DeclareFunctionCommand*>(cmd)->getSymbol());
+ }
+ else if (dynamic_cast<DefineFunctionCommand*>(cmd) != NULL)
+ {
+ s_declarations.insert(
+ dynamic_cast<DefineFunctionCommand*>(cmd)->getSymbol());
+ }
+ else if (dynamic_cast<DeclareSortCommand*>(cmd) != NULL)
+ {
+ s_declarations.insert(
+ dynamic_cast<DeclareSortCommand*>(cmd)->getSymbol());
+ }
+ else if (dynamic_cast<DefineSortCommand*>(cmd) != NULL)
+ {
+ s_declarations.insert(
+ dynamic_cast<DefineSortCommand*>(cmd)->getSymbol());
}
#endif /* HAVE_LIBEDITLINE */
}
}
- } catch(ParserEndOfFileException& pe) {
+ }
+ catch (ParserEndOfFileException& pe)
+ {
line += "\n";
goto restart;
- } catch(ParserException& pe) {
+ }
+ catch (ParserException& pe)
+ {
if (language::isOutputLang_smt2(d_options.getOutputLanguage()))
{
d_out << "(error \"" << pe << "\")" << endl;
- } else {
+ }
+ else
+ {
d_out << pe << endl;
}
// We can't really clear out the sequence and abort the current line,
@@ -350,8 +372,8 @@ restart:
// FIXME: does that mean e.g. that a pushed LET scope might not yet have
// been popped?!
//
- //delete cmd_seq;
- //cmd_seq = new CommandSequence();
+ // delete cmd_seq;
+ // cmd_seq = new CommandSequence();
}
return cmd_seq;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback