diff options
author | Paul Phillips <paulp@improving.org> | 2010-05-22 21:11:22 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-05-22 21:11:22 +0000 |
commit | c8b3ae91ad05d50e4a6caa16a5d4e5cf71b23548 (patch) | |
tree | 1ab9a341867b738d4d1d2b7e94cb427ef8a24277 | |
parent | 9a3f9c0e79cd82ef542a37c3b71351f137d1f1b9 (diff) | |
download | scala-c8b3ae91ad05d50e4a6caa16a5d4e5cf71b23548.tar.gz scala-c8b3ae91ad05d50e4a6caa16a5d4e5cf71b23548.tar.bz2 scala-c8b3ae91ad05d50e4a6caa16a5d4e5cf71b23548.zip |
Pulled a function from the repl into the packag...
Pulled a function from the repl into the package object because I need
it outside the repl. No review.
-rw-r--r-- | src/compiler/scala/tools/nsc/Interpreter.scala | 15 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/package.scala | 8 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala index 74d37bd31e..743ffefcd0 100644 --- a/src/compiler/scala/tools/nsc/Interpreter.scala +++ b/src/compiler/scala/tools/nsc/Interpreter.scala @@ -173,16 +173,6 @@ class Interpreter(val settings: Settings, out: PrintWriter) { /** interpreter settings */ lazy val isettings = new InterpreterSettings(this) - /** Heuristically strip interpreter wrapper prefixes - * from an interpreter output string. - */ - def stripWrapperGunk(str: String): String = - if (isettings.unwrapStrings) { - val wrapregex = """(line[0-9]+\$object[$.])?(\$iw[$.])*""" - str.replaceAll(wrapregex, "") - } - else str - /** Instantiate a compiler. Subclasses can override this to * change the compiler class used by this interpreter. */ protected def newCompiler(settings: Settings, reporter: Reporter) = { @@ -341,7 +331,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) { } /** Clean up a string for output */ - private def clean(str: String) = truncPrintString(stripWrapperGunk(str)) + private def clean(str: String) = truncPrintString( + if (isettings.unwrapStrings) stripWrapperGunk(str) + else str + ) /** Indent some code by the width of the scala> prompt. * This way, compiler error messages read better. diff --git a/src/compiler/scala/tools/nsc/interpreter/package.scala b/src/compiler/scala/tools/nsc/interpreter/package.scala index 2ded3a7900..ab2860ac8e 100644 --- a/src/compiler/scala/tools/nsc/interpreter/package.scala +++ b/src/compiler/scala/tools/nsc/interpreter/package.scala @@ -18,6 +18,14 @@ package object interpreter { /** null becomes "", otherwise identity */ def onull(s: String) = if (s == null) "" else s + /** Heuristically strip interpreter wrapper prefixes + * from an interpreter output string. + */ + def stripWrapperGunk(str: String): String = { + val wrapregex = """(line[0-9]+\$object[$.])?(\$iw[$.])*""" + str.replaceAll(wrapregex, "") + } + /** Class objects */ def classForName(name: String): Option[Class[_]] = try Some(Class forName name) |