diff options
author | Abdalrhman Mohamed <32971963+abdoo8080@users.noreply.github.com> | 2021-10-19 20:11:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-20 01:11:53 +0000 |
commit | 3ae2c455dbb6ac95834fd23082688b11784dfcae (patch) | |
tree | eaccac82ff73f442a78fc1ccc9d9b7f4c6993c8a /src/util/smt2_quote_string.cpp | |
parent | f047038b1bec31a1ebb89e9d35e3aebb3301eddc (diff) |
Avoid escaping `double-quotes` twice. (#7409)
With -o raw-benchmark, The command:
(echo """")
was printed as
(echo """""""")
because we run the quote-escaping procedure twice on it. This PR fixes the issue by ensuring that we only run it once.
Diffstat (limited to 'src/util/smt2_quote_string.cpp')
-rw-r--r-- | src/util/smt2_quote_string.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/smt2_quote_string.cpp b/src/util/smt2_quote_string.cpp index 82750c48b..e2ab4a74c 100644 --- a/src/util/smt2_quote_string.cpp +++ b/src/util/smt2_quote_string.cpp @@ -42,4 +42,16 @@ std::string quoteSymbol(const std::string& s){ return s; } +std::string quoteString(const std::string& s) { + // escape all double-quotes + std::string output = s; + size_t pos = 0; + while ((pos = output.find('"', pos)) != std::string::npos) + { + output.replace(pos, 1, "\"\""); + pos += 2; + } + return '"' + output + '"'; +} + } // namespace cvc5 |