File tree 1 file changed +23
-2
lines changed
1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,22 @@ class smt2_solvert:public smt2_parsert
47
47
} status;
48
48
};
49
49
50
+ static std::string smt2_string_literal (const std::string &s)
51
+ {
52
+ // " is the only escape sequence
53
+ std::string result;
54
+ result += ' "' ;
55
+
56
+ for (const auto &c : s)
57
+ if (c == ' "' )
58
+ result += " \"\" " ;
59
+ else
60
+ result += c;
61
+
62
+ result += ' "' ;
63
+ return result;
64
+ }
65
+
50
66
void smt2_solvert::define_constants (const exprt &expr)
51
67
{
52
68
for (const auto &op : expr.operands ())
@@ -228,6 +244,13 @@ void smt2_solvert::command(const std::string &c)
228
244
229
245
std::cout << " )\n " ;
230
246
}
247
+ else if (c == " echo" )
248
+ {
249
+ if (next_token () != STRING_LITERAL)
250
+ std::cout << " expected string literal" << ' \n ' ;
251
+ else
252
+ std::cout << smt2_string_literal (buffer) << ' \n ' ;
253
+ }
231
254
else if (c==" simplify" )
232
255
{
233
256
// this is a command that Z3 appears to implement
@@ -251,8 +274,6 @@ void smt2_solvert::command(const std::string &c)
251
274
| ( define-fun-rec hfunction_def i )
252
275
| ( define-funs-rec ( hfunction_deci n+1 ) ( htermi n+1 ) )
253
276
| ( define-sort hsymboli ( hsymboli ??? ) hsorti )
254
- | ( echo hstringi )
255
- | ( exit )
256
277
| ( get-assertions )
257
278
| ( get-assignment )
258
279
| ( get-info hinfo_flag i )
You can’t perform that action at this time.
0 commit comments