git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Fix string literal backslash escapes
196c9b8Andy Arvanitis
src/CodeGen/Cpp/Printer.hs+1−1
@@ -382,7 +382,7 @@ prettyPrintCpp1 :: AST -> Text
382prettyPrintCpp1 = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyPrintCpp'
382prettyPrintCpp1 = maybe (internalError "Incomplete pattern") runPlainString . flip evalStateT (PrinterState 0) . prettyPrintCpp'
383
383
384stringLiteral :: Text -> Text
384stringLiteral :: Text -> Text
385−stringLiteral s = "\"" <> s <> "\""
385+stringLiteral s = "\"" <> (T.replace "\\" "\\\\" s) <> "\""
386
386
387unbox :: Text -> AST -> Text
387unbox :: Text -> AST -> Text
388unbox _ v@(NumericLiteral{}) = prettyPrintCpp1 v
388unbox _ v@(NumericLiteral{}) = prettyPrintCpp1 v