parsers

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown = iota
	LeftBrace
	RightBrace
	LeftSquareBrace
	RightSquareBrace
	Plus
	Minus
	Star
	Slash
	Procent
	Power
	Equal
	NotEqual
	More
	Less
	EqualMore
	EqualLess
	ShiftLeft
	ShiftRight
	And
	Or
	Xor
	Is
	In
	NotIn
	Element
	Null
	Not
	Like
	NotLike
	IsNull
	IsNotNull
	Comma
	Unary
	Function
	Variable
	Constant
)

Define types of expression tokens.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpressionParser

type ExpressionParser struct {
	// contains filtered or unexported fields
}

Implements an expression parser class.

func NewExpressionParser

func NewExpressionParser() *ExpressionParser

func (*ExpressionParser) Clear

func (c *ExpressionParser) Clear()

Clears parsing results.

func (*ExpressionParser) Expression

func (c *ExpressionParser) Expression() string

Gets the expression string.

func (*ExpressionParser) InitialTokens

func (c *ExpressionParser) InitialTokens() []*ExpressionToken

Gets the list of original expression tokens.

func (*ExpressionParser) OriginalTokens

func (c *ExpressionParser) OriginalTokens() []*tokenizers.Token

Gets the original tokens

func (*ExpressionParser) ParseString

func (c *ExpressionParser) ParseString(expression string) error

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

Parameters:

  • expression: A new expression string.

func (*ExpressionParser) ParseTokens

func (c *ExpressionParser) ParseTokens(tokens []*tokenizers.Token) error

func (*ExpressionParser) ResultTokens

func (c *ExpressionParser) ResultTokens() []*ExpressionToken

Gets the list of parsed expression tokens.

func (*ExpressionParser) SetExpression

func (c *ExpressionParser) SetExpression(value string) error

Sets the expression string.

func (*ExpressionParser) SetOriginalTokens

func (c *ExpressionParser) SetOriginalTokens(value []*tokenizers.Token) error

Sets the original tokens

func (*ExpressionParser) VariableNames

func (c *ExpressionParser) VariableNames() []string

Gets the list of found variable names.

type ExpressionToken

type ExpressionToken struct {
	// contains filtered or unexported fields
}

Defines an expression token holder.

func NewExpressionToken

func NewExpressionToken(typ int, value *variants.Variant, line int, column int) *ExpressionToken

Creates an instance of this token and initializes it with specified values.

Parameters:

  • typ: The type of this token.
  • value: The value of this token.
  • line: The line number where the token is.
  • column: The column number where the token is.

func (*ExpressionToken) Column

func (c *ExpressionToken) Column() int

The column number where the token is.

func (*ExpressionToken) Line

func (c *ExpressionToken) Line() int

The line number where the token is.

func (*ExpressionToken) Type

func (c *ExpressionToken) Type() int

The type of this token.

func (*ExpressionToken) Value

func (c *ExpressionToken) Value() *variants.Variant

The value of this token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL