Packages

p

scala.tools.nsc

interpreter

package interpreter

Content Hierarchy
Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package jline
  2. package shell

Type Members

  1. case class CompletionCandidate(name: String, arity: Arity = CompletionCandidate.Nullary, isDeprecated: Boolean = false, isUniversal: Boolean = false, declString: () => String = () => "", alias: Option[String] = None) extends Product with Serializable
  2. trait ExprTyper extends AnyRef
  3. 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.

  4. case class ImportContextPreamble(exclude: Set[String], include: Set[String], preamble: String) extends Product with Serializable
  5. trait Imports extends AnyRef
  6. trait MemberHandlers extends AnyRef
  7. trait NamedParam extends AnyRef
  8. case class NamedParamClass(name: String, tpe: String, value: Any) extends NamedParam with Product with Serializable
  9. trait NamedParamCreator extends AnyRef
  10. trait Naming extends AnyRef
  11. trait Phased extends AnyRef

    Mix this into an object and use it as a phasing Swiss Army knife.

  12. class Power[ReplValsImpl <: ReplVals] extends AnyRef

    A class for methods to be injected into the intp in power mode.

  13. trait PresentationCompilation extends AnyRef
  14. trait PresentationCompilationResult extends AnyRef

    Created by scala.tools.nsc.interpreter.Repl#presentationCompile

  15. 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.)

  16. trait ReplCore extends AnyRef

    The subset of the Repl used by sbt.

  17. trait ReplDir extends AbstractFile with Clearable

    Directory to save .class files to.

  18. trait ReplGlobal extends Global
  19. class ReplOutput extends AnyRef
  20. trait ReplReporter extends FilteringReporter with ReplStrings
  21. trait ReplRequest extends AnyRef
  22. trait ReplStrings extends AnyRef
  23. 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.

  24. class ScriptedInterpreter extends IMain with ScriptedRepl
  25. trait ScriptedRepl extends Repl

    The interface used to expose the repl as a Java Script Engine

  26. trait StdReplTags extends StdTags
  27. class StdReplVals extends ReplVals
  28. case class TokenData(token: Int, start: Int, end: Int, isIdentifier: Boolean) extends Product with Serializable

Value Members

  1. object AbstractOrMissingHandler
  2. object CompletionCandidate extends java.io.Serializable
  3. object IMain

    Utility methods for the Interpreter.

  4. object ImportContextPreamble extends java.io.Serializable
  5. object NamedParam extends NamedParamCreator
  6. 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.

  7. object ReplStrings
  8. object ReplVals
  9. object Results
  10. object StdReplTags extends StdTags with StdReplTags
  11. 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

  1. object InteractiveReader
    Annotations
    @deprecated
    Deprecated

    (Since version 2.9.0) Use a class in the scala.tools.nsc.interpreter package.

Ungrouped