Compiler Diagnostics
This tracks the problems encountered while compiling a single module.
Author
Mark van Gulik
Parameters
The source code of the module.
The ModuleName of the module being compiled.
A BooleanSupplier to indicate whether to abort.
A ProblemHandler for, well, handling problems during compilation.
Constructors
Create a CompilerDiagnostics suitable for tracking the potential problems encountered during compilation of a single module.
Types
Properties
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.
A way to quickly test if the client wishes to shut down prematurely.
Allow the positionsToTrack to be adjusted. Only do this when there is no compilation active for the receiver.
Allow the positionsToTrack for ParseNotificationLevel.SILENT entries to be adjusted. Only do this when there is no compilation active for the receiver.
The continuation that reports success of compilation.
A tool for converting character positions between Avail's Unicode strings and Java/Kotlin's UTF-16 representation.
Functions
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.
Record an expectation at the given token.
Handle a problem via the problem handler.
Record the fact that this token was encountered while parsing the current top-level statement.
Report the rightmost accumulated errors, then invoke the failureReporter.
Report one specific terminal problem and call the failure continuation to abort compilation.
Set the success reporter and failure reporter.
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.