JsonLexer Class
Represents a JSON
lexer (lexical analyzer) implementation.
public class JsonLexer : MergableLexerBase, IMergableLexer, ILexer, IKeyedObject
- Inheritance:
- object MergableLexerBase object
- Implements:
- IMergableLexer ILexer IKeyedObject
Constructors
JsonLexer()
Initializes a new instance of the JsonLexer
class.
public JsonLexer()
Properties
AreCommentsSupported
Gets or sets whether comments can recognized and tokenized by the lexer.
public bool AreCommentsSupported { get; set; }
Property Value
- bool:
true
if comments can recognized and tokenized by the lexer; otherwise,false
. The default value isfalse
.
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
Gets the collection of lexical states used by this lexer.
public ILexicalStateCollection LexicalStates { get; }
Property Value
- ILexicalStateCollection:
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
- 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.
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.
Inherited Members
- MergableLexerBase.CreateChangeBatch()
- MergableLexerBase.CreateDocumentEndToken(int, TextPosition, ILexicalState)
- MergableLexerBase.CreateToken(int, int, TextPosition, TextPosition, MergableLexerFlags, ILexicalState, IMergableTokenLexerData)
- MergableLexerBase.GetDefaultToken(ITextBufferReader, ILexicalState)
- MergableLexerBase.GetIncrementalParseRange(TextSnapshotRange)
- MergableLexerBase.OnChanged(EventArgs)
- MergableLexerBase.Parse(TextSnapshotRange, ILexerTarget)
- MergableLexerBase.DefaultLexicalStateCore
- MergableLexerBase.KeyCore
- MergableLexerBase.LexicalStateIdProviderCore
- MergableLexerBase.TokenIdProviderCore
- MergableLexerBase.Changed
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()