Skip to content

Commit 4f99430

Browse files
Strings: Escape backslashes when creating String literals.
This is needed to protect the backslash from substitution later when getting the results from the model.
1 parent 9db5646 commit 4f99430

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/org/sosy_lab/java_smt/basicimpl/AbstractStringFormulaManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ private static boolean isCodePointInRange(int codePoint) {
7878
protected static String escapeUnicodeForSmtlib(String input) {
7979
StringBuilder sb = new StringBuilder();
8080
for (int codePoint : input.codePoints().toArray()) {
81-
if (0x20 <= codePoint && codePoint <= 0x7E) {
81+
if (codePoint == 0x5c) {
82+
// Backslashes must be escaped, otherwise they may get substituted when reading back
83+
// the results from the model
84+
sb.append("\\u{5c}");
85+
} else if (0x20 <= codePoint && codePoint <= 0x7E) {
8286
sb.appendCodePoint(codePoint); // normal printable chars
8387
} else {
8488
sb.append("\\u{").append(String.format("%05X", codePoint)).append("}");

0 commit comments

Comments
 (0)