Previously, echo surpressed leading, trailing and escape quotes of the
string to print. However, the SMT-LIB standard states that the string is
to be printed as is, including those quote characters.
/* class EchoCommand */
/* -------------------------------------------------------------------------- */
-EchoCommand::EchoCommand(std::string output) : d_output(output) {}
+EchoCommand::EchoCommand(std::string output)
+{
+ // escape all double-quotes
+ size_t pos = 0;
+ while ((pos = output.find('"', pos)) != string::npos)
+ {
+ output.replace(pos, 1, "\"\"");
+ pos += 2;
+ }
+ d_output = '"' + output + '"';
+}
+
std::string EchoCommand::getOutput() const { return d_output; }
void EchoCommand::invoke(api::Solver* solver, SymbolManager* sm)
{
regress0/define-fun-model.smt2
regress0/distinct.smtv1.smt2
regress0/dump-unsat-core-full.smt2
+ regress0/echo.smt2
regress0/eqrange1.smt2
regress0/eqrange2.smt2
regress0/eqrange3.smt2
--- /dev/null
+; EXPECT: "str"""
+; EXPECT: "str""ing"
+; EXPECT: "hi"
+; EXPECT: "str""""ing"
+; EXPECT: "str""i""ng"
+; EXPECT: "str\ing"
+; EXPECT: "str\\ing"
+; EXPECT: "str\"
+; EXPECT: "\u{65}"
+(echo "str""")
+(echo "str""ing")
+(echo "hi")
+(echo "str""""ing")
+(echo "str""i""ng")
+(echo "str\ing")
+(echo "str\\ing")
+(echo "str\")
+(echo "\u{65}")