From e79a7415de49c481c319b6a6e72b4cebfe0750f8 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 11 Sep 2021 13:41:57 +0200 Subject: [PATCH] Add an overload to reuse the same characters for the two parameters of Target::stringInterpolation and use an escaped character sequence --- src/headers/transpiler/Target.hpp | 1 + src/headers/transpiler/implementations/Py.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index c60bd0d..ce8fb59 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -19,6 +19,7 @@ protected: std::stringstream output; INCLUDECOMPONENT(StandardComponents::Define); INCLUDECOMPONENT(StandardComponents::types::String); + inline void stringInterpolation(const char* multiline, const string& view) { stringInterpolation(view, multiline, multiline); } void stringInterpolation(string view, const char* openMultiline = "", const char* closeMultiline = "", const char* concatenationCharacters = "+") { vector interpolationVector; unsigned long occurrence_position = view.find(interpolationString); diff --git a/src/headers/transpiler/implementations/Py.hpp b/src/headers/transpiler/implementations/Py.hpp index 1281ea8..252d79b 100644 --- a/src/headers/transpiler/implementations/Py.hpp +++ b/src/headers/transpiler/implementations/Py.hpp @@ -7,7 +7,7 @@ struct PyTarget: Target { output << parseComponent.name << " = "; } void on(const StandardComponents::types::String &parseComponent) override { - stringInterpolation(parseComponent.content, "\"\"\"", "\"\"\""); + stringInterpolation(R"(""")", parseComponent.content); } using Target::Target; };