LexicalScanner

class LexicalScanner(val moduleNameProducer: () -> String)

A LexicalScanner tracks all visible A_Lexers while compiling a module. It maintains an AtomicReferenceArray from Latin-1 codepoints (U+0000..U+00FF) to the A_Tuple of lexers whose filters passed for that codepoint. A separate ConcurrentHashMap tracks all remaining codepoints.

There is also a special instance that is reused for scanning module headers.

Author

Mark van Gulik

Constructors

Link copied to clipboard
constructor(moduleNameProducer: () -> String)

Properties

Link copied to clipboard

The List of all lexers which are visible within the module being compiled.

Link copied to clipboard

When set, fail on attempts to change the lexical scanner. This is a safety measure.

Link copied to clipboard

A function that produces the name of the module that this scanner is operating on behalf of, or "" for the scanner used for module headers.

Functions

Link copied to clipboard

Add an A_Lexer. Update not just the current lexing information for this loader, but also the specified atom's bundle's method and the current module.

Link copied to clipboard

Ensure new A_Lexers are not added after this point. This is a safety measure.

Link copied to clipboard
fun getLexersForCodePointThen(lexingState: LexingState, codePoint: Int, continuation: (A_Tuple) -> Unit, onFailure: (Map<A_Lexer, Throwable>) -> Unit)

Collect the lexers that should run when we encounter a character with the given (Int) code point, then pass this tuple of lexers to the supplied Kotlin function.