expression

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayExpression

type ArrayExpression struct {
	Children []Expression
}

func NewArrayExpression

func NewArrayExpression(children ...Expression) *ArrayExpression

func (*ArrayExpression) Accept

func (expr *ArrayExpression) Accept(v Visitor) (Expression, error)

func (*ArrayExpression) String

func (expr *ArrayExpression) String() string

type BinaryExpression

type BinaryExpression struct {
	Operator    token.Token
	Left, Right Expression
}

func NewBinaryExpression

func NewBinaryExpression(op token.Token, left, right Expression) *BinaryExpression

func (*BinaryExpression) Accept

func (expr *BinaryExpression) Accept(v Visitor) (Expression, error)

func (*BinaryExpression) String

func (expr *BinaryExpression) String() string

type BoolLiteral

type BoolLiteral struct {
	Value bool
}

func NewBoolLiteral

func NewBoolLiteral(value bool) *BoolLiteral

func (*BoolLiteral) Accept

func (lit *BoolLiteral) Accept(v Visitor) (Expression, error)

func (*BoolLiteral) String

func (lit *BoolLiteral) String() string

type Expression

type Expression interface {
	String() string
	Accept(v Visitor) (Expression, error)
}

type IntLiteral

type IntLiteral struct {
	Value int64
}

func NewIntLiteral

func NewIntLiteral(value int64) *IntLiteral

func (*IntLiteral) Accept

func (lit *IntLiteral) Accept(v Visitor) (Expression, error)

func (*IntLiteral) String

func (lit *IntLiteral) String() string

type StringLiteral

type StringLiteral struct {
	Value string
}

func NewStringLiteral

func NewStringLiteral(value string) *StringLiteral

func (*StringLiteral) Accept

func (lit *StringLiteral) Accept(v Visitor) (Expression, error)

func (*StringLiteral) String

func (lit *StringLiteral) String() string

type UnaryExpression

type UnaryExpression struct {
	Operator token.Token
	Child    Expression
}

func NewUnaryExpression

func NewUnaryExpression(op token.Token, child Expression) *UnaryExpression

func (*UnaryExpression) Accept

func (expr *UnaryExpression) Accept(v Visitor) (Expression, error)

func (*UnaryExpression) String

func (expr *UnaryExpression) String() string

type VarExpression

type VarExpression struct {
	Value string
}

func NewVarExpression

func NewVarExpression(value string) *VarExpression

func (*VarExpression) Accept

func (expr *VarExpression) Accept(v Visitor) (Expression, error)

func (*VarExpression) String

func (expr *VarExpression) String() string

type Visitor

type Visitor interface {
	Visit(expr Expression) (Expression, error)
	VisitLiteral(expr Expression) (Expression, error)
	VisitVar(expr *VarExpression) (Expression, error)
	VisitUnary(expr *UnaryExpression) (Expression, error)
	VisitBinary(expr *BinaryExpression) (Expression, error)
}

Jump to

Keyboard shortcuts

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