Documentation ¶
Index ¶
- func Eval(input string, context map[string]interface{}) float64
- type EmptyToken
- type ErrorToken
- type FuncToken
- type GroupToken
- type IdentityToken
- type LRFuncToken
- type NumberToken
- type OperatorPrecedence
- type OperatorToken
- type TextToken
- type Token
- type TokenCategory
- type TreeNode
- func (this *TreeNode) Add(value Token) *TreeNode
- func (this *TreeNode) AddElement(element *TreeNode) *TreeNode
- func (this *TreeNode) Items() []*TreeNode
- func (this *TreeNode) Last() Token
- func (this *TreeNode) LastElement() *TreeNode
- func (this *TreeNode) Parent() *TreeNode
- func (this *TreeNode) Push(value Token) *TreeNode
- func (this *TreeNode) PushElement(element *TreeNode) *TreeNode
- func (this *TreeNode) Root() *TreeNode
- func (this *TreeNode) String() string
- func (this *TreeNode) StringContent() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EmptyToken ¶
type EmptyToken struct {
// contains filtered or unexported fields
}
func NewEmptyToken ¶
func NewEmptyToken() *EmptyToken
func (*EmptyToken) Category ¶
func (this *EmptyToken) Category() TokenCategory
func (*EmptyToken) Error ¶
func (this *EmptyToken) Error() error
func (*EmptyToken) SetError ¶
func (this *EmptyToken) SetError(err error)
func (*EmptyToken) String ¶
func (this *EmptyToken) String() string
type ErrorToken ¶
type ErrorToken struct {
EmptyToken
}
func NewErrorToken ¶
func NewErrorToken(err string) *ErrorToken
type FuncToken ¶
type FuncToken struct { EmptyToken Name string Arguments []*TreeNode }
func NewFuncToken ¶
func (*FuncToken) AddArgument ¶
type GroupToken ¶
type GroupToken struct { EmptyToken GroupType string }
func NewGroupToken ¶
func NewGroupToken(group string) *GroupToken
func (*GroupToken) String ¶
func (this *GroupToken) String() string
type IdentityToken ¶
type IdentityToken struct { EmptyToken Name string }
func NewIdentityToken ¶
func NewIdentityToken(name string) *IdentityToken
func (*IdentityToken) String ¶
func (this *IdentityToken) String() string
type LRFuncToken ¶
type LRFuncToken struct { EmptyToken Name string }
func NewLRFuncToken ¶
func NewLRFuncToken(name string) *LRFuncToken
func (*LRFuncToken) String ¶
func (this *LRFuncToken) String() string
type NumberToken ¶
type NumberToken struct { EmptyToken Value float64 }
func NewNumberToken ¶
func NewNumberToken(value string) *NumberToken
func (*NumberToken) String ¶
func (this *NumberToken) String() string
type OperatorPrecedence ¶
type OperatorPrecedence [][]string
func (OperatorPrecedence) All ¶
func (this OperatorPrecedence) All() []string
func (OperatorPrecedence) Level ¶
func (this OperatorPrecedence) Level(operator string) int
type OperatorToken ¶
type OperatorToken struct { EmptyToken Operator string // contains filtered or unexported fields }
func NewOperatorToken ¶
func NewOperatorToken(operator string) *OperatorToken
func (*OperatorToken) Precedence ¶
func (this *OperatorToken) Precedence(operator string) int
OperatorPrecedence return true if the operator argument is lower than the current operator.
func (*OperatorToken) SetOperator ¶
func (this *OperatorToken) SetOperator(operator string)
func (*OperatorToken) String ¶
func (this *OperatorToken) String() string
type Token ¶
type Token interface { Category() TokenCategory SetError(err error) Error() error String() string }
type TokenCategory ¶
type TokenCategory int
const ( CatOther TokenCategory = iota CatFunction CatValue )
type TreeNode ¶
type TreeNode struct { Value Token // contains filtered or unexported fields }
func NewTreeNode ¶
NewTreeElement Creates a new TreeElement.
func (*TreeNode) AddElement ¶
Add adds a TreeElement to the end of the children items of the current node.
func (*TreeNode) LastElement ¶
func (*TreeNode) PushElement ¶
Push, removes the current element from its current parent, place the new value in its place and add the current element to the new element. there by pushing the current element down the hierachy. Example: tree: A(B) B.Push(C) tree: A(C(B))
func (*TreeNode) StringContent ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.