GMLCompiler: Fix bug where backslash in escaped sequence was preserved

This commit is contained in:
Bastiaan van der Plaat 2023-09-15 19:49:07 +02:00 committed by Andrew Kaster
parent 6265c544f9
commit a4e272d2c8
Notes: sideshowbarker 2024-07-17 10:31:19 +09:00

View file

@ -145,10 +145,10 @@ static ErrorOr<String> escape_string(JsonValue to_escape)
// All C++ simple escape sequences; see https://en.cppreference.com/w/cpp/language/escape
// Other commonly-escaped characters are hard-to-type Unicode and therefore fine to include verbatim in UTF-8 coded strings.
static HashMap<StringView, StringView> escape_sequences = {
{ "\\"sv, "\\\\"sv }, // This needs to be the first because otherwise the the backslashes of other items will be double escaped
{ "\0"sv, "\\0"sv },
{ "\'"sv, "\\'"sv },
{ "\""sv, "\\\""sv },
{ "\\"sv, "\\\\"sv },
{ "\a"sv, "\\a"sv },
{ "\b"sv, "\\b"sv },
{ "\f"sv, "\\f"sv },