Packages

  • package root

    The Scala compiler and reflection APIs.

    The Scala compiler and reflection APIs.

    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package tools
    Definition Classes
    scala
  • package nsc
    Definition Classes
    tools
  • package interpreter

    The main REPL related classes and values are as follows.

    The main REPL related classes and values are as follows. In addition to standard compiler classes Global and Settings, there are:

    History: an interface for session history. Completion: an interface for tab completion. ILoop (formerly InterpreterLoop): The umbrella class for a session. IMain (formerly Interpreter): Handles the evolving state of the session and handles submitting code to the compiler and handling the output. InteractiveReader: how ILoop obtains input. History: an interface for session history. Completion: an interface for tab completion. Power: a repository for more advanced/experimental features.

    ILoop contains { in: InteractiveReader, intp: IMain, settings: Settings, power: Power } InteractiveReader contains { history: History, completion: Completion } IMain contains { global: Global }

    Definition Classes
    nsc
  • class ILoop extends LoopCommands

    The Scala interactive shell.

    The Scala interactive shell. It provides a read-eval-print loop around the Interpreter class. After instantiation, clients should call the main() method.

    If no in0 is specified, then input will come from the console, and the class will attempt to provide input editing feature such as input history.

    Definition Classes
    interpreter
    Version

    1.2

  • ILoopInterpreter
  • LineCmd
  • LineResults
  • LoopCommand
  • NullaryCmd
  • ReplCompletion
  • Result
  • VarArgsCmd
c

scala.tools.nsc.interpreter.ILoop

ILoopInterpreter

class ILoopInterpreter extends IMain

Source
ILoop.scala
Linear Supertypes
IMain, Closeable, AutoCloseable, PresentationCompilation, Imports, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ILoopInterpreter
  2. IMain
  3. Closeable
  4. AutoCloseable
  5. PresentationCompilation
  6. Imports
  7. AnyRef
  8. Any
Implicitly
  1. by IMainOps
  2. by any2stringadd
  3. by StringFormat
  4. by Ensuring
  5. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ILoopInterpreter()

Type Members

  1. abstract class PhaseDependentOps extends AnyRef
    Definition Classes
    IMain
  2. class ReadEvalPrint extends AnyRef

    Here is where we:

    Here is where we:

    1) Read some source code, and put it in the "read" object. 2) Evaluate the read object, and put the result in the "eval" object. 3) Create a String for human consumption, and put it in the "print" object.

    Read! Eval! Print! Some of that not yet centralized here.

    Definition Classes
    IMain
  3. implicit class ReplTypeOps extends AnyRef
    Definition Classes
    IMain
  4. class Request extends AnyRef

    One line of code submitted by the user for interpretation

    One line of code submitted by the user for interpretation

    Definition Classes
    IMain
  5. case class ComputedImports(header: String, prepend: String, append: String, access: String) extends Product with Serializable

    Compute imports that allow definitions from previous requests to be visible in a new request.

    Compute imports that allow definitions from previous requests to be visible in a new request. Returns three or four pieces of related code:

    0. Header code fragment that should go at the beginning of the compilation unit, specifically, import Predef.

    1. An initial code fragment that should go before the code of the new request.

    2. A code fragment that should go after the code of the new request.

    3. An access path which can be traversed to access any bindings inside code wrapped by #1 and #2 .

    The argument is a set of Names that need to be imported.

    Limitations: This method is not as precise as it could be. (1) It does not process wildcard imports to see what exactly they import. (2) If it imports any names from a request, it imports all of them, which is not really necessary. (3) It imports multiple same-named implicits, but only the last one imported is actually usable.

    Definition Classes
    Imports
  6. abstract class PresentationCompileResult extends AnyRef
    Definition Classes
    PresentationCompilation

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to any2stringadd[ILoopInterpreter] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ILoopInterpreter, B)
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to ArrowAssoc[ILoopInterpreter] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. 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.

    Definition Classes
    IMain
    Note

    Currently only supports jars, not directories.

  7. def allDefinedNames: List[Global.Name]
    Definition Classes
    IMain
  8. def allHandlers: collection.immutable.List[(memberHandlers)#MemberHandler]
    Definition Classes
    IMain
  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. def backticked(s: String): String
    Definition Classes
    IMain
  11. def beQuietDuring[T](body: ⇒ T): T

    Temporarily be quiet

    Temporarily be quiet

    Definition Classes
    IMain
  12. def beSilentDuring[T](operation: ⇒ T): T
    Definition Classes
    IMain
  13. def bind[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Results.Result
    Definition Classes
    IMain
  14. def bind(p: NamedParam): Results.Result
    Definition Classes
    IMain
  15. 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.

    A fresh ReadEvalPrint, which defines a line package, is used to compile a custom eval object that wraps the bound value.

    If the bound value is successfully installed, then bind the name by interpreting val name = $line42.$eval.value.

    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

    Definition Classes
    IMain
  16. def classLoader: util.AbstractFileClassLoader
    Definition Classes
    IMain
  17. def classOfTerm(id: String): Option[JClass]
    Definition Classes
    IMain
  18. def cleanMemberDecl(owner: Global.Symbol, member: Global.Name): Global.Type
    Definition Classes
    IMain
  19. def cleanTypeAfterTyper(sym: ⇒ Global.Symbol): Global.Type
    Definition Classes
    IMain
  20. def clearExecutionWrapper(): Unit
    Definition Classes
    IMain
  21. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  22. 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.

    Definition Classes
    IMain → Closeable → AutoCloseable
  23. def compileSources(sources: SourceFile*): Boolean

    Compile an nsc SourceFile.

    Compile an nsc SourceFile. Returns true if there are no compilation errors, or false otherwise.

    Definition Classes
    IMain
  24. def compileSourcesKeepingRun(sources: SourceFile*): (Boolean, Run)
    Definition Classes
    IMain
  25. def compileString(code: String): Boolean

    Compile a string.

    Compile a string. Returns true if there are no compilation errors, or false otherwise.

    Definition Classes
    IMain
  26. def compilerClasspath: Seq[URL]
    Definition Classes
    IMain
  27. def dealiasNonPublic(tp: Global.Type): Global.Type
    Definition Classes
    IMain
  28. def debugging[T](msg: String)(res: T): T
    Definition Classes
    IMain
  29. def definedSymbolList: collection.immutable.List[Global.Symbol]
    Definition Classes
    IMain
  30. def definedTerms: collection.immutable.List[Global.TermName]
    Definition Classes
    IMain
  31. def definedTypes: List[Global.TypeName]
    Definition Classes
    IMain
  32. def directBind[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Results.Result
    Definition Classes
    IMain
  33. def directBind(p: NamedParam): Results.Result
    Definition Classes
    IMain
  34. def directBind(name: String, boundType: String, value: Any): Results.Result
    Definition Classes
    IMain
  35. def echoKind: ((tpe: _1.intp.global.Type, kind: _1.intp.global.Kind, verbose: Boolean)Unit) forSome {val _1: IMainOps}
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  36. def echoTypeSignature: ((sym: _1.intp.global.Symbol, verbose: Boolean)Unit) forSome {val _1: IMainOps}
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  37. def echoTypeStructure: ((sym: _1.intp.global.Symbol)Unit) forSome {val _1: IMainOps}
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  38. final def ensureClassLoader(): Unit
    Definition Classes
    IMain
  39. def ensuring(cond: (ILoopInterpreter) ⇒ Boolean, msg: ⇒ Any): ILoopInterpreter
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to Ensuring[ILoopInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  40. def ensuring(cond: (ILoopInterpreter) ⇒ Boolean): ILoopInterpreter
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to Ensuring[ILoopInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  41. def ensuring(cond: Boolean, msg: ⇒ Any): ILoopInterpreter
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to Ensuring[ILoopInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  42. def ensuring(cond: Boolean): ILoopInterpreter
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to Ensuring[ILoopInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  43. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  44. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  45. def executionWrapper: String
    Definition Classes
    IMain
  46. def finalize(): Unit
    Definition Classes
    IMain → AnyRef
  47. def flatPath(sym: Global.Symbol): String
    Definition Classes
    IMain
  48. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  49. def getClassIfDefined(path: String): Global.Symbol
    Definition Classes
    IMain
  50. def getModuleIfDefined(path: String): Global.Symbol
    Definition Classes
    IMain
  51. lazy val global: Global
    Definition Classes
    IMain
  52. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  53. def implicitSymbolsBySource: List[(Global.Symbol, List[Global.Symbol])]
    Definition Classes
    Imports
  54. def implicitsCommand(line: String): String
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  55. def importHandlers: collection.immutable.List[(memberHandlers)#ImportHandler]
    Definition Classes
    IMain
  56. def importsCode(wanted: Set[Global.Name], wrapper: Wrapper, generousImports: Boolean): ComputedImports
    Attributes
    protected
    Definition Classes
    Imports
  57. def initialize(postInitSignal: ⇒ Unit): Unit
    Definition Classes
    IMain
  58. def initializeSynchronous(): Unit
    Definition Classes
    IMain
  59. def interpret(line: String, synthetic: Boolean): Results.Result
    Definition Classes
    IMain
  60. 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 interpreter successfully, e.g. that there were no parse errors.

    Definition Classes
    IMain
  61. def interpretSynthetic(line: String): Results.Result
    Definition Classes
    IMain
  62. val intp: IMain
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  63. lazy val isClassBased: Boolean
    Definition Classes
    IMain
  64. def isInitializeComplete: Boolean
    Definition Classes
    IMain
  65. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  66. lazy val isettings: ISettings

    interpreter settings

    interpreter settings

    Definition Classes
    IMain
  67. def kindCommandInternal(typeString: String, verbose: Boolean): Unit
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  68. def languageWildcardHandlers: collection.immutable.List[(memberHandlers)#ImportHandler]
    Definition Classes
    Imports
  69. def lastRequest: Request
    Definition Classes
    IMain
  70. def lastWarnings: List[(Global.Position, String)]
    Definition Classes
    IMain
  71. lazy val memberHandlers: MemberHandlers { val intp: ILoopInterpreter.this.type }
    Definition Classes
    IMain
  72. 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.

    Definition Classes
    IMain
  73. def namedDefinedTerms: collection.immutable.List[Global.TermName]
    Definition Classes
    IMain
  74. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  75. def newCompiler(settings: Settings, reporter: Reporter): ReplGlobal

    Instantiate a compiler.

    Instantiate a compiler. Overridable.

    Attributes
    protected
    Definition Classes
    IMain
  76. def newPresentationCompiler(): interactive.Global

    Create an instance of the presentation compiler with a classpath comprising the REPL's configured classpath and the classes output by previously compiled REPL lines.

    Create an instance of the presentation compiler with a classpath comprising the REPL's configured classpath and the classes output by previously compiled REPL lines.

    You may directly interact with this compiler from any thread, although you must not access it concurrently from multiple threads.

    You may downcast the reporter to StoreReporter to access type errors.

    Definition Classes
    PresentationCompilation
  77. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  78. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  79. def onlyTerms(xs: List[Global.Name]): List[Global.TermName]
    Attributes
    protected
    Definition Classes
    IMain
  80. def onlyTypes(xs: List[Global.Name]): List[Global.TypeName]
    Attributes
    protected
    Definition Classes
    IMain
  81. def originalPath(sym: Global.Symbol): String
    Definition Classes
    IMain
  82. def originalPath(name: Global.Name): String
    Definition Classes
    IMain
  83. def originalPath(name: String): String
    Definition Classes
    IMain
  84. val out: JPrintWriter
    Attributes
    protected
    Definition Classes
    IMain
  85. def parentClassLoader: ClassLoader

    Parent classloader.

    Parent classloader. Overridable.

    Attributes
    protected
    Definition Classes
    ILoopInterpreterIMain
  86. var partialInput: String
    Definition Classes
    IMain
  87. def prevRequestList: collection.immutable.List[Request]
    Definition Classes
    IMain
  88. def printAfterTyper(msg: ⇒ String): Unit
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  89. def quietBind(p: NamedParam): Results.Result
    Definition Classes
    IMain
  90. def quietRun[T](code: String): Results.Result
    Definition Classes
    IMain
  91. val readInstanceName: String
    Definition Classes
    IMain
  92. def readRootPath(readPath: String): Global.Symbol
    Definition Classes
    IMain
  93. def rebind(p: NamedParam): Results.Result
    Definition Classes
    IMain
  94. def recordRequest(req: Request): Unit
    Definition Classes
    IMain
  95. def replScope: Global.Scope
    Definition Classes
    IMain
  96. lazy val reporter: ReplReporter
    Definition Classes
    IMain
  97. def reset(): Unit

    Reset this interpreter, forgetting all user-specified requests.

    Reset this interpreter, forgetting all user-specified requests.

    Definition Classes
    IMain
  98. def resetClassLoader(): Unit
    Definition Classes
    IMain
  99. def runtimeClassAndTypeOfTerm(id: String): Option[(JClass, Global.Type)]
    Definition Classes
    IMain
  100. def runtimeMirror: Mirror
    Definition Classes
    IMain
  101. def runtimeTypeOfTerm(id: String): Global.Type
    Definition Classes
    IMain
  102. def setExecutionWrapper(code: String): Unit
    Definition Classes
    IMain
  103. def settings: Settings
    Definition Classes
    IMain
  104. def showCodeIfDebugging(code: String): Unit
    Definition Classes
    IMain
  105. def showDirectory(): Unit
    Definition Classes
    IMain
  106. def symbolDefString(sym: Global.Symbol): String
    Definition Classes
    IMain
  107. def symbolOfIdent(id: String): Global.Symbol
    Definition Classes
    IMain
  108. def symbolOfLine(code: String): Global.Symbol
    Definition Classes
    IMain
  109. def symbolOfName(id: Global.Name): Global.Symbol
    Definition Classes
    IMain
  110. def symbolOfTerm(id: String): Global.Symbol
    Definition Classes
    IMain
  111. def symbolOfType(id: String): Global.Symbol
    Definition Classes
    IMain
  112. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  113. def toString(): String
    Definition Classes
    AnyRef → Any
  114. def translateEnclosingClass(n: String): Option[String]
    Definition Classes
    IMain
  115. def translateOriginalPath(p: String): String
    Definition Classes
    IMain
  116. def translatePath(path: String): Option[String]
    Definition Classes
    IMain
  117. def translateSimpleResource(path: String): Option[String]

    If path represents a class resource in the default package, see if the corresponding symbol has a class file that is a REPL artifact residing at a different resource path.

    If path represents a class resource in the default package, see if the corresponding symbol has a class file that is a REPL artifact residing at a different resource path. Translate X.class to $line3/$read$iw$X.class.

    Definition Classes
    IMain
  118. def tryTwice(op: ⇒ Global.Symbol): Global.Symbol

    It's a bit of a shotgun approach, but for now we will gain in robustness.

    It's a bit of a shotgun approach, but for now we will gain in robustness. Try a symbol-producing operation at phase typer, and if that is NoSymbol, try again at phase flatten. I'll be able to lose this and run only from exitingTyper as soon as I figure out exactly where a flat name is sneaking in when calculating imports.

    Definition Classes
    IMain
  119. def typeCommandInternal(expr: String, verbose: Boolean): Unit

    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 ILoopInterpreter to IMainOps performed by method IMainOps in scala.tools.nsc.interpreter.
    Definition Classes
    IMainOps
  120. def typeOfExpression(expr: String, silent: Boolean = true): Global.Type
    Definition Classes
    IMain
  121. def typeOfTerm(id: String): Global.Type
    Definition Classes
    IMain
  122. def unqualifiedIds: List[String]
    Definition Classes
    IMain
  123. def valueOfTerm(id: String): Option[Any]
    Definition Classes
    IMain
  124. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  125. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  126. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  127. def withLabel[A](temp: String)(body: ⇒ A): A
    Definition Classes
    IMain
  128. def withoutTruncating[A](body: ⇒ A): A
    Definition Classes
    IMain
  129. def withoutUnwrapping(op: ⇒ Unit): Unit
    Definition Classes
    IMain
  130. def withoutWarnings[T](body: ⇒ T): T
    Definition Classes
    IMain
  131. def [B](y: B): (ILoopInterpreter, B)
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to ArrowAssoc[ILoopInterpreter] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
  132. object deconstruct extends StructuredTypeStrings
    Definition Classes
    IMain
  133. object exprTyper extends ExprTyper
    Definition Classes
    IMain
  134. object flatOp extends PhaseDependentOps
    Definition Classes
    IMain
  135. object naming extends Naming
    Definition Classes
    IMain
  136. object parse

    Parse a line into and return parsing result (error, incomplete or success with list of trees)

    Parse a line into and return parsing result (error, incomplete or success with list of trees)

    Definition Classes
    IMain
  137. object replOutput extends ReplOutput
    Definition Classes
    IMain
  138. object typerOp extends PhaseDependentOps
    Definition Classes
    IMain
  139. object PresentationCompileResult
    Definition Classes
    PresentationCompilation

Deprecated Value Members

  1. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ILoopInterpreter to StringFormat[ILoopInterpreter] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  2. def setContextClassLoader(): Unit
    Definition Classes
    IMain
    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.

  3. def virtualDirectory: ReplDir
    Definition Classes
    IMain
    Annotations
    @deprecated
    Deprecated

    (Since version 2.11.0) Use replOutput.dir instead

Inherited from IMain

Inherited from Closeable

Inherited from AutoCloseable

Inherited from PresentationCompilation

Inherited from Imports

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion IMainOps from ILoopInterpreter to IMainOps

Inherited by implicit conversion any2stringadd from ILoopInterpreter to any2stringadd[ILoopInterpreter]

Inherited by implicit conversion StringFormat from ILoopInterpreter to StringFormat[ILoopInterpreter]

Inherited by implicit conversion Ensuring from ILoopInterpreter to Ensuring[ILoopInterpreter]

Inherited by implicit conversion ArrowAssoc from ILoopInterpreter to ArrowAssoc[ILoopInterpreter]

Ungrouped