From c8b3ae91ad05d50e4a6caa16a5d4e5cf71b23548 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 22 May 2010 21:11:22 +0000 Subject: 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. --- src/compiler/scala/tools/nsc/Interpreter.scala | 15 ++++----------- src/compiler/scala/tools/nsc/interpreter/package.scala | 8 ++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) (limited to 'src') 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) -- cgit v1.2.3