Skip to content

Commit

Permalink
Final review round
Browse files Browse the repository at this point in the history
Add header to repl-frontend/scala/tools/nsc/interpreter/jline/Reader.scala

Still display parse errors
  • Loading branch information
adriaanm authored and som-snytt committed Aug 9, 2019
1 parent 4999155 commit a562a24
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
11 changes: 11 additions & 0 deletions src/repl-frontend/scala/tools/nsc/interpreter/jline/Reader.scala
@@ -1,3 +1,14 @@
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.tools.nsc.interpreter
package jline
Expand Down
13 changes: 6 additions & 7 deletions src/repl-frontend/scala/tools/nsc/interpreter/shell/ILoop.scala
Expand Up @@ -186,11 +186,12 @@ class ILoop(config: ShellConfig, inOverride: BufferedReader = null,

/** Standard commands **/
lazy val standardCommands = List(
cmd("completions", "<string>", "output completions for the given string", completionsCommand),
cmd("edit", "<id>|<line>", "edit history", editCommand),
cmd("help", "[command]", "print this summary or command-specific help", helpCommand),
historyCommand,
cmd("h?", "<string>", "search the history", searchHistory),
cmd("completions", "<string>", "output completions for the given string", completionsCommand),
// TODO maybe just drop these commands, as jline subsumes them -- before reenabling, finish scala.tools.nsc.interpreter.jline.HistoryAdaptor
//cmd("edit", "<id>|<line>", "edit history", editCommand),
//historyCommand,
//cmd("h?", "<string>", "search the history", searchHistory),
cmd("imports", "[name name ...]", "show import history, identifying sources of names", importsCommand),
cmd("implicits", "[-v]", "show the implicits in scope", implicitsCommand),
cmd("javap", "<path|class>", "disassemble a file or class name", javapCommand),
Expand Down Expand Up @@ -910,7 +911,7 @@ class ILoop(config: ShellConfig, inOverride: BufferedReader = null,
case Some(s) => interpretStartingWith(s)
case _ => None
}
case invocation() => interpretStartingWith(intp.mostRecentVar + start)
case invocation() => in.accumulator += intp.mostRecentVar + start ; loop()
case _ => in.accumulator += start ; loop()
}
}
Expand Down Expand Up @@ -961,8 +962,6 @@ class ILoop(config: ShellConfig, inOverride: BufferedReader = null,
}

echoOff { interpretPreamble }

//if (doCompletion) in.initCompletion(newCompleter())
})

// start full loop (if initialization was successful)
Expand Down
Expand Up @@ -44,6 +44,7 @@ trait InteractiveReader {
else readOneLine(prompt)
*/

@deprecated("No longer used", "2.13.1")
def initCompletion(completion: Completion): Unit = ()
}

Expand Down
1 change: 1 addition & 0 deletions src/repl/scala/tools/nsc/interpreter/IMain.scala
Expand Up @@ -1115,6 +1115,7 @@ class IMain(val settings: Settings, parentClassLoaderOverride: Option[ClassLoade
var isIncomplete = false
currentRun.parsing.withIncompleteHandler((_, _) => isIncomplete = true) {
reporter.reset()

val unit = newCompilationUnit(line, label)
val trees = newUnitParser(unit).parseStats()
if (reporter.hasErrors) Left(Error)
Expand Down

0 comments on commit a562a24

Please sign in to comment.