In This Article

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.

public ILexicalStateCollection LexicalStates { get; }

Property Value

ILexicalStateCollection

Methods

GetAllLexicalStateTransitions()

Returns a collection containing all ILexicalStateTransition objects within the lexer.

public override IEnumerable<ILexicalStateTransition> GetAllLexicalStateTransitions()

Returns

IEnumerable<ILexicalStateTransition>

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

MergeableLexerResult

Inherited Members

Extension Methods