package interpreter
- Alphabetic
- Public
- Protected
Type Members
- case class CompletionCandidate(name: String, arity: Arity = CompletionCandidate.Nullary, isDeprecated: Boolean = false, isUniversal: Boolean = false, declString: () => String = () => "") extends Product with Serializable
- trait ExprTyper extends AnyRef
- class IMain extends Repl with Imports with PresentationCompilation with Closeable
An interpreter for Scala code.
An interpreter for Scala code.
The main public entry points are compile(), interpret(), and bind(). The compile() method loads a complete Scala file. The interpret() method executes one line of Scala code at the request of the user. The bind() method binds an object to a variable that can then be used by later interpreted code.
The overall approach is based on compiling the requested code and then using a Java classloader and Java reflection to run the code and access its results.
In more detail, a single compiler instance is used to accumulate all successfully compiled or interpreted Scala code. To "interpret" a line of code, the compiler generates a fresh object that includes the line of code and which has public member(s) to export all variables defined by that code. To extract the result of an interpreted line to show the user, a second "result object" is created which imports the variables exported by the above object and then exports members called "$eval" and "$print". To accommodate user expressions that read from variables or methods defined in previous statements, "import" statements are used.
This interpreter shares the strengths and weaknesses of using the full compiler-to-Java. The main strength is that interpreted code behaves exactly as does compiled code, including running at full speed. The main weakness is that redefining classes and methods is not handled properly, because rebinding at the Java level is technically difficult.
- case class ImportContextPreamble(exclude: Set[String], include: Set[String], preamble: String) extends Product with Serializable
- trait Imports extends AnyRef
- trait MemberHandlers extends AnyRef
- trait NamedParam extends AnyRef
- case class NamedParamClass(name: String, tpe: String, value: Any) extends NamedParam with Product with Serializable
- trait NamedParamCreator extends AnyRef
- trait Naming extends AnyRef
- trait Phased extends AnyRef
Mix this into an object and use it as a phasing Swiss Army knife.
- class Power[ReplValsImpl <: ReplVals] extends AnyRef
A class for methods to be injected into the intp in power mode.
- trait PresentationCompilation extends AnyRef
- trait PresentationCompilationResult extends AnyRef
Created by scala.tools.nsc.interpreter.Repl#presentationCompile
- trait Repl extends ReplCore
Interface to the repl for use by the frontend (shell, the UI).
Interface to the repl for use by the frontend (shell, the UI).
The interface should not depend on symbols and types (the compiler's internal state). At most, expose untyped trees and positions in addition to standard Java types. This decoupling would allow running the shell in a separate thread, or even in a separate process from the compiler. It should also be possible to write a new REPL frontend using this interface, and be compatible across minor compiler releases.
(The first iteration of this interface is only uses Positions and standard JVM types, but we could loosen that.)
- trait ReplCore extends AnyRef
The subset of the Repl used by sbt.
- trait ReplDir extends AbstractFile with Clearable
Directory to save .class files to.
- trait ReplGlobal extends Global
- class ReplOutput extends AnyRef
- trait ReplReporter extends FilteringReporter with ReplStrings
- trait ReplRequest extends AnyRef
- trait ReplStrings extends AnyRef
- abstract class ReplVals extends AnyRef
A class which the repl utilizes to expose predefined objects.
A class which the repl utilizes to expose predefined objects. The base implementation is empty; the standard repl implementation is StdReplVals.
- class ScriptedInterpreter extends IMain with ScriptedRepl
- trait ScriptedRepl extends Repl
The interface used to expose the repl as a Java Script Engine
- trait StdReplTags extends StdTags
- class StdReplVals extends ReplVals
- case class TokenData(token: Int, start: Int, end: Int, isIdentifier: Boolean) extends Product with Serializable
Value Members
- object AbstractOrMissingHandler
- object CompletionCandidate extends java.io.Serializable
- object IMain
Utility methods for the Interpreter.
- object ImportContextPreamble extends java.io.Serializable
- object NamedParam extends NamedParamCreator
- object Naming
This is for name logic which is independent of the compiler (notice there's no Global.) That includes at least generating, metaquoting, mangling, and unmangling.
- object ReplStrings
- object ReplVals
- object Results
- object StdReplTags extends StdTags with StdReplTags
- object {{
A magic symbol that, when imported in a REPL template, bumps the effective nesting level of the typechecker.
A magic symbol that, when imported in a REPL template, bumps the effective nesting level of the typechecker.
The REPL inserts this import to control scoping in code templates, without excessive lexical noise.
import p.X import scala.tools.nsc.interpreter.`{{` import q.X X // q.X
Its name is chosen to suggest scoping by braces; the brace is doubled to avoid confusion in printed output, as the name will be visible to a REPL user inspecting generated code.
There is no complementary symbol to restore the nesting level.
Deprecated Value Members
- object InteractiveReader
- Annotations
- @deprecated
- Deprecated
(Since version 2.9.0) Use a class in the scala.tools.nsc.interpreter package.
The Scala compiler and reflection APIs.