Table of Contents

Interface ILexerExtension

Namespace
Utils.Parser.Runtime
Assembly
Utils.Parser.dll

Extends lexer behavior with runtime token injection hooks.

public interface ILexerExtension
Extension Methods

Methods

OnAfterToken(Token, LexerExtensionContext)

Produces optional extra tokens after a token has been emitted by the lexer.

IReadOnlyList<Token> OnAfterToken(Token token, LexerExtensionContext context)

Parameters

token Token

The token just emitted.

context LexerExtensionContext

Current lexer extension context.

Returns

IReadOnlyList<Token>

Generated tokens or an empty list.

OnEndOfInput(LexerExtensionContext)

Produces optional trailing tokens after reaching end of input.

IReadOnlyList<Token> OnEndOfInput(LexerExtensionContext context)

Parameters

context LexerExtensionContext

Current lexer extension context.

Returns

IReadOnlyList<Token>

Generated tokens or an empty list.

TryReadTokens(LexerExtensionContext)

Attempts to read one or more tokens directly from the current input position.

IReadOnlyList<Token> TryReadTokens(LexerExtensionContext context)

Parameters

context LexerExtensionContext

Current lexer extension context.

Returns

IReadOnlyList<Token>

Generated tokens or an empty list.