In This Article

MergeableToken Class

Represents the default implementation of an IToken that can be used with an IMergeableLexer.

public class MergeableToken : TokenBase, IMergeableToken, IToken
Inheritance:
object TokenBase object
Implements:
IMergeableToken IToken

Constructors

MergeableToken(int, int, TextPosition, TextPosition, MergeableLexerFlags, ILexicalState, IMergeableTokenLexerData?)

Represents the default implementation of an IToken that can be used with an IMergeableLexer.

public MergeableToken(int startOffset, int length, TextPosition startPosition, TextPosition endPosition, MergeableLexerFlags lexerFlags, ILexicalState lexicalState, IMergeableTokenLexerData? lexerData)
Parameter Type Description
startOffset int

The start offset of the token.

length int

The length of the token.

startPosition TextPosition

The TextPosition of the first character in the token.

endPosition TextPosition

The TextPosition after the last character in the token.

lexerFlags MergeableLexerFlags

The MergeableLexerFlags for the token.

lexicalState ILexicalState

The ILexicalState that contains the token.

lexerData IMergeableTokenLexerData

The IMergeableTokenLexerData that contains the lexer information about the token.

Properties

AutoCaseCorrectText

The text that should be used for this IToken when performing an auto case correction operation on it.

public virtual string? AutoCaseCorrectText { get; }

Property Value

string

Remarks

Return a null value to indicate that there is no auto case correction text available.

ClassificationType

The IClassificationType assigned to the token.

public virtual IClassificationType? ClassificationType { get; }

Property Value

IClassificationType

DeclaringLexicalState

The ILexicalState that declares the pattern that matched the token.

public virtual ILexicalState? DeclaringLexicalState { get; }

Property Value

ILexicalState

Id

The ID assigned to the token.

public override int Id { get; }

Property Value

int

Key

The key assigned to the token.

public override string? Key { get; }

Property Value

string

Lexer

The IMergeableLexer that created the token.

public IMergeableLexer? Lexer { get; }

Property Value

IMergeableLexer

LexerData

An IMergeableTokenLexerData that contains lexer information for the token.

protected IMergeableTokenLexerData? LexerData { get; }

Property Value

IMergeableTokenLexerData

LexerFlags

A MergeableLexerFlags indicating lexer flags for the token.

protected MergeableLexerFlags LexerFlags { get; }

Property Value

MergeableLexerFlags

LexicalScope

The ILexicalScope, if any, that defines the token.

public virtual ILexicalScope? LexicalScope { get; }

Property Value

ILexicalScope

Remarks

If this value is null, the token was not defined by a lexical scope.

LexicalState

The ILexicalState that contains the token.

public virtual ILexicalState? LexicalState { get; }

Property Value

ILexicalState

LexicalStateId

The ID assigned to the lexical state that contains the token.

public override int LexicalStateId { get; }

Property Value

int

Methods

HasFlag(MergeableLexerFlags)

Returns whether the parse data has the specified MergeableLexerFlags flag.

public virtual bool HasFlag(MergeableLexerFlags flag)
Parameter Type Description
flag MergeableLexerFlags

The MergeableLexerFlags to check for.

Returns

bool:

true if the parse data has the specified MergeableLexerFlags flag; otherwise, false.

SetFlag(MergeableLexerFlags, bool)

Sets or clears the specified MergeableLexerFlags flag.

public virtual void SetFlag(MergeableLexerFlags flag, bool setBit)
Parameter Type Description
flag MergeableLexerFlags

The MergeableLexerFlags to set or clear.

setBit bool

Whether to set the flag; otherwise, the flag is cleared.

Remarks

This method should only be called by lexers.

Inherited Members

Extension Methods