mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
use ADT for strings
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
a7e2fb31e3
commit
3c50508762
10 changed files with 421 additions and 201 deletions
|
@ -364,16 +364,18 @@ format * smt2_pp_environment::pp_arith_literal(app * t, bool decimal, unsigned d
|
|||
}
|
||||
|
||||
format * smt2_pp_environment::pp_string_literal(app * t) {
|
||||
std::string s;
|
||||
zstring s;
|
||||
std::string encs;
|
||||
VERIFY (get_sutil().str.is_string(t, s));
|
||||
encs = s.encode();
|
||||
std::ostringstream buffer;
|
||||
buffer << "\"";
|
||||
for (unsigned i = 0; i < s.length(); ++i) {
|
||||
if (s[i] == '\"') {
|
||||
for (unsigned i = 0; i < encs.length(); ++i) {
|
||||
if (encs[i] == '\"') {
|
||||
buffer << "\"\"";
|
||||
}
|
||||
else {
|
||||
buffer << s[i];
|
||||
buffer << encs[i];
|
||||
}
|
||||
}
|
||||
buffer << "\"";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue