IMergableLexer Interface
Provides the base requirements for a lexer (lexical analyzer) for a language that supports merging with other languages.
public interface IMergableLexer : ILexer, IKeyedObject
Properties
DefaultLexicalState
Gets or sets the root ILexicalState for when the language is entered.
ILexicalState DefaultLexicalState { get; }
Property Value
- ILexicalState:
The root ILexicalState for when the language is entered.
LexicalStateIdProvider
Gets the ILexicalStateIdProvider that provides access to all the lexical state IDs and keys used by this lexer.
ILexicalStateIdProvider LexicalStateIdProvider { get; }
Property Value
- ILexicalStateIdProvider:
The ILexicalStateIdProvider that provides access to all the lexical state IDs and keys used by this lexer.
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. Once disposed, the batch is ended.
CreateDocumentEndToken(Int32, TextPosition, ILexicalState)
Creates an IMergableToken that represents the end of a document.
IMergableToken CreateDocumentEndToken(int startOffset, TextPosition startPosition, ILexicalState lexicalState)
Parameter | Type | Description |
---|---|---|
startOffset | Int32 | The start offset of the IToken. |
startPosition | TextPosition | The start TextPosition of the IToken. |
lexicalState | ILexicalState | The ILexicalState that contains the token. |
Returns
- IMergableToken:
An IMergableToken that represents the end of a document.
CreateToken(Int32, Int32, TextPosition, TextPosition, MergableLexerFlags, ILexicalState, IMergableTokenLexerData)
Creates an IMergableToken that represents the range of text with the specified lexer data.
IMergableToken CreateToken(int startOffset, int length, TextPosition startPosition, TextPosition endPosition, MergableLexerFlags lexerFlags, ILexicalState lexicalState, IMergableTokenLexerData lexerData)
Parameter | Type | Description |
---|---|---|
startOffset | Int32 | The start offset of the token. |
length | Int32 | 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 lexer information about the token. |
Returns
- IMergableToken:
An IMergableToken that represents the range of text with the specified lexer data.
GetAllLexicalStateTransitions()
Returns a collection containing all ILexicalStateTransition objects within the lexer.
IEnumerable<ILexicalStateTransition> GetAllLexicalStateTransitions()
Returns
- IEnumerable<ILexicalStateTransition>:
A collection containing all ILexicalStateTransition objects within the lexer.
Remarks
This method allows consumers to see which language transitions can be made within the lexer.
GetDefaultToken(ITextBufferReader, ILexicalState)
Returns a single-character MergableLexerResult representing the lexer result for the default token in the ILexicalState and seeks forward one position in the ITextBufferReader
MergableLexerResult 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
- MergableLexerResult:
A MergableLexerResult indicating the lexer result.
GetNextToken(ITextBufferReader, ILexicalState)
Performs a lex to return the next MergableLexerResult from a ITextBufferReader and seeks past it if there is a match.
MergableLexerResult 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
- MergableLexerResult:
A MergableLexerResult indicating the lexer result.
Events
Changed
Occurs after the lexer is changed via a block of code surrounded by CreateChangeBatch().