From 50ab8814964996ace5c042e3f6289d573a8bf0e2 Mon Sep 17 00:00:00 2001 From: nkchuykin Date: Mon, 1 Aug 2022 22:40:01 +0300 Subject: [PATCH 1/3] Escape backslash character. --- project/scripts/data/skips/testcuite.txt | 3 +-- project/src/transpiler/transpile_helper.cpp | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/project/scripts/data/skips/testcuite.txt b/project/scripts/data/skips/testcuite.txt index 4bfea993..9c2c0ae6 100644 --- a/project/scripts/data/skips/testcuite.txt +++ b/project/scripts/data/skips/testcuite.txt @@ -1,5 +1,4 @@ 00095, 00096: variables declaration duplicates 00078, 00128, 00175: TODO char 00040, 00104, 00181, 00182: uint64 is unsupported -00205: java code too large -00217: TODO escaping quotes \ No newline at end of file +00205: java code too large \ No newline at end of file diff --git a/project/src/transpiler/transpile_helper.cpp b/project/src/transpiler/transpile_helper.cpp index 385874b4..30d2f03b 100644 --- a/project/src/transpiler/transpile_helper.cpp +++ b/project/src/transpiler/transpile_helper.cpp @@ -168,6 +168,9 @@ std::string Escaped(const std::string &input) { case '\v': output += "\\v"; break; + case '\\': + output += "\\\\"; + break; default: output += c; break; From 28c7b8f089d60a0646aae891aadd69a33c9941da Mon Sep 17 00:00:00 2001 From: nkchuykin Date: Mon, 1 Aug 2022 22:52:34 +0300 Subject: [PATCH 2/3] Escape quotes character. --- project/src/transpiler/transpile_helper.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/project/src/transpiler/transpile_helper.cpp b/project/src/transpiler/transpile_helper.cpp index 30d2f03b..68c43fd3 100644 --- a/project/src/transpiler/transpile_helper.cpp +++ b/project/src/transpiler/transpile_helper.cpp @@ -171,6 +171,18 @@ std::string Escaped(const std::string &input) { case '\\': output += "\\\\"; break; + case '\'': + output += "\\\'"; + break; + case '\"': + output += "\\\""; + break; + case '\?': + output += "\\?"; + break; + case '\0': + output += "\\0"; + break; default: output += c; break; From 34295be6c2ad62984d5181ac28a502a84499f5c7 Mon Sep 17 00:00:00 2001 From: nkchuykin Date: Mon, 1 Aug 2022 23:07:30 +0300 Subject: [PATCH 3/3] bug fix. --- project/src/transpiler/transpile_helper.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/project/src/transpiler/transpile_helper.cpp b/project/src/transpiler/transpile_helper.cpp index 68c43fd3..9ae2400b 100644 --- a/project/src/transpiler/transpile_helper.cpp +++ b/project/src/transpiler/transpile_helper.cpp @@ -177,9 +177,6 @@ std::string Escaped(const std::string &input) { case '\"': output += "\\\""; break; - case '\?': - output += "\\?"; - break; case '\0': output += "\\0"; break;