summaryrefslogtreecommitdiff
path: root/src/printer
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2021-03-30 15:02:37 -0500
committerGitHub <noreply@github.com>2021-03-30 20:02:37 +0000
commit5250e3714929164004f8dd5d7551a07f888ee311 (patch)
tree5f363ce3b222b1dbf5d1f2b08350bef5ede659cb /src/printer
parentbd96a673410c8c8389ede1a3ebe8bd1e0cea0f43 (diff)
Fix printing for double patterns (#6235)
Diffstat (limited to 'src/printer')
-rw-r--r--src/printer/smt2/smt2_printer.cpp48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/printer/smt2/smt2_printer.cpp b/src/printer/smt2/smt2_printer.cpp
index 3e99267cc..af555d298 100644
--- a/src/printer/smt2/smt2_printer.cpp
+++ b/src/printer/smt2/smt2_printer.cpp
@@ -942,22 +942,33 @@ void Smt2Printer::toStream(std::ostream& out,
// do not letify the bound variable list
toStream(out, n[0], toDepth, nullptr);
out << " ";
+ std::stringstream annot;
if (n.getNumChildren() == 3)
{
- out << "(! ";
+ annot << " ";
+ for (const Node& nc : n[2])
+ {
+ if (nc.getKind() == kind::INST_PATTERN)
+ {
+ out << "(! ";
+ annot << ":pattern ";
+ toStream(annot, nc, toDepth, nullptr);
+ annot << ") ";
+ }
+ else if (nc.getKind() == kind::INST_NO_PATTERN)
+ {
+ out << "(! ";
+ annot << ":no-pattern ";
+ toStream(annot, nc, toDepth, nullptr);
+ annot << ") ";
+ }
+ }
}
// Use a fresh let binder, since using existing let symbols may violate
// scoping issues for let-bound variables, see explanation in let_binding.h.
size_t dag = lbind == nullptr ? 0 : lbind->getThreshold()-1;
toStream(out, n[1], toDepth - 1, dag);
- if (n.getNumChildren() == 3)
- {
- out << " ";
- // do not letify the annotation
- toStream(out, n[2], toDepth, nullptr);
- out << ")";
- }
- out << ")";
+ out << annot.str() << ")";
return;
break;
}
@@ -980,23 +991,8 @@ void Smt2Printer::toStream(std::ostream& out,
return;
}
case kind::INST_PATTERN:
- case kind::INST_NO_PATTERN: break;
- case kind::INST_PATTERN_LIST:
- {
- for (const Node& nc : n)
- {
- if (nc.getKind() == kind::INST_PATTERN)
- {
- out << ":pattern " << nc;
- }
- else if (nc.getKind() == kind::INST_NO_PATTERN)
- {
- out << ":no-pattern " << nc[0];
- }
- }
- return;
- break;
- }
+ case kind::INST_NO_PATTERN:
+ case kind::INST_PATTERN_LIST: break;
default:
// fall back on however the kind prints itself; this probably
// won't be SMT-LIB v2 compliant, but it will be clear from the
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback