Lexing State
LexingState instances represent the lexing state between tokens. They bind together consecutive tokens into a directed acyclic graph, allowing the AvailCompiler to process all possible paths (lexings), typically in aggregate.
Author
Mark van Gulik
Parameters
The CompilationContext in which compilation is occurring.
The one-based position in the source.
The one-based line number of this position in the source.
The immutable list of A_Tokens that have been parsed up to this position, starting at the current top-level statement, but including any leading whitespace and comment tokens.
Constructors
Construct a new immutable LexingState. It starts in a state where the potential tokens at this position have not yet been computed, and no actions have been queued to run against that eventual list of tokens.
Properties
The compilation context for which this is a state of lexing.
The one-based line number at which this state occurs in the source.
The position represented by this LexingState. In particular, it's the (one-based) start of the current token within the source.
Functions
Record an expectation at the current parse position. The expectations captured at the rightmost few reached parse positions constitute the error message in case the parse fails.
Record an indication of what was expected at this parse position.
Record an expectation at the current parse position. The expectations captured at the rightmost parse position constitute the error message in case the parse fails.
Set up the given fiber to eventually invoke either the onSuccess or the onFailure continuation, but not both. However, immediately record the fact that we're expecting one of these to be eventually invoked, and wrap the continuations with code that will invoke getNoMoreWorkUnits when the number of outstanding tasks reaches zero.
Eventually invoke the given 0-argument function. Track it as an outstanding action, ensuring CompilationContext.noMoreWorkUnits is invoked only when all such queued actions have completed.