ReplDriver

replpp.ReplDriver
class ReplDriver(args: Array[String], out: PrintStream, onExitCode: Option[String], greeting: Option[String], prompt: String, maxHeight: Option[Int], classLoader: Option[ClassLoader])(using x$8: Colors) extends ReplDriverBase

Attributes

Graph
Supertypes
class Driver
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def runUntilQuit(using initialState: State)(): State

Run REPL with state until :quit command found Main difference to the 'original': different greeting, trap Ctrl-c

Run REPL with state until :quit command found Main difference to the 'original': different greeting, trap Ctrl-c

Attributes

Definition Classes

Inherited methods

final def bind(name: String, value: Any)(using state: State): State

Attributes

Inherited from:
DottyReplDriver
override protected def command: CompilerCommand

Attributes

Definition Classes
DottyReplDriver -> Driver
Inherited from:
DottyReplDriver
final protected def completions(cursor: Int, expr: String, state0: State): List[Candidate]

Extract possible completions at the index of cursor in expr

Extract possible completions at the index of cursor in expr

Attributes

Inherited from:
DottyReplDriver
final def initialState: State

the initial, empty state of the REPL session

the initial, empty state of the REPL session

Attributes

Inherited from:
DottyReplDriver
protected def interpret(res: ParseResult, quiet: Boolean)(using state: State): State

Attributes

Inherited from:
DottyReplDriver
protected def interpretInput(lines: IterableOnce[String], state: State, currentFile: Path): State

Attributes

Inherited from:
ReplDriverBase
def main(args: Array[String]): Unit

Attributes

Inherited from:
Driver
def process(args: Array[String], rootCtx: Context): Reporter

Entry point to the compiler using a custom Context.

Entry point to the compiler using a custom Context.

In most cases, you do not need a custom Context and should instead use one of the other overloads of process. However, the other overloads cannot be overridden, instead you should override this one which they call internally.

Usage example: https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/EntryPointsTest.scala.disabled in method runCompilerWithContext

Value parameters

args

Arguments to pass to the compiler.

rootCtx

The root Context to use.

Attributes

Returns

The Reporter used. Use Reporter#hasErrors to check if compilation succeeded.

Inherited from:
Driver
def process(args: Array[String]): Reporter

Entry point to the compiler with no optional arguments.

Entry point to the compiler with no optional arguments.

This overload is provided for compatibility reasons: the RawCompiler of sbt expects this method to exist and calls it using reflection. Keeping it means that we can change the other overloads without worrying about breaking compatibility with sbt.

Attributes

Inherited from:
Driver
final def process(args: Array[String], reporter: Reporter | Null, callback: CompilerCallback | Null): Reporter

Principal entry point to the compiler.

Principal entry point to the compiler.

Usage example: https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/EntryPointsTest.scala.disabled in method runCompiler

Value parameters

args

Arguments to pass to the compiler.

callback

Used to execute custom code during the compilation process. No callbacks will be executed if this is null.

reporter

Used to log errors, warnings, and info messages. The default reporter is used if this is null.

Attributes

Returns

The Reporter used. Use Reporter#hasErrors to check if compilation succeeded.

Inherited from:
Driver
final def process(args: Array[String], simple: SimpleReporter | Null, callback: CompilerCallback | Null): ReporterResult

Entry point to the compiler that can be conveniently used with Java reflection.

Entry point to the compiler that can be conveniently used with Java reflection.

This entry point can easily be used without depending on the dotty package, you only need to depend on dotty-interfaces and call this method using reflection. This allows you to write code that will work against multiple versions of dotty without recompilation.

The trade-off is that you can only pass a SimpleReporter to this method and not a normal Reporter which is more powerful.

Usage example: https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/dotc/InterfaceEntryPointTest.scala

Value parameters

args

Arguments to pass to the compiler.

callback

Used to execute custom code during the compilation process. No callbacks will be executed if this is null.

simple

Used to log errors, warnings, and info messages. The default reporter is used if this is null.

Attributes

Inherited from:
Driver
protected def redirectOutput: Boolean

Controls whether the System.out and System.err streams are set to the provided constructor parameter instance of java.io.PrintStream during the execution of the repl. On by default.

Controls whether the System.out and System.err streams are set to the provided constructor parameter instance of java.io.PrintStream during the execution of the repl. On by default.

Disabling this can be beneficial when executing a repl instance inside a concurrent environment, for example a thread pool (such as the Scala compile server in the Scala Plugin for IntelliJ IDEA).

In such environments, indepently executing System.setOut and System.setErr without any synchronization can lead to unpredictable results when restoring the original streams (dependent on the order of execution), leaving the Java process in an inconsistent state.

Attributes

Inherited from:
DottyReplDriver
protected def resetToInitial(settings: List[String]): Unit

Reset state of repl to the initial state

Reset state of repl to the initial state

This method is responsible for performing an all encompassing reset. As such, when the user enters :reset this method should be called to reset everything properly

Attributes

Inherited from:
DottyReplDriver
final def run(input: String)(using state: State): State

Attributes

Inherited from:
DottyReplDriver
protected def runBody(body: => State): State

Attributes

Inherited from:
DottyReplDriver
final def runQuietly(input: String)(using State): State

Attributes

Inherited from:
DottyReplDriver
def setup(args: Array[String], rootCtx: Context): Option[(List[AbstractFile], Context)]

Setup context with initialized settings from CLI arguments, then check if there are any settings that would change the default behaviour of the compiler.

Setup context with initialized settings from CLI arguments, then check if there are any settings that would change the default behaviour of the compiler.

Attributes

Returns

If there is no setting like -help preventing us from continuing compilation, this method returns a list of files to compile and an updated Context. If compilation should be interrupted, this method returns None.

Inherited from:
Driver
override def sourcesRequired: Boolean

Overridden to false in order to not have to give sources on the commandline

Overridden to false in order to not have to give sources on the commandline

Attributes

Definition Classes
DottyReplDriver -> Driver
Inherited from:
DottyReplDriver
final def tryRunning: Unit

Try to run REPL if there is nothing that prevents us doing so.

Try to run REPL if there is nothing that prevents us doing so.

Possible reason for unsuccessful run are raised flags in CLI like --help or --version

Attributes

Inherited from:
DottyReplDriver

Inherited fields

protected var rendering: Rendering

Attributes

Inherited from:
DottyReplDriver