DynamicLexer Class
Represents a dynamic lexer (lexical analyzer), one that is pattern-based.
public class DynamicLexer : MergableLexerBase, IDynamicLexer, IMergableLexer, ILexer, IKeyedObject
- Inheritance:
- Object MergableLexerBase Object
- Derived:
- XmlLexer
- Implements:
- IDynamicLexer IMergableLexer ILexer IKeyedObject
Remarks
Instances of this object can be registered with an ISyntaxLanguage using the RegisterService(Object, Object) method. Once an instance is registered with the language for the ILexer interface type, its features can be used by the language.
Constructors
DynamicLexer()
Initializes a new instance of the DynamicLexer
class.
public DynamicLexer()
Properties
DefaultLexicalState
Gets or sets the root ILexicalState for when the language is entered.
public DynamicLexicalState DefaultLexicalState { get; set; }
Property Value
- DynamicLexicalState:
The root ILexicalState for when the language is entered.
Key
Gets or sets a string that identifies the lexer, generally the related language name.
public string Key { get; set; }
Property Value
- String:
A string that identifies the lexer, generally the related language name.
LexicalMacros
Gets the collection of lexical macros.
public IDynamicLexicalMacroCollection LexicalMacros { get; }
Property Value
- IDynamicLexicalMacroCollection:
A IDynamicLexicalMacroCollection containing the lexical macros.
LexicalStateIdProvider
Gets the ILexicalStateIdProvider that provides access to all the lexical state IDs and keys used by this lexer.
public ILexicalStateIdProvider LexicalStateIdProvider { get; set; }
Property Value
- ILexicalStateIdProvider:
The ILexicalStateIdProvider that provides access to all the lexical state IDs and keys used by this lexer.
LexicalStates
Gets the collection of lexical states.
public IDynamicLexicalStateCollection LexicalStates { get; }
Property Value
- IDynamicLexicalStateCollection:
A IDynamicLexicalStateCollection containing the lexical states.
TokenIdProvider
Gets or sets the ITokenIdProvider that provides access to all the token IDs and keys used by this lexer.
public ITokenIdProvider TokenIdProvider { get; set; }
Property Value
- ITokenIdProvider:
The ITokenIdProvider that provides access to all the token IDs and keys used by this lexer.
Methods
GetAllLexicalStateTransitions()
Returns a collection containing all ILexicalStateTransition objects within the lexer.
public override 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
public override 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.
public override 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.
OnChanged(EventArgs)
Raises the Changed
event.
protected override void OnChanged(EventArgs e)
Parameter | Type | Description |
---|---|---|
e | EventArgs | The |
Inherited Members
- MergableLexerBase.CreateChangeBatch()
- MergableLexerBase.CreateDocumentEndToken(Int32, TextPosition, ILexicalState)
- MergableLexerBase.CreateToken(Int32, Int32, TextPosition, TextPosition, MergableLexerFlags, ILexicalState, IMergableTokenLexerData)
- MergableLexerBase.GetIncrementalParseRange(TextSnapshotRange)
- MergableLexerBase.Parse(TextSnapshotRange, ILexerTarget)
- MergableLexerBase.IKeyedObject.Key
- MergableLexerBase.ILexer.TokenIdProvider
- MergableLexerBase.IMergableLexer.DefaultLexicalState
- MergableLexerBase.IMergableLexer.LexicalStateIdProvider
- MergableLexerBase.DefaultLexicalStateCore
- MergableLexerBase.KeyCore
- MergableLexerBase.LexicalStateIdProviderCore
- MergableLexerBase.TokenIdProviderCore
- MergableLexerBase.Changed
- Object.ToString()
- Object.Equals(Object)
- Object.Equals(Object, Object)
- Object.ReferenceEquals(Object, Object)
- Object.GetHashCode()
- Object.GetType()
- Object.MemberwiseClone()