In This Article

IMergeableLexer Interface

Provides the base requirements for a lexer (lexical analyzer) for a language that supports merging with other languages.

public interface IMergeableLexer : ILexer, IKeyedObject

Properties

DefaultLexicalState

The root ILexicalState for when the language is entered.

ILexicalState? DefaultLexicalState { get; }

Property Value

ILexicalState

LexicalStateIdProvider

The ILexicalStateIdProvider that provides access to all the lexical state IDs and keys used by this lexer.

ILexicalStateIdProvider? LexicalStateIdProvider { get; }

Property Value

ILexicalStateIdProvider

Methods

CreateChangeBatch()

Creates an IDisposable object such that while the object is not disposed, the lexer can be modified without any change events being fired, thereby allowing batch updates to occur.

IDisposable CreateChangeBatch()

Returns

IDisposable:

An IDisposable object that, once disposed, will end the batch.

CreateDocumentEndToken(int, TextPosition, ILexicalState)

Creates an IMergeableToken that represents the end of a document.

IMergeableToken CreateDocumentEndToken(int startOffset, TextPosition startPosition, ILexicalState lexicalState)
Parameter Type Description
startOffset int

The start offset of the IToken.

startPosition TextPosition

The start TextPosition of the IToken.

lexicalState ILexicalState

The ILexicalState that contains the token.

Returns

IMergeableToken

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

Creates an IMergeableToken that represents the range of text with the specified lexer data.

IMergeableToken CreateToken(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 lexer information about the token.

Returns

IMergeableToken

GetAllLexicalStateTransitions()

Returns a collection containing all ILexicalStateTransition objects within the lexer.

IEnumerable<ILexicalStateTransition>? GetAllLexicalStateTransitions()

Returns

IEnumerable<ILexicalStateTransition>

Remarks

This method allows consumers to see which language transitions can be made within the lexer.

GetDefaultToken(ITextBufferReader, ILexicalState)

Returns a single-character MergeableLexerResult representing the lexer result for the default token in the ILexicalState and seeks forward one position in the ITextBufferReader

MergeableLexerResult GetDefaultToken(ITextBufferReader reader, ILexicalState lexicalState)
Parameter Type Description
reader ITextBufferReader

An ITextBufferReader that is reading a text source.

lexicalState ILexicalState

The ILexicalState that specifies the current state.

Returns

MergeableLexerResult

GetNextToken(ITextBufferReader, ILexicalState)

Performs a lex to return the next MergeableLexerResult from a ITextBufferReader and seeks past it if there is a match.

MergeableLexerResult GetNextToken(ITextBufferReader reader, ILexicalState lexicalState)
Parameter Type Description
reader ITextBufferReader

An ITextBufferReader that is reading a text source.

lexicalState ILexicalState

The ILexicalState that specifies the current state.

Returns

MergeableLexerResult

Events

Changed

Occurs after the lexer is changed via a block of code surrounded by CreateChangeBatch().

event EventHandler Changed

Event Type

EventHandler

Inherited Members

Extension Methods