CompilerDiagnostics

class CompilerDiagnostics(source: A_String, moduleName: ModuleName, val pollForAbort: () -> Boolean, problemHandler: ProblemHandler)

This tracks the problems encountered while compiling a single module.

Author

Mark van Gulik

Parameters

source

The source code of the module.

moduleName

The ModuleName of the module being compiled.

pollForAbort

A BooleanSupplier to indicate whether to abort.

problemHandler

A ProblemHandler for, well, handling problems during compilation.

Constructors

Link copied to clipboard
constructor(source: A_String, moduleName: ModuleName, pollForAbort: () -> Boolean, problemHandler: ProblemHandler)

Create a CompilerDiagnostics suitable for tracking the potential problems encountered during compilation of a single module.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

These enumeration values form a priority scheme for reporting parsing problems.

Properties

Link copied to clipboard

This boolean is set when the problemHandler decides that an encountered Problem is serious enough that code generation should be suppressed. In Avail, that means the serialized module should not be written to its repository.

Link copied to clipboard

A way to quickly test if the client wishes to shut down prematurely.

Link copied to clipboard

Allow the positionsToTrack to be adjusted. Only do this when there is no compilation active for the receiver.

Link copied to clipboard

Allow the positionsToTrack for ParseNotificationLevel.SILENT entries to be adjusted. Only do this when there is no compilation active for the receiver.

Link copied to clipboard

The continuation that reports success of compilation.

Link copied to clipboard

A tool for converting character positions between Avail's Unicode strings and Java/Kotlin's UTF-16 representation.

Functions

Link copied to clipboard

Clear all the accumulated expectations. This should only be done just before adding a definitive expectation, like a successful but ambiguous parse of a top level statement.

Link copied to clipboard

Record an expectation at the given token.

Link copied to clipboard
fun handleProblem(problem: Problem)

Handle a problem via the problem handler.

Link copied to clipboard
fun recordToken(token: A_Token)

Record the fact that this token was encountered while parsing the current top-level statement.

Link copied to clipboard

Report the rightmost accumulated errors, then invoke the failureReporter.

fun reportError(lexingState: LexingState, headerMessagePattern: String, message: String)

Report one specific terminal problem and call the failure continuation to abort compilation.

Link copied to clipboard
fun setSuccessAndFailureReporters(theSuccessReporter: () -> Unit, theFailureReporter: () -> Unit)

Set the success reporter and failure reporter.

Link copied to clipboard
fun startParsingAt(initialPositionInSource: LexingState)

Record the fact that we're starting to parse a top-level statement at the indicated one-based position in the source. Clear any already recorded expectations.