class ILoop extends LoopCommands
The Scala interactive shell. This part provides the user interface, with evaluation and auto-complete handled by IMain.
There should be no direct dependency of this code on the compiler;
it should all go through the intp
reference to the interpreter,
or maybe eventually even over the wire to a remote compiler.
- Source
- ILoop.scala
- Alphabetic
- By Inheritance
- ILoop
- LoopCommands
- AnyRef
- Any
- by loopToInterpreter
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ILoop(config: ShellConfig, inOverride: BufferedReader = null, out: PrintWriter = new PrintWriter(Console.out, true))
Type Members
- class LineCmd extends LoopCommand
- Definition Classes
- LoopCommands
- abstract class LoopCommand extends (String) => Result
- Definition Classes
- LoopCommands
- class NullaryCmd extends LoopCommand
- Definition Classes
- LoopCommands
- case class Result(keepRunning: Boolean, lineToRecord: Option[String]) extends Product with Serializable
- Definition Classes
- LoopCommands
- class VarArgsCmd extends LoopCommand
- Definition Classes
- LoopCommands
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (ILoop, B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def Repl(config: ShellConfig, interpreterSettings: Settings, out: PrintWriter): IMain
- def addReplay(cmd: String): Unit
Record a command for replay should the user request a :replay
- def addUrlsToClassPath(urls: URL*): Unit
Adds all specified jars to the compile and runtime classpaths.
Adds all specified jars to the compile and runtime classpaths.
- urls
The list of items to add to the compile and runtime classpaths.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- Note
Currently only supports jars, not directories.
- def ambiguousError(cmd: String): Result
- Definition Classes
- LoopCommands
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asyncEcho(async: Boolean, msg: => String): Unit
- def asyncMessage(msg: String): Unit
- Attributes
- protected
- final def beQuietDuring(body: => Unit): Unit
The reporter will not print results during execution of
body
.The reporter will not print results during execution of
body
.- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl → ReplCore
- def bind(p: NamedParam): Results.Result
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def bind(name: String, boundType: String, value: Any, modifiers: List[String] = Nil): Results.Result
Bind a specified name to a specified value.
Bind a specified name to a specified value. The name may later be used by expressions passed to interpret.
- name
the variable name to bind
- boundType
the type of the variable, as a string
- value
the object value to bind to it
- returns
an indication of whether the binding succeeded
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- ReplCore
- def bindValue(name: String, value: Any): Results.Result
Bind a specified
name
to a specifiedvalue
.Bind a specified
name
to a specifiedvalue
. The type is derived from the run-time class of the value.- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- ReplCore
- def classLoader: AbstractFileClassLoader
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def classPathString: String
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def clearExecutionWrapper(): Unit
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def close(): Unit
This instance is no longer needed, so release any resources it is using.
This instance is no longer needed, so release any resources it is using. The reporter's output gets flushed.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def closeInterpreter(): Unit
Close the interpreter and set the var to null.
Close the interpreter and set the var to null.
Used by sbt.
- def colonCommand(line: String): Result
- Definition Classes
- LoopCommands
- def colonCompletion(line: String, cursor: Int): Completion
- Definition Classes
- LoopCommands
- def command(line: String): Result
- def commands: List[LoopCommand]
Available commands
Available commands
- Definition Classes
- ILoop → LoopCommands
- def compileSources(sources: SourceFile*): Boolean
Compile an nsc SourceFile.
Compile an nsc SourceFile. Returns true if there are no compilation errors, or false otherwise.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def compileString(code: String): Boolean
Compile a string.
Compile a string. Returns true if there are no compilation errors, or false otherwise.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def compilerClasspath: Seq[URL]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def completion(accumulator: Accumulator = new Accumulator): MultiCompletion
- def completionsCommand(what: String): Result
- def createInterpreter(interpreterSettings: Settings): Unit
Create a new interpreter.
Create a new interpreter.
Used by sbt.
- def definedTypes: List[String]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def echo(msg: String): Unit
- Attributes
- protected
- Definition Classes
- ILoop → LoopCommands
- def echoAndRefresh(msg: String): Unit
- Attributes
- protected
- def echoCommandMessage(msg: String): Unit
- Definition Classes
- ILoop → LoopCommands
- def echoOff[A](op: => A): A
- def editCommand(what: String, editor: Option[String]): Result
- def editCommand(what: String): Result
- def enablePowerMode(isDuringInit: Boolean): Unit
- def ensuring(cond: (ILoop) => Boolean, msg: => Any): ILoop
- def ensuring(cond: (ILoop) => Boolean): ILoop
- def ensuring(cond: Boolean, msg: => Any): ILoop
- def ensuring(cond: Boolean): ILoop
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- val fileCompletion: Completion
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def helpCommand(line: String): Result
print a friendly help message
print a friendly help message
- Definition Classes
- LoopCommands
- def helpSummary(): Unit
- Definition Classes
- LoopCommands
- def history: History
- lazy val historyCommand: LoopCommand { def defaultLines: Int }
Show the history
- def implicitsCommandInternal(line: String): (List[String], String)
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def importsCommandInternal(tokens: List[String]): List[String]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def initializeCompiler(): Boolean
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def initializeComplete: Boolean
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def internalReplAutorunCode(): Seq[String]
Allows to specify custom code to run quietly in the preamble
Allows to specify custom code to run quietly in the preamble
- returns
custom Scala code to run automatically at the startup of the REPL
- Attributes
- protected
- def interpret(line: String, synthetic: Boolean): Results.Result
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def interpret(line: String): Results.Result
Interpret one line of input.
Interpret one line of input. All feedback, including parse errors and evaluation results, are printed via the supplied compiler's reporter. Values defined are available for future interpreted strings.
The return value is whether the line was interpreted successfully, e.g. that there were no parse errors.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- ReplCore
- def interpretAllFrom(file: File, verbose: Boolean = false): Unit
interpret all lines from a specified file
- def interpretFinally(line: String): Results.Result
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- final def interpretStartingWith(start: String): Option[String]
Interpret expressions starting with the first line.
Interpret expressions starting with the first line. Read lines until a complete compilation unit is available or until a syntax error has been seen. If a full unit is read, go ahead and interpret it. Return the full string to be recorded for replay, if any.
- var intp: Repl
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPackaged(line: String): Boolean
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def kindCommandInternal(expr: String, verbose: Boolean): String
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def lastWarnings: List[(Position, String)]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def lineCommand(what: String): Result
- def loadCommand(arg: String): Result
- final def loop(): LineResult
- Annotations
- @tailrec()
- def mostRecentVar: String
Returns the name of the most recent interpreter result.
Returns the name of the most recent interpreter result. Mostly this exists so you can conveniently invoke methods on the previous result.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- var mum: Boolean
- Attributes
- protected
- def namedDefinedTerms: List[String]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def namedParam[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): NamedParam
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def originalPath(name: String): String
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- val out: PrintWriter
- Attributes
- protected
- Definition Classes
- ILoop → LoopCommands
- def outputDir: AbstractFile
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def parseString(line: String): Results.Result
TODO resolve scan, parse, compile, interpret, which just indicate how much work to do.
TODO resolve scan, parse, compile, interpret, which just indicate how much work to do.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def pasteCommand(arg: String): Result
- val power: Power[StdReplVals]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def powerCmd(): Result
- lazy val powerCommands: List[LoopCommand]
Power user commands
- def presentationCompile(cursor: Int, buf: String): Either[Results.Result, PresentationCompilationResult]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def printWelcome(): Unit
Print a welcome message!
- def processLine(line: String): Boolean
- lazy val prompt: String
- def quietBind(p: NamedParam): Results.Result
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def quietRun(code: String): Results.Result
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def readOneLine(): String
- def replay(): Unit
Announces as it replays.
- def replayCommand(line: String): Unit
create a new interpreter and replay the given commands
- var replayCommandStack: List[String]
A reverse list of commands to replay if the user requests a :replay
- def replayCommands: collection.immutable.List[String]
A list of commands to replay if the user requests a :replay
- val replayQuestionMessage: String
- def reporter: ReplReporter
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def requestDefining(name: String): Option[ReplRequest]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def require(arg: String): Unit
Adds jar file to the current classpath.
Adds jar file to the current classpath. Jar will only be added if it does not contain classes that already exist on the current classpath.
Importantly,
require
adds jars to the classpath without resetting the state of the interpreter. This is in contrast toreplay
which can be used to add jars to the classpath and which creates a new instance of the interpreter and replays all interpreter expressions. - def reset(): Unit
Resets without announcements.
- def resetCommand(line: String): Unit
reset
the interpreter in an attempt to start fresh.reset
the interpreter in an attempt to start fresh. Supplying settings creates a new compiler. - def run(interpreterSettings: Settings): Boolean
Start an interpreter with the given settings.
Start an interpreter with the given settings.
- returns
true if successful
- def saveCommand(filename: String): Result
- def savingReplayStack[T](body: => T): T
- def searchHistory(_cmdline: String): Unit
Search the history
- def setExecutionWrapper(code: String): Unit
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- val settings: Settings
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- val settingsCompletion: Completion
- lazy val shCommand: LoopCommand
fork a shell and run a command
- val shellCompletion: Completion
- def showDirectory: String
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- lazy val standardCommands: collection.immutable.List[LoopCommand]
Standard commands *
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tokenize(line: String): List[TokenData]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def translateEnclosingClass(n: String): Option[String]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def translatePath(path: String): Option[String]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def typeCommandInternal(expr: String, verbose: Boolean): (String, String)
TODO - -n normalize -l label with case class parameter names -c complete - leave nothing out
TODO - -n normalize -l label with case class parameter names -c complete - leave nothing out
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def updateSettings(arguments: List[String]): Boolean
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def userSetSettings: (=>collection.immutable.List[Settings.Setting]) forSome {val _1: Repl}
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def valueOfTerm(id: String): Option[Any]
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def verbosity(): Unit
- def visibleSettings: (=>collection.immutable.List[Settings.Setting]) forSome {val _1: Repl}
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def welcome: String
- def withFile[A](filename: String)(action: (File) => A): Option[A]
- def withLabel[A](temp: String)(body: => A): A
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- def withSuppressedSettings(body: => Unit): Unit
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- Repl
- object LineResults extends Enumeration
- object LoopCommand
- Definition Classes
- LoopCommands
- object Result extends java.io.Serializable
- Definition Classes
- LoopCommands
Shadowed Implicit Value Members
- def reset(): Unit
Reset this interpreter, forgetting all user-specified requests.
Reset this interpreter, forgetting all user-specified requests.
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(iLoop: Repl).reset()
- Definition Classes
- Repl
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from ILoop toStringFormat[ILoop] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- final def setContextClassLoader(): Unit
- Implicit
- This member is added by an implicit conversion from ILoop toRepl performed by method loopToInterpreter in scala.tools.nsc.interpreter.shell.ILoop.
- Definition Classes
- ReplCore
- Annotations
- @deprecated
- Deprecated
(Since version 2.12.0) The thread context classloader is now set and restored around execution of REPL line, this method is now a no-op.
- def →[B](y: B): (ILoop, B)
- Implicit
- This member is added by an implicit conversion from ILoop toArrowAssoc[ILoop] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.
The Scala compiler and reflection APIs.