File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,22 @@ class smt2_solvert:public smt2_parsert
41
41
std::set<irep_idt> constants_done;
42
42
};
43
43
44
+ static std::string smt2_string_literal (const std::string &s)
45
+ {
46
+ // " is the only escape sequence
47
+ std::string result;
48
+ result += ' "' ;
49
+
50
+ for (const auto &c : s)
51
+ if (c == ' "' )
52
+ result += " \"\" " ;
53
+ else
54
+ result += c;
55
+
56
+ result += ' "' ;
57
+ return result;
58
+ }
59
+
44
60
void smt2_solvert::define_constants (const exprt &expr)
45
61
{
46
62
for (const auto &op : expr.operands ())
@@ -162,6 +178,13 @@ void smt2_solvert::command(const std::string &c)
162
178
std::cout << e.pretty () << ' \n ' ; // need to do an 'smt2_format'
163
179
}
164
180
}
181
+ else if (c == " echo" )
182
+ {
183
+ if (next_token () != STRING_LITERAL)
184
+ std::cout << " expected string literal" << ' \n ' ;
185
+ else
186
+ std::cout << smt2_string_literal (buffer) << ' \n ' ;
187
+ }
165
188
else if (c==" simplify" )
166
189
{
167
190
// this is a command that Z3 appears to implement
@@ -185,8 +208,6 @@ void smt2_solvert::command(const std::string &c)
185
208
| ( define-fun-rec hfunction_def i )
186
209
| ( define-funs-rec ( hfunction_deci n+1 ) ( htermi n+1 ) )
187
210
| ( define-sort hsymboli ( hsymboli ??? ) hsorti )
188
- | ( echo hstringi )
189
- | ( exit )
190
211
| ( get-assertions )
191
212
| ( get-assignment )
192
213
| ( get-info hinfo_flag i )
You can’t perform that action at this time.
0 commit comments