diff -r 5365ef60707e -r f5d2453c5640 progs/lexer/lexer.sc --- a/progs/lexer/lexer.sc Sat Oct 21 09:09:09 2023 +0100 +++ b/progs/lexer/lexer.sc Wed Oct 25 13:54:11 2023 +0100 @@ -331,8 +331,26 @@ - -// runs with amm2 and amm3 +/* +// Ammonite still provides +// +// scala.reflect.runtime.universe._ +// +// which has been removed in Scala 3. +// +// for escaping strings in Scala 3 +import scala.quoted._ +def escapeImpl(raw: Expr[String])(using Quotes): Expr[String] = { + import quotes.reflect.* + Literal(StringConstant(raw.show)).asExprOf[String] +} +inline def esc(inline raw: String): String = ${escapeImpl('{raw})} +val s = "abc\ndef" // not escaped +val e = esc("abc\ndef") // escaped + +println(s) +println(e) +*/ \ No newline at end of file