ExpressionParser

Implements an expression parser class.

Description

The ExpressionParser class allows you to implement an expression parser.

Properties

expression

Expression string.

expression(): str

  • returns: str - expression string.

expression(value: str)

  • value: str - expression string.

initial_tokens

List of original expression tokens.

initial_tokens(): List[ExpressionToken]

original_tokens

Gets the original tokens

original_tokens(): List[Token]

  • returns: List[Token] - token list

Sets the original tokens

original_tokens(value: List[Token])

  • value: List[Token] - token list

result_tokens

List of parsed expression tokens.

result_tokens(): List[ExpressionToken]

variable_names

List of found variable names.

variable_names(): List[str]

  • returns: List[str] - list of found variable names.

Instance methods

clear

Clears parsing results.

clear()

parse_string

Sets a new expression string and parses it into internal byte code.

parseString(expression: str)

  • expression: str - new expression string.

parse_tokens

Parses a given token.

parse_tokens(tokens: List[Token])

  • tokens: List[Token] - token to be parsed.