JsonLexer Class
Represents a JSON lexer (lexical analyzer) implementation.
public class JsonLexer : MergeableLexerBase, IMergeableLexer, ILexer, IKeyedObject
- Inheritance:
- object MergeableLexerBase object
- Implements:
- IMergeableLexer ILexer IKeyedObject
Constructors
JsonLexer()
Initializes an instance of the class.
public JsonLexer()
Properties
AreCommentsSupported
Indicates whether comments can recognized and tokenized by the lexer.
public bool AreCommentsSupported { get; set; }
Property Value
- bool:
The default value is
false.
Remarks
Comments are not supported by standard JSON, and are therefore lexer support is not enabled by default.
However JavaScript style comments are supported by Microsoft's JSONC (JSON with Comments) variant.
Set this property to true to allow the lexer to recognize comment tokens.
LexicalStates
The collection of lexical states used by this lexer.
Methods
GetAllLexicalStateTransitions()
Returns a collection containing all ILexicalStateTransition objects within the lexer.
public override IEnumerable<ILexicalStateTransition> GetAllLexicalStateTransitions()
Returns
Remarks
This method allows consumers to see which language transitions can be made within the lexer.
GetNextToken(ITextBufferReader, ILexicalState)
Performs a lex to return the next MergeableLexerResult from a ITextBufferReader and seeks past it if there is a match.
public override 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
Inherited Members
- MergeableLexerBase.CreateChangeBatch()
- MergeableLexerBase.CreateDocumentEndToken(int, TextPosition, ILexicalState)
- MergeableLexerBase.CreateToken(int, int, TextPosition, TextPosition, MergeableLexerFlags, ILexicalState, IMergeableTokenLexerData)
- MergeableLexerBase.GetDefaultToken(ITextBufferReader, ILexicalState)
- MergeableLexerBase.GetIncrementalParseRange(TextSnapshotRange)
- MergeableLexerBase.OnChanged(EventArgs)
- MergeableLexerBase.Parse(TextSnapshotRange, ILexerTarget)
- MergeableLexerBase.DefaultLexicalStateCore
- MergeableLexerBase.KeyCore
- MergeableLexerBase.LexicalStateIdProviderCore
- MergeableLexerBase.TokenIdProviderCore
- MergeableLexerBase.Changed
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()