Packages

p

scala.tools.nsc

interpreter

package interpreter

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 }

Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. interpreter
  2. ReplStrings
  3. ReplConfig
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class AbstractOrMissingHandler[T] extends PartialFunction[Throwable, T]
  2. class CommandLine extends CompilerCommand

    A command line for the interpreter.

  3. trait Completion extends AnyRef

    An implementation-agnostic completion interface which makes no reference to the jline classes.

  4. trait Delimited extends AnyRef
  5. trait EchoReader extends SimpleReader
  6. trait ExprTyper extends AnyRef
  7. 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.

    Version

    1.2

  8. class IMain extends 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.

  9. implicit class IMainOps extends AnyRef

    This class serves to trick the compiler into treating a var (intp, in ILoop) as a stable identifier.

  10. class ISettings extends AnyRef

    Settings for the interpreter

    Settings for the interpreter

    Version

    1.0

  11. trait Imports extends AnyRef
  12. type InputStream = java.io.InputStream
  13. trait InteractiveReader extends AnyRef

    Reads lines from an input stream

  14. type JClass = Class[_]
  15. type JCollection[T] = Collection[T]
  16. type JFile = File
  17. type JList[T] = java.util.List[T]
  18. type JPrintWriter = PrintWriter
  19. abstract class Javap extends AnyRef
  20. class Javap8 extends Javap

    Loaded reflectively under JDK8 to locate tools.jar and load JavapTask tool.

  21. class Javap9 extends Javap

    Loaded reflectively under JDK9 to load JavapTask tool.

  22. class JavapClass extends AnyRef

    Javap command implementation.

  23. class JavapProvider extends Javap

    Loaded reflectively under JDK9 to locate ToolProvider.

  24. class JavapTask extends JavapTool
  25. abstract class JavapTool extends AnyRef

    The task or tool provider.

  26. trait Logger extends AnyRef
  27. trait LoopCommands extends AnyRef
  28. trait MemberHandlers extends AnyRef
  29. trait NamedParam extends AnyRef
  30. case class NamedParamClass(name: String, tpe: String, value: Any) extends NamedParam with Product with Serializable
  31. trait NamedParamCreator extends AnyRef
  32. trait Naming extends AnyRef

    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.

  33. type OutputStream = java.io.OutputStream
  34. class Parsed extends Delimited

    One instance of a command buffer.

  35. abstract class Pasted extends AnyRef

    If it looks like they're pasting in a scala interpreter transcript, remove all the formatting we inserted so we can make some sense of it.

    If it looks like they're pasting in a scala interpreter transcript, remove all the formatting we inserted so we can make some sense of it.

    Most of the interesting code in here is due to my goal of "paste idempotence" i.e. the transcript resulting from pasting a transcript should itself be pasteable and should achieve the same result.

  36. trait Phased extends AnyRef

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

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

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

  38. trait PresentationCompilation extends AnyRef
  39. class PresentationCompilerCompleter extends Completion
  40. class ProcessResult extends AnyRef
  41. trait ReplConfig extends AnyRef
  42. class TapMaker[T] extends AnyRef
    Definition Classes
    ReplConfig
  43. trait ReplDir extends AbstractFile with Clearable

    Directory to save .class files to.

  44. trait ReplGlobal extends Global

    A layer on top of Global so I can guarantee some extra functionality for the repl.

  45. class ReplOutput extends AnyRef
  46. class ReplProps extends AnyRef
  47. class ReplReporter extends ConsoleReporter

    Like ReplGlobal, a layer for ensuring extra functionality.

  48. trait ReplStrings extends AnyRef
  49. 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.

  50. class RichClass[T] extends AnyRef
  51. class Scripted extends AbstractScriptEngine with Compilable
  52. class SimpleReader extends InteractiveReader

    Reads using standard JDK API.

  53. class SplashLoop extends Runnable

    Collect one line of user input from the supplied reader.

    Collect one line of user input from the supplied reader. Runs on a new thread while the REPL is initializing on the main thread.

    The user can enter text or a :paste command.

  54. class SplashReader extends InteractiveReader

    Reader during splash.

    Reader during splash. Handles splash-completion with a stub, otherwise delegates.

  55. trait StdReplTags extends StdTags
  56. class StdReplVals extends ReplVals
  57. trait Tabulator extends AnyRef
  58. trait VariColumnTabulator extends Tabulator

    Adjust the column width and number of columns to minimize the row count.

  59. class WriterOutputStream extends OutputStream
  60. class AbstractFileClassLoader extends util.AbstractFileClassLoader
    Annotations
    @deprecated
    Deprecated

    (Since version 2.11.0) Use scala.tools.nsc.util.AbstractFileClassLoader

Value Members

  1. val IR: Results.type
  2. def any2stringOf(x: Any, maxlen: Int): String
    Definition Classes
    ReplStrings
  3. def isAcross: Boolean
    Definition Classes
    ReplConfig
  4. def isPaged: Boolean
    Definition Classes
    ReplConfig
  5. def isReplDebug: Boolean
    Definition Classes
    ReplConfig
  6. def isReplInfo: Boolean
    Definition Classes
    ReplConfig
  7. def isReplPower: Boolean
    Definition Classes
    ReplConfig
  8. def isReplTrace: Boolean
    Definition Classes
    ReplConfig
  9. implicit def postfixOps: postfixOps
  10. lazy val replProps: ReplProps
    Definition Classes
    ReplConfig
  11. def staticTypeTag[T](implicit arg0: ClassTag[T]): reflect.api.JavaUniverse.TypeTag[T]
  12. def string2code(str: String): String

    Convert a string into code that can recreate the string.

    Convert a string into code that can recreate the string. This requires replacing all special characters by escape codes. It does not add the surrounding " marks.

    Definition Classes
    ReplStrings
  13. def string2codeQuoted(str: String): String
    Definition Classes
    ReplStrings
  14. def unquoted(s: String): String
    Definition Classes
    ReplStrings
  15. def words(s: String): List[String]
    Definition Classes
    ReplStrings
  16. object AbstractOrMissingHandler
  17. object Completion
  18. object ILoop
  19. object IMain

    Utility methods for the Interpreter.

  20. object InteractiveReader
  21. object Javap
  22. object JavapClass
  23. object JavapTask
  24. object JavapTool
  25. object NamedParam extends NamedParamCreator
  26. object NoCompletion extends Completion
  27. object Parsed
  28. object PresentationCompilerCompleter
  29. object ReplVals
  30. object Results
  31. object Scripted
  32. object SimpleReader
  33. object SplashLoop
  34. object SplashReader
  35. object StdReplTags extends StdTags with StdReplTags
  36. 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.

Inherited from ReplStrings

Inherited from ReplConfig

Inherited from AnyRef

Inherited from Any

Ungrouped