ast

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attributes

type Attributes map[string]*Expr

Attributes is a map from attribute name to the value expression.

func (Attributes) Union

func (as1 Attributes) Union(as2 Attributes) (Attributes, error)

Union adds the parameter Attributes into the caller. It returns error if there is any duplicated attribute.

type Constraint

type Constraint struct {
	*Expr
	GroupBy string
}

Constraint represents a constraint in the description of a mathematical optimization problem. A constraint is an expression with an optional GroupBy name.

type ConstraintList

type ConstraintList []*Constraint

ConstraintList is a list of constraints. The parser generates a ConstraintList from the TO MAXIMIZE/MINIMIZE clause.

type Expr

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

Expr defines an expression.

func NewBinary

func NewBinary(token int, op string, od1 *Expr, od2 *Expr) (*Expr, error)

NewBinary returns a binary expression.

func NewFuncall

func NewFuncall(token int, op string, oprd ExprList) (*Expr, error)

NewFuncall returns an expression representing a function call.

func NewLiteral

func NewLiteral(token int, value string) (*Expr, error)

NewLiteral returns a literal expression.

func NewUnary

func NewUnary(token int, op string, od1 *Expr) (*Expr, error)

NewUnary returns a unary exprression.

func NewVariadic

func NewVariadic(token int, op string, ods ExprList) (*Expr, error)

NewVariadic returns a variadic expression.

func (Expr) IsBinary

func (e Expr) IsBinary() bool

IsBinary returns true if e is a binary expression.

func (Expr) IsFuncall

func (e Expr) IsFuncall() bool

IsFuncall returns true if the expression represents a function call.

func (Expr) IsLiteral

func (e Expr) IsLiteral() bool

IsLiteral returns true if e is a literal value; otherwise, we say that e is a compound expression.

func (Expr) IsUnary

func (e Expr) IsUnary() bool

IsUnary returns true if e is a binary expression.

func (Expr) IsVariadic

func (e Expr) IsVariadic() bool

IsVariadic returns true if the expression is a list "[...]".

func (*Expr) String

func (e *Expr) String() string

type ExprList

type ExprList []*Expr

ExprList represent a list of expressions. For example, the parser generates an ExprList from parameters of a function call.

Jump to

Keyboard shortcuts

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