In This Article

MergableToken Class

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

public class MergableToken : TokenBase, IMergableToken, IToken
Inheritance:
object TokenBase object
Implements:
IMergableToken IToken

Constructors

MergableToken(int, int, TextPosition, TextPosition, MergableLexerFlags, ILexicalState, IMergableTokenLexerData)

Initializes a new instance of the MergableToken class.

public MergableToken(int startOffset, int length, TextPosition startPosition, TextPosition endPosition, MergableLexerFlags lexerFlags, ILexicalState lexicalState, IMergableTokenLexerData 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 MergableLexerFlags

The MergableLexerFlags for the token.

lexicalState ILexicalState

The ILexicalState that contains the token.

lexerData IMergableTokenLexerData

The IMergableTokenLexerData that contains the lexer information about the token.

Properties

AutoCaseCorrectText

Gets 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:

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

Remarks

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

ClassificationType

Gets the IClassificationType assigned to the token.

public virtual IClassificationType ClassificationType { get; }

Property Value

IClassificationType:

The IClassificationType assigned to the token.

DeclaringLexicalState

Gets the ILexicalState that declares the pattern that matched the token.

public virtual ILexicalState DeclaringLexicalState { get; }

Property Value

ILexicalState:

The ILexicalState that declares the pattern that matched the token.

Id

Gets the ID assigned to the token.

public override int Id { get; }

Property Value

int:

The ID assigned to the token.

Key

Gets the key assigned to the token.

public override string Key { get; }

Property Value

string:

The key assigned to the token.

Lexer

Gets the IMergableLexer that created the token.

public IMergableLexer Lexer { get; }

Property Value

IMergableLexer:

The IMergableLexer that created the token.

LexerData

Gets an IMergableTokenLexerData that contains lexer information for the token.

protected IMergableTokenLexerData LexerData { get; }

Property Value

IMergableTokenLexerData:

An IMergableTokenLexerData that contains lexer information for the token.

LexerFlags

Gets a MergableLexerFlags indicating lexer flags for the token.

protected MergableLexerFlags LexerFlags { get; }

Property Value

MergableLexerFlags:

A MergableLexerFlags indicating lexer flags for the token.

LexicalScope

Gets the ILexicalScope, if any, that defines the token.

public virtual ILexicalScope LexicalScope { get; }

Property Value

ILexicalScope:

The ILexicalScope, if any, that defines the token.

Remarks

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

LexicalState

Gets the ILexicalState that contains the token.

public virtual ILexicalState LexicalState { get; }

Property Value

ILexicalState:

The ILexicalState that contains the token.

LexicalStateId

Gets the ID assigned to the lexical state.

public override int LexicalStateId { get; }

Property Value

int:

The ID assigned to the lexical state.

Methods

HasFlag(MergableLexerFlags)

Returns whether the parse data has the specified MergableLexerFlags flag.

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

The MergableLexerFlags to check for.

Returns

bool:

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

SetFlag(MergableLexerFlags, bool)

Sets or clears the specified MergableLexerFlags flag.

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

The MergableLexerFlags 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