diff options
author | Seth Tisue <seth@tisue.net> | 2015-08-27 17:42:57 -0400 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2015-08-27 17:42:57 -0400 |
commit | 9fc52c8729a2c63342cbc42e350f3b1782ddb7cb (patch) | |
tree | dc1ea5e807912c60ee690cc741c54d321c548699 /src | |
parent | d6728ce984f80c43a41615e6aa590b5a3d483bee (diff) | |
parent | 0b121d1864a3db1b34e5102e8258984ad0e8fd53 (diff) | |
download | scala-9fc52c8729a2c63342cbc42e350f3b1782ddb7cb.tar.gz scala-9fc52c8729a2c63342cbc42e350f3b1782ddb7cb.tar.bz2 scala-9fc52c8729a2c63342cbc42e350f3b1782ddb7cb.zip |
Merge pull request #4710 from retronym/ticket/9450
SI-9450 Fix triple quoted strings in REPL :power mode
Diffstat (limited to 'src')
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/IMain.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/IMain.scala b/src/repl/scala/tools/nsc/interpreter/IMain.scala index 06ae179da9..3b54f5274e 100644 --- a/src/repl/scala/tools/nsc/interpreter/IMain.scala +++ b/src/repl/scala/tools/nsc/interpreter/IMain.scala @@ -133,7 +133,6 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set } catch AbstractOrMissingHandler() } - private def tquoted(s: String) = "\"\"\"" + s + "\"\"\"" private val logScope = scala.sys.props contains "scala.repl.scope" private def scopelog(msg: String) = if (logScope) Console.err.println(msg) @@ -905,7 +904,10 @@ class IMain(@BeanProperty val factory: ScriptEngineFactory, initialSettings: Set def path = originalPath("$intp") def envLines = { if (!isReplPower) Nil // power mode only for now - else List("def %s = %s".format("$line", tquoted(originalLine)), "def %s = Nil".format("$trees")) + else { + val escapedLine = Constant(originalLine).escapedStringValue + List(s"""def $$line = $escapedLine """, """def $trees = _root_.scala.Nil""") + } } def preamble = s""" |$headerPreamble |