expressions

package
Version: v0.0.0-...-9f34108 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddArithmetic

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

AddArithmetic implements an arithmetic token adding the values of two tokens

func NewAddArithmetic

func NewAddArithmetic(a, b token.Token) *AddArithmetic

NewAddArithmetic returns a new instance of a AddArithmetic token

func (*AddArithmetic) Clone

func (e *AddArithmetic) Clone() token.Token

Clone returns a copy of the token and all its children

func (*AddArithmetic) Get

func (e *AddArithmetic) Get(i int) (token.Token, error)

Get returns the current referenced token at the given index. The error return argument is not nil, if the index is out of bound.

func (*AddArithmetic) InternalGet

func (e *AddArithmetic) InternalGet(i int) (token.Token, error)

InternalGet returns the current referenced internal token at the given index. The error return argument is not nil, if the index is out of bound.

func (*AddArithmetic) InternalLen

func (e *AddArithmetic) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*AddArithmetic) InternalLogicalRemove

func (e *AddArithmetic) InternalLogicalRemove(tok token.Token) token.Token

InternalLogicalRemove removes the referenced internal token and returns the replacement for the current token or nil if the current token should be removed.

func (*AddArithmetic) InternalReplace

func (e *AddArithmetic) InternalReplace(oldToken, newToken token.Token) error

InternalReplace replaces an old with a new internal token if it is referenced by this token. The error return argument is not nil, if the replacement is not suitable.

func (*AddArithmetic) Len

func (e *AddArithmetic) Len() int

Len returns the number of the current referenced tokens

func (*AddArithmetic) Parse

func (e *AddArithmetic) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*AddArithmetic) Permutation

func (e *AddArithmetic) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*AddArithmetic) Permutations

func (e *AddArithmetic) Permutations() uint

Permutations returns the number of permutations for this token

func (*AddArithmetic) PermutationsAll

func (e *AddArithmetic) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*AddArithmetic) String

func (e *AddArithmetic) String() string

type DivArithmetic

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

DivArithmetic implements an arithmetic token dividing the values of two tokens

func NewDivArithmetic

func NewDivArithmetic(a, b token.Token) *DivArithmetic

NewDivArithmetic returns a new instance of a DivArithmetic token

func (*DivArithmetic) Clone

func (e *DivArithmetic) Clone() token.Token

Clone returns a copy of the token and all its children

func (*DivArithmetic) Get

func (e *DivArithmetic) Get(i int) (token.Token, error)

Get returns the current referenced token at the given index. The error return argument is not nil, if the index is out of bound.

func (*DivArithmetic) InternalGet

func (e *DivArithmetic) InternalGet(i int) (token.Token, error)

InternalGet returns the current referenced internal token at the given index. The error return argument is not nil, if the index is out of bound.

func (*DivArithmetic) InternalLen

func (e *DivArithmetic) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*DivArithmetic) InternalLogicalRemove

func (e *DivArithmetic) InternalLogicalRemove(tok token.Token) token.Token

InternalLogicalRemove removes the referenced internal token and returns the replacement for the current token or nil if the current token should be removed.

func (*DivArithmetic) InternalReplace

func (e *DivArithmetic) InternalReplace(oldToken, newToken token.Token) error

InternalReplace replaces an old with a new internal token if it is referenced by this token. The error return argument is not nil, if the replacement is not suitable.

func (*DivArithmetic) Len

func (e *DivArithmetic) Len() int

Len returns the number of the current referenced tokens

func (*DivArithmetic) Parse

func (e *DivArithmetic) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*DivArithmetic) Permutation

func (e *DivArithmetic) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*DivArithmetic) Permutations

func (e *DivArithmetic) Permutations() uint

Permutations returns the number of permutations for this token

func (*DivArithmetic) PermutationsAll

func (e *DivArithmetic) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*DivArithmetic) String

func (e *DivArithmetic) String() string

type FuncExpression

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

FuncExpression implements a expression token which executes a given list on output

func NewFuncExpression

func NewFuncExpression(
	state interface{},
	permutationFunc func(state interface{}, i uint) interface{},
	permutationsFunc func(state interface{}) uint,
	permutationsAllFunc func(state interface{}) uint,
	stringFunc func(state interface{}) string,
) *FuncExpression

NewFuncExpression returns a new instance of a FuncExpression token given the output function

func (*FuncExpression) Clone

func (e *FuncExpression) Clone() token.Token

Clone returns a copy of the token and all its children

func (*FuncExpression) Parse

func (e *FuncExpression) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*FuncExpression) Permutation

func (e *FuncExpression) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*FuncExpression) Permutations

func (e *FuncExpression) Permutations() uint

Permutations returns the number of permutations for this token

func (*FuncExpression) PermutationsAll

func (e *FuncExpression) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*FuncExpression) String

func (e *FuncExpression) String() string

type MulArithmetic

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

MulArithmetic implements an arithmetic token multiplying the values of two tokens

func NewMulArithmetic

func NewMulArithmetic(a, b token.Token) *MulArithmetic

NewMulArithmetic returns a new instance of a MulArithmetic token

func (*MulArithmetic) Clone

func (e *MulArithmetic) Clone() token.Token

Clone returns a copy of the token and all its children

func (*MulArithmetic) Get

func (e *MulArithmetic) Get(i int) (token.Token, error)

Get returns the current referenced token at the given index. The error return argument is not nil, if the index is out of bound.

func (*MulArithmetic) InternalGet

func (e *MulArithmetic) InternalGet(i int) (token.Token, error)

InternalGet returns the current referenced internal token at the given index. The error return argument is not nil, if the index is out of bound.

func (*MulArithmetic) InternalLen

func (e *MulArithmetic) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*MulArithmetic) InternalLogicalRemove

func (e *MulArithmetic) InternalLogicalRemove(tok token.Token) token.Token

InternalLogicalRemove removes the referenced internal token and returns the replacement for the current token or nil if the current token should be removed.

func (*MulArithmetic) InternalReplace

func (e *MulArithmetic) InternalReplace(oldToken, newToken token.Token) error

InternalReplace replaces an old with a new internal token if it is referenced by this token. The error return argument is not nil, if the replacement is not suitable.

func (*MulArithmetic) Len

func (e *MulArithmetic) Len() int

Len returns the number of the current referenced tokens

func (*MulArithmetic) Parse

func (e *MulArithmetic) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*MulArithmetic) Permutation

func (e *MulArithmetic) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*MulArithmetic) Permutations

func (e *MulArithmetic) Permutations() uint

Permutations returns the number of permutations for this token

func (*MulArithmetic) PermutationsAll

func (e *MulArithmetic) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*MulArithmetic) String

func (e *MulArithmetic) String() string

type Path

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

Path implements a path query

func NewPath

func NewPath(list token.Token, from token.Token, over token.Token, connectBy []token.Token, without []token.Token) (*Path, error)

NewPath returns a new instance of a Path token given the set of tokens

func (*Path) Clone

func (e *Path) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Path) Get

func (e *Path) Get(i int) (token.Token, error)

Get returns the current referenced token at the given index. The error return argument is not nil, if the index is out of bound.

func (*Path) InternalGet

func (e *Path) InternalGet(i int) (token.Token, error)

InternalGet returns the current referenced internal token at the given index. The error return argument is not nil, if the index is out of bound.

func (*Path) InternalLen

func (e *Path) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Path) InternalLogicalRemove

func (e *Path) InternalLogicalRemove(tok token.Token) token.Token

InternalLogicalRemove removes the referenced internal token and returns the replacement for the current token or nil if the current token should be removed.

func (*Path) InternalReplace

func (e *Path) InternalReplace(oldToken, newToken token.Token) error

InternalReplace replaces an old with a new internal token if it is referenced by this token. The error return argument is not nil, if the replacement is not suitable.

func (*Path) Len

func (e *Path) Len() int

Len returns the number of the current referenced tokens

func (*Path) Parse

func (e *Path) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*Path) Permutation

func (e *Path) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Path) Permutations

func (e *Path) Permutations() uint

Permutations returns the number of permutations for this token

func (*Path) PermutationsAll

func (e *Path) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*Path) SetScope

func (e *Path) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*Path) String

func (e *Path) String() string

type SubArithmetic

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

SubArithmetic implements an arithmetic token subtracting the values of two tokens

func NewSubArithmetic

func NewSubArithmetic(a, b token.Token) *SubArithmetic

NewSubArithmetic returns a new instance of a SubArithmetic token

func (*SubArithmetic) Clone

func (e *SubArithmetic) Clone() token.Token

Clone returns a copy of the token and all its children

func (*SubArithmetic) Get

func (e *SubArithmetic) Get(i int) (token.Token, error)

Get returns the current referenced token at the given index. The error return argument is not nil, if the index is out of bound.

func (*SubArithmetic) InternalGet

func (e *SubArithmetic) InternalGet(i int) (token.Token, error)

InternalGet returns the current referenced internal token at the given index. The error return argument is not nil, if the index is out of bound.

func (*SubArithmetic) InternalLen

func (e *SubArithmetic) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*SubArithmetic) InternalLogicalRemove

func (e *SubArithmetic) InternalLogicalRemove(tok token.Token) token.Token

InternalLogicalRemove removes the referenced internal token and returns the replacement for the current token or nil if the current token should be removed.

func (*SubArithmetic) InternalReplace

func (e *SubArithmetic) InternalReplace(oldToken, newToken token.Token) error

InternalReplace replaces an old with a new internal token if it is referenced by this token. The error return argument is not nil, if the replacement is not suitable.

func (*SubArithmetic) Len

func (e *SubArithmetic) Len() int

Len returns the number of the current referenced tokens

func (*SubArithmetic) Parse

func (e *SubArithmetic) Parse(pars *token.InternalParser, cur int) (int, []error)

Parse tries to parse the token beginning from the current position in the parser data. If the parsing is successful the error argument is nil and the next current position after the token is returned.

func (*SubArithmetic) Permutation

func (e *SubArithmetic) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*SubArithmetic) Permutations

func (e *SubArithmetic) Permutations() uint

Permutations returns the number of permutations for this token

func (*SubArithmetic) PermutationsAll

func (e *SubArithmetic) PermutationsAll() uint

PermutationsAll returns the number of all possible permutations for this token including its children

func (*SubArithmetic) String

func (e *SubArithmetic) String() string

Jump to

Keyboard shortcuts

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