In This Article

PythonParser Class

Represents a parser for the Python language.

public class PythonParser : LLParserBase, ILLParser, IParser, IKeyedObject
Inheritance:
Object ParserBase LLParserBase Object
Implements:
ILLParser IParser IKeyedObject

Constructors

PythonParser()

Initializes a new instance of the PythonParser class.

public PythonParser()

PythonParser(PythonVersion)

Initializes a new instance of the PythonParser class.

public PythonParser(PythonVersion version)
Parameter Type Description
version PythonVersion

The PythonVersion that indicates the Python version supported by this language service.

PythonParser(PythonVersion, Grammar)

Initializes a new instance of the PythonParser class.

public PythonParser(PythonVersion version, Grammar grammar)
Parameter Type Description
version PythonVersion

The PythonVersion that indicates the Python version supported by this language service.

grammar Grammar

The Grammar instance to use.

Properties

Version

Gets the PythonVersion that indicates the Python version supported by this language service.

public PythonVersion Version { get; }

Property Value

PythonVersion:

The PythonVersion that indicates the Python version supported by this language service.

Methods

CreateParseData(IParseRequest, IParserState)

Creates an IParseData for the specified IParserState.

protected override 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.

CreateTokenReader(ITextBufferReader)

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

public override 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.

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 override void InitializeParserState(IParserState state, IParseRequest request)
Parameter Type Description
state IParserState

The IParserState to initialize.

request IParseRequest

The IParseRequest that initiated the parse operation.

ParseExpression(PythonVersion, String)

Parses the specified expression text.

public static IPythonParseData ParseExpression(PythonVersion version, string text)
Parameter Type Description
version PythonVersion

The PythonVersion that indicates the Python version to use.

text String

The expression text to parse.

Returns

IPythonParseData:

The IPythonParseData that contains the parse results.

Inherited Members