Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pprint/src/pprint/Walker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ abstract class Walker{
case x: Float => Tree.Literal(x.toString + "F")
case x: Double => Tree.Literal(x.toString)
case x: String =>
if (x.exists(c => c == '\n' || c == '\r')) Tree.Literal("\"\"\"" + x + "\"\"\"")
if (x.exists(c => c == '\n' || c == '\r' || c == '\\')) Tree.Literal("\"\"\"" + x + "\"\"\"")
else Tree.Literal(Util.literalize(x, escapeUnicode))

case x: Symbol => Tree.Literal("'" + x.name)
Expand Down
1 change: 1 addition & 0 deletions pprint/test/src-3/test/src/pprint/HorizontalTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object HorizontalTests extends TestSuite{
val tq = "\"\"\""
test - Check("i am a cow", """ "i am a cow" """)
test - Check( """ "hello" """.trim, """ "\"hello\"" """.trim)
test - Check( """foo\bar""".trim, " \"\"\"foo\\bar\"\"\" ".trim)

test - Check("\n", s"""
|$tq
Expand Down