diff options
author | Paul Phillips <paulp@improving.org> | 2011-02-11 04:00:46 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-02-11 04:00:46 +0000 |
commit | e9f1ccb0308f207303af2507415379c4d8dbcd6a (patch) | |
tree | 63405092a3b6eee03ee1ecef6a7da1578dd23b42 /src/compiler/scala/tools/nsc/interpreter/IMain.scala | |
parent | 8e380b67366ab83d81fd401632af17d7cc0c2205 (diff) | |
download | scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.tar.gz scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.tar.bz2 scala-e9f1ccb0308f207303af2507415379c4d8dbcd6a.zip |
This addresses a few long standing irritations ...
This addresses a few long standing irritations with jline, rewriting
chunks of it along the way. No longer does columnar output spill over
and double space everything if you're unlucky with the chosen widths.
Pagination works for a higher definition of work. Etc.
Also, for those who enjoy operating missile systems from their repls,
crash recovery now requests your permission before replaying the
session.
Closes #4194, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/IMain.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/IMain.scala | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index c3cc0f9e03..33dcfa59e6 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -83,6 +83,7 @@ class IMain(val settings: Settings, protected val out: PrintWriter) { /** reporter */ lazy val reporter: ConsoleReporter = new IMain.ReplReporter(this) import reporter.{ printMessage, withoutTruncating } + // not sure if we have some motivation to print directly to console private def echo(msg: String) { Console println msg } @@ -1088,6 +1089,14 @@ class IMain(val settings: Settings, protected val out: PrintWriter) { finally isettings.unwrapStrings = saved } + def symbolDefString(sym: Symbol) = { + TypeStrings.quieter( + afterTyper(sym.defString), + sym.owner.name + ".this.", + sym.owner.fullName + "." + ) + } + def showCodeIfDebugging(code: String) { /** Secret bookcase entrance for repl debuggers: end the line * with "// show" and see what's going on. @@ -1110,6 +1119,14 @@ class IMain(val settings: Settings, protected val out: PrintWriter) { /** Utility methods for the Interpreter. */ object IMain { + // The two name forms this is catching are the two sides of this assignment: + // + // $line3.$read.$iw.$iw.Bippy = + // $line3.$read$$iw$$iw$Bippy@4a6a00ca + private def removeLineWrapper(s: String) = s.replaceAll("""\$line\d+[./]\$(read|eval|print)[$.]""", "") + private def removeIWPackages(s: String) = s.replaceAll("""\$(iw|read|eval|print)[$.]""", "") + def stripString(s: String) = removeIWPackages(removeLineWrapper(s)) + trait CodeAssembler[T] { def preamble: String def generate: T => String @@ -1152,7 +1169,7 @@ object IMain { def isTruncating = reporter.truncationOK def stripImpl(str: String): String = { - val cleaned = removeIWPackages(removeLineWrapper(str)) + val cleaned = stripString(str) var ctrlChars = 0 cleaned map { ch => if (ch.isControl && !ch.isWhitespace) { @@ -1163,13 +1180,6 @@ object IMain { else ch } } - - // The two name forms this is catching are the two sides of this assignment: - // - // $line3.$read.$iw.$iw.Bippy = - // $line3.$read$$iw$$iw$Bippy@4a6a00ca - private def removeLineWrapper(s: String) = s.replaceAll("""\$line\d+[./]\$(read|eval|print)[$.]""", "") - private def removeIWPackages(s: String) = s.replaceAll("""\$(iw|read|eval|print)[$.]""", "") } class ReplReporter(intp: IMain) extends ConsoleReporter(intp.settings, null, new ReplStrippingWriter(intp)) { |