scala.meta.internal.prettyprinters.Escape.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prettyprinters_2.11 Show documentation
Show all versions of prettyprinters_2.11 Show documentation
Scala.meta's baseline prettyprinters
The newest version!
package scala.meta
package internal
package prettyprinters
object escape {
def apply(s: String): String = {
// TODO: comprehensive handling
val codepage = Map(
"\t" -> "\\t",
"\b" -> "\\b",
"\n" -> "\\n",
"\r" -> "\\r",
"\f" -> "\\f",
"\\" -> "\\\\"
)
s.flatMap(c => codepage.getOrElse(c.toString, c.toString))
}
}