diff options
author | Abdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com> | 2021-03-03 04:28:45 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 10:28:45 +0000 |
commit | 6db84f6e373f9651af48df7b654e3992f68472ac (patch) | |
tree | 3c146a185ce575431ea7a63cf97a8e0bb1031c0b /src/printer | |
parent | c4709cb01356dd73fdd767d19af85b36ffd566c4 (diff) |
Remove uses of SExpr class. (#6035)
This PR is a step towards removing SExpr class. It replaces SExpr with std::string for set-info and set-option commands.
Diffstat (limited to 'src/printer')
-rw-r--r-- | src/printer/ast/ast_printer.cpp | 8 | ||||
-rw-r--r-- | src/printer/ast/ast_printer.h | 4 | ||||
-rw-r--r-- | src/printer/cvc/cvc_printer.cpp | 14 | ||||
-rw-r--r-- | src/printer/cvc/cvc_printer.h | 4 | ||||
-rw-r--r-- | src/printer/printer.cpp | 4 | ||||
-rw-r--r-- | src/printer/printer.h | 4 | ||||
-rw-r--r-- | src/printer/smt2/smt2_printer.cpp | 24 | ||||
-rw-r--r-- | src/printer/smt2/smt2_printer.h | 4 |
8 files changed, 22 insertions, 44 deletions
diff --git a/src/printer/ast/ast_printer.cpp b/src/printer/ast/ast_printer.cpp index ab792f6fe..66dcdbfb2 100644 --- a/src/printer/ast/ast_printer.cpp +++ b/src/printer/ast/ast_printer.cpp @@ -346,9 +346,9 @@ void AstPrinter::toStreamCmdSetBenchmarkLogic(std::ostream& out, void AstPrinter::toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "SetInfo(" << flag << ", " << sexpr << ')' << std::endl; + out << "SetInfo(" << flag << ", " << value << ')' << std::endl; } void AstPrinter::toStreamCmdGetInfo(std::ostream& out, @@ -359,9 +359,9 @@ void AstPrinter::toStreamCmdGetInfo(std::ostream& out, void AstPrinter::toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "SetOption(" << flag << ", " << sexpr << ')' << std::endl; + out << "SetOption(" << flag << ", " << value << ')' << std::endl; } void AstPrinter::toStreamCmdGetOption(std::ostream& out, diff --git a/src/printer/ast/ast_printer.h b/src/printer/ast/ast_printer.h index 732933bb4..be1529b04 100644 --- a/src/printer/ast/ast_printer.h +++ b/src/printer/ast/ast_printer.h @@ -124,7 +124,7 @@ class AstPrinter : public CVC4::Printer /** Print set-info command */ void toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-info command */ void toStreamCmdGetInfo(std::ostream& out, @@ -133,7 +133,7 @@ class AstPrinter : public CVC4::Printer /** Print set-option command */ void toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-option command */ void toStreamCmdGetOption(std::ostream& out, diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp index 82798d074..7ac2da40b 100644 --- a/src/printer/cvc/cvc_printer.cpp +++ b/src/printer/cvc/cvc_printer.cpp @@ -1420,13 +1420,9 @@ void CvcPrinter::toStreamCmdSetBenchmarkLogic(std::ostream& out, void CvcPrinter::toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "% (set-info " << flag << ' '; - OutputLanguage language = - d_cvc3Mode ? language::output::LANG_CVC3 : language::output::LANG_CVC4; - SExpr::toStream(out, sexpr, language); - out << ')' << std::endl; + out << "% (set-info " << flag << ' ' << value << ')' << std::endl; } void CvcPrinter::toStreamCmdGetInfo(std::ostream& out, @@ -1437,11 +1433,9 @@ void CvcPrinter::toStreamCmdGetInfo(std::ostream& out, void CvcPrinter::toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "OPTION \"" << flag << "\" "; - SExpr::toStream(out, sexpr, language::output::LANG_CVC4); - out << ';' << std::endl; + out << "OPTION \"" << flag << "\" " << value << ';' << std::endl; } void CvcPrinter::toStreamCmdGetOption(std::ostream& out, diff --git a/src/printer/cvc/cvc_printer.h b/src/printer/cvc/cvc_printer.h index 58e47dbac..ab18d62de 100644 --- a/src/printer/cvc/cvc_printer.h +++ b/src/printer/cvc/cvc_printer.h @@ -125,7 +125,7 @@ class CvcPrinter : public CVC4::Printer /** Print set-info command */ void toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-info command */ void toStreamCmdGetInfo(std::ostream& out, @@ -134,7 +134,7 @@ class CvcPrinter : public CVC4::Printer /** Print set-option command */ void toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-option command */ void toStreamCmdGetOption(std::ostream& out, diff --git a/src/printer/printer.cpp b/src/printer/printer.cpp index 4e464f829..2d5ae58cd 100644 --- a/src/printer/printer.cpp +++ b/src/printer/printer.cpp @@ -388,7 +388,7 @@ void Printer::toStreamCmdSetBenchmarkLogic(std::ostream& out, void Printer::toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { printUnknownCommand(out, "set-info"); } @@ -401,7 +401,7 @@ void Printer::toStreamCmdGetInfo(std::ostream& out, void Printer::toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { printUnknownCommand(out, "set-option"); } diff --git a/src/printer/printer.h b/src/printer/printer.h index f17029618..0a5ed1eac 100644 --- a/src/printer/printer.h +++ b/src/printer/printer.h @@ -217,7 +217,7 @@ class Printer /** Print set-info command */ virtual void toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const; + const std::string& value) const; /** Print get-info command */ virtual void toStreamCmdGetInfo(std::ostream& out, @@ -226,7 +226,7 @@ class Printer /** Print set-option command */ virtual void toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const; + const std::string& value) const; /** Print get-option command */ virtual void toStreamCmdGetOption(std::ostream& out, diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp index 8c122f26d..c3ac36b5e 100644 --- a/src/printer/smt2/smt2_printer.cpp +++ b/src/printer/smt2/smt2_printer.cpp @@ -50,8 +50,6 @@ namespace CVC4 { namespace printer { namespace smt2 { -static OutputLanguage variantToLanguage(Variant v); - /** returns whether the variant is smt-lib 2.6 or greater */ bool isVariant_2_6(Variant v) { return v == smt2_6_variant; } @@ -1808,11 +1806,9 @@ void Smt2Printer::toStreamCmdSetBenchmarkLogic(std::ostream& out, void Smt2Printer::toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "(set-info :" << flag << ' '; - SExpr::toStream(out, sexpr, variantToLanguage(d_variant)); - out << ')' << std::endl; + out << "(set-info :" << flag << ' ' << value << ')' << std::endl; } void Smt2Printer::toStreamCmdGetInfo(std::ostream& out, @@ -1823,11 +1819,9 @@ void Smt2Printer::toStreamCmdGetInfo(std::ostream& out, void Smt2Printer::toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const + const std::string& value) const { - out << "(set-option :" << flag << ' '; - SExpr::toStream(out, sexpr, language::output::LANG_SMTLIB_V2_5); - out << ')' << std::endl; + out << "(set-option :" << flag << ' ' << value << ')' << std::endl; } void Smt2Printer::toStreamCmdGetOption(std::ostream& out, @@ -2233,16 +2227,6 @@ static bool tryToStream(std::ostream& out, const CommandStatus* s, Variant v) return false; } -static OutputLanguage variantToLanguage(Variant variant) -{ - switch(variant) { - case smt2_0_variant: - return language::output::LANG_SMTLIB_V2_0; - case no_variant: - default: return language::output::LANG_SMTLIB_V2_6; - } -} - }/* CVC4::printer::smt2 namespace */ }/* CVC4::printer namespace */ }/* CVC4 namespace */ diff --git a/src/printer/smt2/smt2_printer.h b/src/printer/smt2/smt2_printer.h index 8934967b9..4ba0d6cad 100644 --- a/src/printer/smt2/smt2_printer.h +++ b/src/printer/smt2/smt2_printer.h @@ -178,7 +178,7 @@ class Smt2Printer : public CVC4::Printer /** Print set-info command */ void toStreamCmdSetInfo(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-info command */ void toStreamCmdGetInfo(std::ostream& out, @@ -187,7 +187,7 @@ class Smt2Printer : public CVC4::Printer /** Print set-option command */ void toStreamCmdSetOption(std::ostream& out, const std::string& flag, - SExpr sexpr) const override; + const std::string& value) const override; /** Print get-option command */ void toStreamCmdGetOption(std::ostream& out, |