Table of Contents

Class Token

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

An atomic lexical unit produced by LexerEngine. Each token records its source position, the rule that matched it, the active lexer mode at the time of the match, and the matched text.

public record Token : IEquatable<Token>
Inheritance
Token
Implements
Inherited Members
Extension Methods

Constructors

Token(SourceSpan, string, string, string, string)

An atomic lexical unit produced by LexerEngine. Each token records its source position, the rule that matched it, the active lexer mode at the time of the match, and the matched text.

public Token(SourceSpan Span, string RuleName, string ModeName, string Channel, string Text)

Parameters

Span SourceSpan

Position and length of the token in the source text.

RuleName string

Name of the lexer rule that produced this token, for example "ID".

ModeName string

Name of the active lexer mode when this token was produced.

Channel string

Channel name assigned to this token.

Text string

Raw matched text.

Properties

Channel

Channel name assigned to this token.

public string Channel { get; init; }

Property Value

string

ModeName

Name of the active lexer mode when this token was produced.

public string ModeName { get; init; }

Property Value

string

RuleName

Name of the lexer rule that produced this token, for example "ID".

public string RuleName { get; init; }

Property Value

string

Span

Position and length of the token in the source text.

public SourceSpan Span { get; init; }

Property Value

SourceSpan

Text

Raw matched text.

public string Text { get; init; }

Property Value

string