Interface ILexerExtension
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
tokenTokenThe token just emitted.
contextLexerExtensionContextCurrent 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
contextLexerExtensionContextCurrent 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
contextLexerExtensionContextCurrent lexer extension context.
Returns
- IReadOnlyList<Token>
Generated tokens or an empty list.