Table of Contents

Class LexerExtensionContext

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

Context object passed to lexer extensions.

public sealed class LexerExtensionContext
Inheritance
LexerExtensionContext
Inherited Members
Extension Methods

Constructors

LexerExtensionContext(ParserDefinition, TextReaderLookahead, IReadOnlyList<Token>, string)

Initializes a new context.

public LexerExtensionContext(ParserDefinition definition, TextReaderLookahead input, IReadOnlyList<Token> emittedTokens, string currentMode)

Parameters

definition ParserDefinition
input TextReaderLookahead
emittedTokens IReadOnlyList<Token>
currentMode string

Properties

Column

Current column.

public int Column { get; }

Property Value

int

CurrentMode

Current lexer mode.

public string CurrentMode { get; }

Property Value

string

Definition

Current parser definition.

public ParserDefinition Definition { get; }

Property Value

ParserDefinition

EmittedTokens

Already emitted tokens.

public IReadOnlyList<Token> EmittedTokens { get; }

Property Value

IReadOnlyList<Token>

Input

Forward-only input lookahead.

public TextReaderLookahead Input { get; }

Property Value

TextReaderLookahead

Line

Current line.

public int Line { get; }

Property Value

int

Position

Current absolute input position.

public int Position { get; }

Property Value

int

Methods

IsTokenDeclared(string)

Returns true when token exists in tokens { ... }.

public bool IsTokenDeclared(string tokenName)

Parameters

tokenName string

Returns

bool

IsTokenKnown(string)

Returns true when token is declared or backed by lexer rule.

public bool IsTokenKnown(string tokenName)

Parameters

tokenName string

Returns

bool