In This Article

LLParserBase Class

Represents the base class for an IParser that executes based on a Grammar definition.

public abstract class LLParserBase : ParserBase, ILLParser, IParser, IKeyedObject
Inheritance:
System.Object ParserBase Object
Derived:
DotNetParserBase JavaScriptParser JsonParser PythonParser XmlParserBase
Implements:
ILLParser IParser IKeyedObject

Constructors

LLParserBase(Grammar)

Initializes a new instance of the LLParserBase class.

protected LLParserBase(Grammar grammar)
Parameter Type Description
grammar Grammar

The Grammar to use.

Properties

Grammar

Gets the Grammar that is used by this parser.

public Grammar Grammar { get; }

Property Value

Grammar:

The Grammar that is used by this parser.

Methods

CreateParseData(IParseRequest, IParserState)

Creates an IParseData for the specified IParserState, after the parse operation has completed.

protected virtual IParseData CreateParseData(IParseRequest request, IParserState state)
Parameter Type Description
request IParseRequest

The IParseRequest that contains data about the requested parsing operation.

state IParserState

The IParserState to examine.

Returns

IParseData:

The IParseData that was created.

CreateParserState(ITokenReader, IAstNodeBuilder, ITextSnapshot)

Creates an IParserState for a parse operation.

protected virtual IParserState CreateParserState(ITokenReader tokenReader, IAstNodeBuilder astNodeBuilder, ITextSnapshot snapshot)
Parameter Type Description
tokenReader ITokenReader

The ITokenReader that is used to read tokens during the parsing operation.

astNodeBuilder IAstNodeBuilder

The IAstNodeBuilder to use for constructing AST node results

snapshot ITextSnapshot

The ITextSnapshot used to initiate the parsing operation, if known.

Returns

IParserState:

The IParserState that was created.

CreateTokenReader(ITextBufferReader)

Creates an ITokenReader that is used by the parser to read through tokens.

public abstract ITokenReader CreateTokenReader(ITextBufferReader reader)
Parameter Type Description
reader ITextBufferReader

The ITextBufferReader that provides access to the text buffer.

Returns

ITokenReader:

An ITokenReader that is used by the parser to read through tokens.

InitializeParseData(LLParseData, IParserState)

Initializes a LLParseData using the specified IParserState.

protected virtual void InitializeParseData(LLParseData parseData, IParserState state)
Parameter Type Description
parseData LLParseData

The LLParseData to initialize.

state IParserState

The IParserState to examine.

Remarks

This method is called by default from the CreateParseData(IParseRequest, IParserState) method.

InitializeParserState(IParserState, IParseRequest)

Initializes the IParserState, allowing its CustomData property to be configured based on data from the IParseRequest, immediately prior to the parse operation running.

protected virtual void InitializeParserState(IParserState state, IParseRequest request)
Parameter Type Description
state IParserState

The IParserState to initialize.

request IParseRequest

The IParseRequest that initiated the parse operation.

Parse(IParseRequest)

Performs a parsing operation using the parameters specified in the supplied IParseRequest and returns the resulting parse data.

public override IParseData Parse(IParseRequest request)
Parameter Type Description
request IParseRequest

The IParseRequest that contains data about the requested parsing operation.

Returns

IParseData:

An IParseData that is the result of the parsing operation.

Remarks

A IParseRequestDispatcher typically calls this method when a queued parse request is ready to be processed.

Inherited Members

  • ParserBase.Key
  • System.Object.ToString()
  • System.Object.Equals(System.Object)
  • System.Object.Equals(System.Object, System.Object)
  • System.Object.ReferenceEquals(System.Object, System.Object)
  • System.Object.GetHashCode()
  • System.Object.GetType()
  • System.Object.MemberwiseClone()