c

scala.tools.nsc.interpreter

ScriptedInterpreter

class ScriptedInterpreter extends IMain with ScriptedRepl

Source
Scripted.scala
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ScriptedInterpreter
  2. ScriptedRepl
  3. IMain
  4. Closeable
  5. AutoCloseable
  6. PresentationCompilation
  7. Imports
  8. Repl
  9. ReplCore
  10. AnyRef
  11. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ScriptedInterpreter(initialSettings: Settings, reporter: ReplReporter, importContextPreamble: (Set[String]) => ImportContextPreamble)

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 ReplRequest

    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 PresentationCompilationResult
    Definition Classes
    PresentationCompilation
  7. type Setting = Settings.Setting
    Definition Classes
    Repl

Value Members

  1. object deconstruct extends StructuredTypeStrings
    Definition Classes
    IMain
  2. object exprTyper extends ExprTyper
    Definition Classes
    IMain
  3. object flatOp extends PhaseDependentOps
    Definition Classes
    IMain
  4. object naming extends Naming
    Definition Classes
    IMain
  5. object replOutput extends ReplOutput
    Definition Classes
    IMain
  6. object typerOp extends PhaseDependentOps
    Definition Classes
    IMain
  7. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. final def ##(): Int
    Definition Classes
    AnyRef → Any
  9. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toany2stringadd[ScriptedInterpreter] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  10. def ->[B](y: B): (ScriptedInterpreter, B)
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toArrowAssoc[ScriptedInterpreter] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  11. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  12. def addBackReferences(req: Request): Either[String, Request]
    Definition Classes
    ScriptedInterpreterScriptedRepl
  13. 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
    IMainRepl
    Note

    Currently only supports jars, not directories.

  14. def allDefinedNames: List[Global.Name]
    Definition Classes
    IMain
  15. def allHandlers: collection.immutable.List[(memberHandlers)#MemberHandler]
    Definition Classes
    IMain
  16. def allImportedNames: collection.immutable.List[Global.Name]
    Definition Classes
    Imports
  17. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  18. def backticked(s: String): String
    Definition Classes
    IMain
  19. 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.

    Definition Classes
    ReplReplCore
  20. def bind[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Result
    Definition Classes
    IMain
  21. def bind(p: NamedParam): Result
    Definition Classes
    IMainRepl
  22. def bind(name: String, boundType: String, value: Any, modifiers: List[String] = Nil): 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
    IMainReplCore
  23. def bindValue(name: String, value: Any): Result

    Bind a specified name to a specified value.

    Bind a specified name to a specified value. The type is derived from the run-time class of the value.

    Definition Classes
    ReplCore
  24. def call(name: String, args: Any*): Either[Throwable, AnyRef]
    Definition Classes
    ScriptedInterpreterScriptedRepl
  25. def classLoader: AbstractFileClassLoader
    Definition Classes
    IMainRepl
  26. def classOfTerm(id: String): Option[Class[_]]
    Definition Classes
    IMain
  27. def classPathString: String
    Definition Classes
    IMainRepl
  28. def cleanMemberDecl(owner: Global.Symbol, member: Global.Name): Global.Type
    Definition Classes
    IMain
  29. def cleanTypeAfterTyper(sym: => Global.Symbol): Global.Type
    Definition Classes
    IMain
  30. def clearExecutionWrapper(): Unit
    Definition Classes
    IMainRepl
  31. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  32. 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 → Repl
  33. def compile(code: String): Boolean
    Definition Classes
    ScriptedInterpreterScriptedRepl
  34. def compile(line: String, synthetic: Boolean): Either[Result, Request]
    Definition Classes
    IMain
  35. 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
    IMainRepl
  36. def compileSourcesKeepingRun(sources: SourceFile*): (Boolean, Run)
    Definition Classes
    IMain
  37. def compileString(code: String): Boolean

    Compile a string.

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

    Definition Classes
    IMainRepl
  38. def compilerClasspath: Seq[URL]
    Definition Classes
    IMain
  39. def dealiasNonPublic(tp: Global.Type): Global.Type
    Definition Classes
    IMain
  40. def debugging[T](msg: String)(res: T): T
    Definition Classes
    IMain
  41. def definedSymbolList: collection.immutable.List[Global.Symbol]
    Definition Classes
    IMain
  42. def definedTerms: collection.immutable.List[Global.TermName]
    Definition Classes
    IMain
  43. def definedTypes: List[String]
    Definition Classes
    IMainRepl
  44. def directBind[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): Result
    Definition Classes
    IMain
  45. def directBind(p: NamedParam): Result
    Definition Classes
    IMain
  46. def directBind(name: String, boundType: String, value: Any): Result
    Definition Classes
    IMain
  47. final def ensureClassLoader(): Unit
    Definition Classes
    IMain
  48. def ensuring(cond: (ScriptedInterpreter) => Boolean, msg: => Any): ScriptedInterpreter
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toEnsuring[ScriptedInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  49. def ensuring(cond: (ScriptedInterpreter) => Boolean): ScriptedInterpreter
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toEnsuring[ScriptedInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  50. def ensuring(cond: Boolean, msg: => Any): ScriptedInterpreter
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toEnsuring[ScriptedInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  51. def ensuring(cond: Boolean): ScriptedInterpreter
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toEnsuring[ScriptedInterpreter] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  52. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  53. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  54. def evalName: String
    Definition Classes
    ScriptedInterpreterScriptedRepl
  55. def evalPath: String
    Definition Classes
    ScriptedInterpreterScriptedRepl
  56. def executionWrapper: String
    Definition Classes
    IMain
  57. def finalize(): Unit
    Definition Classes
    IMain → AnyRef
  58. def flatPath(sym: Global.Symbol): String
    Definition Classes
    IMain
  59. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toStringFormat[ScriptedInterpreter] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  60. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  61. def getClassIfDefined(path: String): Global.Symbol
    Definition Classes
    IMain
  62. def getModuleIfDefined(path: String): Global.Symbol
    Definition Classes
    IMain
  63. lazy val global: Global
    Definition Classes
    IMain
  64. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  65. def implicitSymbolsBySource: List[(Global.Symbol, List[Global.Symbol])]
    Definition Classes
    Imports
  66. def implicitsCommandInternal(line: String): (List[String], String)
    Definition Classes
    IMainRepl
  67. def importHandlers: collection.immutable.List[(memberHandlers)#ImportHandler]
    Definition Classes
    IMain
  68. def importedSymbols: collection.immutable.List[Global.Symbol]
    Definition Classes
    Imports
  69. def importedSymbolsBySource: List[(Global.Symbol, List[Global.Symbol])]

    Tuples of (source, imported symbols) in the order they were imported.

    Tuples of (source, imported symbols) in the order they were imported.

    Definition Classes
    Imports
  70. def importedTermSymbols: collection.immutable.List[Global.TermSymbol]
    Definition Classes
    Imports
  71. def importsCode(wanted: Set[Global.Name], request: Request, definesClass: Boolean, generousImports: Boolean): ComputedImports
    Attributes
    protected
    Definition Classes
    ScriptedInterpreterImports
  72. def importsCommandInternal(tokens: List[String]): List[String]
    Definition Classes
    IMainRepl
  73. def initializeCompiler(): Boolean
    Definition Classes
    IMainRepl
  74. def initializeComplete: Boolean
    Definition Classes
    IMainRepl
  75. def interpret(line: String, synthetic: Boolean): Result
    Definition Classes
    IMainRepl
  76. def interpret(line: String): 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
    IMainReplCore
  77. def interpretSynthetic(line: String): Result
    Definition Classes
    IMain
  78. lazy val isClassBased: Boolean
    Definition Classes
    IMain
  79. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  80. def isPackaged(line: String): Boolean

    Does code start with a package definition?

    Does code start with a package definition?

    Definition Classes
    IMainRepl
  81. def kindCommandInternal(typeString: String, verbose: Boolean): String
    Definition Classes
    IMainRepl
  82. def languageSymbols: collection.immutable.List[Global.Symbol]
    Definition Classes
    Imports
  83. def languageWildcardHandlers: collection.immutable.List[(memberHandlers)#ImportHandler]
    Definition Classes
    Imports
  84. def languageWildcardSyms: List[Global.Symbol]

    Symbols whose contents are language-defined to be imported.

    Symbols whose contents are language-defined to be imported.

    Definition Classes
    Imports
  85. def lastRequest: Request
    Definition Classes
    IMain
  86. def lastWarnings: List[(Global.Position, String)]
    Definition Classes
    IMainRepl
  87. lazy val memberHandlers: MemberHandlers { val intp: ScriptedInterpreter.this.type }
    Definition Classes
    IMain
  88. 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
    IMainRepl
  89. def namedDefinedTerms: List[String]
    Definition Classes
    IMainRepl
  90. def namedParam[T](name: String, value: T)(implicit arg0: reflect.api.JavaUniverse.TypeTag[T], arg1: ClassTag[T]): NamedParam
    Definition Classes
    IMainRepl
  91. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  92. 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
  93. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  94. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  95. def onlyTerms(xs: List[Global.Name]): List[Global.TermName]
    Attributes
    protected
    Definition Classes
    IMain
  96. def onlyTypes(xs: List[Global.Name]): List[Global.TypeName]
    Attributes
    protected
    Definition Classes
    IMain
  97. def originalPath(sym: Global.Symbol): String
    Definition Classes
    IMain
  98. def originalPath(name: Global.Name): String
    Definition Classes
    IMain
  99. def originalPath(name: String): String
    Definition Classes
    IMainRepl
  100. def parentClassLoader: ClassLoader

    Parent classloader.

    Parent classloader. Overridable.

    Attributes
    protected
    Definition Classes
    IMain
  101. def parse(line: String): Either[Result, (List[Global.Tree], Global.Position)]

    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
  102. lazy val power: Power[StdReplVals]
    Definition Classes
    IMainRepl
  103. def presentationCompile(cursor: Int, buf: String): Either[Result, PresentationCompileResult]

    Typecheck a line of REPL input, suitably wrapped with "interpreter wrapper" objects/classes, with the presentation compiler.

    Typecheck a line of REPL input, suitably wrapped with "interpreter wrapper" objects/classes, with the presentation compiler. The result of this method gives access to the typechecked tree and to autocompletion suggestions.

    The caller is responsible for calling PresentationCompileResult#cleanup to dispose of the compiler instance.

    Definition Classes
    PresentationCompilation
  104. def prevRequestList: collection.immutable.List[Request]
    Definition Classes
    IMain
  105. def quietBind(p: NamedParam): Result
    Definition Classes
    IMainRepl
  106. def quietRun(code: String): Result
    Definition Classes
    IMainRepl
  107. val readInstanceName: String

    For class based repl mode we use an .INSTANCE accessor.

    For class based repl mode we use an .INSTANCE accessor.

    Definition Classes
    IMain
  108. def readRootPath(readPath: String): Global.Symbol
    Definition Classes
    IMain
  109. def rebind(p: NamedParam): Result
    Definition Classes
    IMain
  110. def recordRequest(req: Request): Unit
    Definition Classes
    IMain
  111. def replClass: Class[_]
    Attributes
    protected
    Definition Classes
    IMain
  112. def replScope: Global.Scope
    Definition Classes
    IMain
  113. val reporter: ReplReporter
    Definition Classes
    IMainRepl
  114. def requestDefining(name: String): Option[Request]
    Definition Classes
    IMainRepl
  115. def reset(): Unit

    Reset this interpreter, forgetting all user-specified requests.

    Reset this interpreter, forgetting all user-specified requests.

    Definition Classes
    IMainRepl
  116. def resetClassLoader(): Unit
    Definition Classes
    IMain
  117. def runtimeClassAndTypeOfTerm(id: String): Option[(Class[_], Global.Type)]
    Definition Classes
    IMain
  118. lazy val runtimeMirror: Mirror
    Definition Classes
    IMain
  119. def runtimeTypeOfTerm(id: String): Global.Type
    Definition Classes
    IMain
  120. def sessionImportedSymbols: collection.immutable.List[Global.Symbol]
    Definition Classes
    Imports
  121. def sessionWildcards: List[Global.Type]

    Types which have been wildcard imported, such as: val x = "abc" ; import x._ // type java.lang.String import java.lang.String._ // object java.lang.String

    Types which have been wildcard imported, such as: val x = "abc" ; import x._ // type java.lang.String import java.lang.String._ // object java.lang.String

    Used by tab completion.

    XXX right now this gets import x._ and import java.lang.String._, but doesn't figure out import String._. There's a lot of ad hoc scope twiddling which should be swept away in favor of digging into the compiler scopes.

    Definition Classes
    Imports
  122. def setExecutionWrapper(code: String): Unit
    Definition Classes
    IMainRepl
  123. val settings: Settings
    Definition Classes
    IMainRepl
  124. def showDirectory: String
    Definition Classes
    IMainRepl
  125. def symbolDefString(sym: Global.Symbol): String
    Definition Classes
    IMain
  126. def symbolOfIdent(id: String): Global.Symbol
    Definition Classes
    IMain
  127. def symbolOfLine(code: String): Global.Symbol
    Definition Classes
    IMain
  128. def symbolOfName(id: Global.Name): Global.Symbol
    Definition Classes
    IMain
  129. def symbolOfTerm(id: String): Global.Symbol
    Definition Classes
    IMain
  130. def symbolOfType(id: String): Global.Symbol
    Definition Classes
    IMain
  131. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  132. def toString(): String
    Definition Classes
    AnyRef → Any
  133. def translateEnclosingClass(n: String): Option[String]
    Definition Classes
    IMainRepl
  134. def translateOriginalPath(p: String): String
    Definition Classes
    IMain
  135. def translatePath(path: String): Option[String]
    Definition Classes
    IMainRepl
  136. 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$$iw$X.class.

    Definition Classes
    IMain
  137. 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
  138. 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

    Definition Classes
    IMainRepl
  139. def typeOfExpression(expr: String, silent: Boolean = true): Global.Type
    Definition Classes
    IMain
  140. def typeOfTerm(id: String): Global.Type
    Definition Classes
    IMain
  141. def unqualifiedIds: List[String]
    Definition Classes
    IMain
  142. def updateSettings(arguments: List[String]): Boolean
    Definition Classes
    IMainRepl
  143. def userSetSettings: List[Setting]
    Definition Classes
    IMainRepl
  144. def valueOfTerm(id: String): Option[Any]
    Definition Classes
    IMainRepl
  145. def visibleSettings: List[Setting]
    Definition Classes
    IMainRepl
  146. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  147. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  148. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  149. def withLabel[A](temp: String)(body: => A): A
    Definition Classes
    IMainRepl
  150. def withSuppressedSettings(body: => Unit): Unit
    Definition Classes
    IMainRepl
  151. def withoutWarnings[T](body: => T): T
    Definition Classes
    IMain

Deprecated Value Members

  1. final def setContextClassLoader(): Unit
    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.

  2. def [B](y: B): (ScriptedInterpreter, B)
    Implicit
    This member is added by an implicit conversion from ScriptedInterpreter toArrowAssoc[ScriptedInterpreter] 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.

Inherited from ScriptedRepl

Inherited from IMain

Inherited from Closeable

Inherited from AutoCloseable

Inherited from Imports

Inherited from Repl

Inherited from ReplCore

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromScriptedInterpreter to any2stringadd[ScriptedInterpreter]

Inherited by implicit conversion StringFormat fromScriptedInterpreter to StringFormat[ScriptedInterpreter]

Inherited by implicit conversion Ensuring fromScriptedInterpreter to Ensuring[ScriptedInterpreter]

Inherited by implicit conversion ArrowAssoc fromScriptedInterpreter to ArrowAssoc[ScriptedInterpreter]

Ungrouped