if(forceBinary && i < n.getNumChildren() - 1) {
// not going to work properly for parameterized kinds!
Assert(n.getMetaKind() != kind::metakind::PARAMETERIZED);
- out << " (" << smtKindString(n.getKind(), d_variant) << ' ';
+ out << " (" << smtKindStringOf(n, d_variant) << ' ';
parens << ')';
++c;
} else {
return kind::kindToString(k);
}
+std::string Smt2Printer::smtKindStringOf(const Node& n, Variant v)
+{
+ Kind k = n.getKind();
+ if (n.getNumChildren() > 0 && n[0].getType().isSequence())
+ {
+ // this method parallels api::Term::getKind
+ switch (k)
+ {
+ case kind::STRING_CONCAT: return "seq.concat";
+ case kind::STRING_LENGTH: return "seq.len";
+ case kind::STRING_SUBSTR: return "seq.extract";
+ case kind::STRING_UPDATE: return "seq.update";
+ case kind::STRING_CHARAT: return "seq.at";
+ case kind::STRING_CONTAINS: return "seq.contains";
+ case kind::STRING_INDEXOF: return "seq.indexof";
+ case kind::STRING_REPLACE: return "seq.replace";
+ case kind::STRING_REPLACE_ALL: return "seq.replace_all";
+ case kind::STRING_REV: return "seq.rev";
+ case kind::STRING_PREFIX: return "seq.prefixof";
+ case kind::STRING_SUFFIX: return "seq.suffixof";
+ default:
+ // fall through to conversion below
+ break;
+ }
+ }
+ // by default
+ return smtKindString(k, v);
+}
+
void Smt2Printer::toStreamType(std::ostream& out, TypeNode tn) const
{
// we currently must call TypeNode::toStream here.
* the SMT-LIB format (with variant v).
*/
static std::string smtKindString(Kind k, Variant v = smt2_6_variant);
+ /**
+ * Same as above, but also takes into account the type of the node, which
+ * makes a difference for printing sequences.
+ */
+ static std::string smtKindStringOf(const Node& n, Variant v = smt2_6_variant);
/**
* Get the string corresponding to the sygus datatype t printed as a grammar.
*/
#include "expr/attribute.h"
#include "options/smt_options.h"
#include "options/strings_options.h"
+#include "printer/smt2/smt2_printer.h"
#include "smt/logic_exception.h"
#include "theory/rewriter.h"
#include "theory/strings/inference_manager.h"
|| k == STRING_UPDATE)
{
std::stringstream ss;
- ss << "Term of kind " << k
+ ss << "Term of kind " << printer::smt2::Smt2Printer::smtKindStringOf(n)
<< " not supported in default mode, try --strings-exp";
throw LogicException(ss.str());
}
regress0/seq/array/nth-concat.smt2
regress0/seq/array/update-fallback.smt2
regress0/seq/array/update-word-eq.smt2
+ regress0/seq/issue6005-no-strings-exp.smt2
regress0/seq/seq-2var.smt2
regress0/seq/seq-ex1.smt2
regress0/seq/seq-ex2.smt2