summaryrefslogtreecommitdiff
path: root/src/printer
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2012-06-07 16:16:48 +0000
committerMorgan Deters <mdeters@gmail.com>2012-06-07 16:16:48 +0000
commit0a7dc7687a4989641d8c101ba3b2d4737eaea24f (patch)
treee802b4522419f9480ba04c2c5f2e2d9b1f88426e /src/printer
parentb3d6d0ccc76e92304fe612b23dc76a7d78061567 (diff)
Adding EchoCommand and associated printer and parser rules:
* SMT-LIBv2 parser now supports (echo...). * Dump() gestures can now dump EchoCommands in CVC and SMT-LIB formats. This can make it much easier to interpret output.
Diffstat (limited to 'src/printer')
-rw-r--r--src/printer/cvc/cvc_printer.cpp7
-rw-r--r--src/printer/smt2/smt2_printer.cpp7
2 files changed, 12 insertions, 2 deletions
diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp
index 1df59adc4..f779a1bdc 100644
--- a/src/printer/cvc/cvc_printer.cpp
+++ b/src/printer/cvc/cvc_printer.cpp
@@ -597,7 +597,8 @@ void CvcPrinter::toStream(std::ostream& out, const Command* c,
tryToStream<GetOptionCommand>(out, c) ||
tryToStream<DatatypeDeclarationCommand>(out, c) ||
tryToStream<CommentCommand>(out, c) ||
- tryToStream<EmptyCommand>(out, c)) {
+ tryToStream<EmptyCommand>(out, c) ||
+ tryToStream<EchoCommand>(out, c)) {
return;
}
@@ -807,6 +808,10 @@ static void toStream(std::ostream& out, const CommentCommand* c) throw() {
static void toStream(std::ostream& out, const EmptyCommand* c) throw() {
}
+static void toStream(std::ostream& out, const EchoCommand* c) throw() {
+ out << "ECHO \"" << c->getOutput() << "\";";
+}
+
template <class T>
static bool tryToStream(std::ostream& out, const Command* c) throw() {
if(typeid(*c) == typeid(T)) {
diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp
index 25d3bf35a..a1ee99d8f 100644
--- a/src/printer/smt2/smt2_printer.cpp
+++ b/src/printer/smt2/smt2_printer.cpp
@@ -423,7 +423,8 @@ void Smt2Printer::toStream(std::ostream& out, const Command* c,
tryToStream<GetOptionCommand>(out, c) ||
tryToStream<DatatypeDeclarationCommand>(out, c) ||
tryToStream<CommentCommand>(out, c) ||
- tryToStream<EmptyCommand>(out, c)) {
+ tryToStream<EmptyCommand>(out, c) ||
+ tryToStream<EchoCommand>(out, c)) {
return;
}
@@ -661,6 +662,10 @@ static void toStream(std::ostream& out, const CommentCommand* c) throw() {
static void toStream(std::ostream& out, const EmptyCommand* c) throw() {
}
+static void toStream(std::ostream& out, const EchoCommand* c) throw() {
+ out << "(echo \"" << c->getOutput() << "\")";
+}
+
template <class T>
static bool tryToStream(std::ostream& out, const Command* c) throw() {
if(typeid(*c) == typeid(T)) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback