tavor: github.com/zimmski/tavor/token/conditions Index | Files

package conditions

import "github.com/zimmski/tavor/token/conditions"

Index

Package Files

conditions.go expressions.go

type BooleanEqual Uses

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

BooleanEqual implements a boolean expression which compares the value of two tokens

func NewBooleanEqual Uses

func NewBooleanEqual(a, b token.Token) *BooleanEqual

NewBooleanEqual returns a new instance of a BooleanEqual token referencing two tokens

func (*BooleanEqual) Clone Uses

func (c *BooleanEqual) Clone() token.Token

Clone returns a copy of the token and all its children

func (*BooleanEqual) Evaluate Uses

func (c *BooleanEqual) Evaluate() bool

Evaluate evaluates the boolean expression and returns its result

func (*BooleanEqual) Get Uses

func (c *BooleanEqual) 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 (*BooleanEqual) InternalGet Uses

func (c *BooleanEqual) 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 (*BooleanEqual) InternalLen Uses

func (c *BooleanEqual) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*BooleanEqual) InternalLogicalRemove Uses

func (c *BooleanEqual) 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 (*BooleanEqual) InternalReplace Uses

func (c *BooleanEqual) 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 (*BooleanEqual) Len Uses

func (c *BooleanEqual) Len() int

Len returns the number of the current referenced tokens

func (*BooleanEqual) Parse Uses

func (c *BooleanEqual) 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 (*BooleanEqual) Permutation Uses

func (c *BooleanEqual) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*BooleanEqual) Permutations Uses

func (c *BooleanEqual) Permutations() uint

Permutations returns the number of permutations for this token

func (*BooleanEqual) PermutationsAll Uses

func (c *BooleanEqual) PermutationsAll() uint

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

func (*BooleanEqual) String Uses

func (c *BooleanEqual) String() string

type BooleanExpression Uses

type BooleanExpression interface {
    token.Token

    // Evaluate evaluates the boolean expression and returns its result
    Evaluate() bool
}

BooleanExpression defines a boolean expression

type BooleanTrue Uses

type BooleanTrue struct{}

BooleanTrue implements a boolean expression which evaluates to always true

func NewBooleanTrue Uses

func NewBooleanTrue() *BooleanTrue

NewBooleanTrue returns a new instance of a BooleanTrue token

func (*BooleanTrue) Clone Uses

func (c *BooleanTrue) Clone() token.Token

Clone returns a copy of the token and all its children

func (*BooleanTrue) Evaluate Uses

func (c *BooleanTrue) Evaluate() bool

Evaluate evaluates the boolean expression and returns its result

func (*BooleanTrue) Get Uses

func (c *BooleanTrue) 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 (*BooleanTrue) InternalGet Uses

func (c *BooleanTrue) 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 (*BooleanTrue) InternalLen Uses

func (c *BooleanTrue) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*BooleanTrue) InternalLogicalRemove Uses

func (c *BooleanTrue) 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 (*BooleanTrue) InternalReplace Uses

func (c *BooleanTrue) 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 (*BooleanTrue) Len Uses

func (c *BooleanTrue) Len() int

Len returns the number of the current referenced tokens

func (*BooleanTrue) Parse Uses

func (c *BooleanTrue) 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 (*BooleanTrue) Permutation Uses

func (c *BooleanTrue) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*BooleanTrue) Permutations Uses

func (c *BooleanTrue) Permutations() uint

Permutations returns the number of permutations for this token

func (*BooleanTrue) PermutationsAll Uses

func (c *BooleanTrue) PermutationsAll() uint

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

func (*BooleanTrue) String Uses

func (c *BooleanTrue) String() string

type ExpressionPointer Uses

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

ExpressionPointer implements a token pointer to an expression token

func NewExpressionPointer Uses

func NewExpressionPointer(token token.Token) *ExpressionPointer

NewExpressionPointer returns a new instance of a ExpressionPointer token referencing the given token

func (*ExpressionPointer) Clone Uses

func (c *ExpressionPointer) Clone() token.Token

Clone returns a copy of the token and all its children

func (*ExpressionPointer) Evaluate Uses

func (c *ExpressionPointer) Evaluate() bool

Evaluate evaluates the boolean expression and returns its result

func (*ExpressionPointer) Get Uses

func (c *ExpressionPointer) Get() token.Token

Get returns the current referenced token

func (*ExpressionPointer) InternalGet Uses

func (c *ExpressionPointer) InternalGet() token.Token

InternalGet returns the current referenced internal token

func (*ExpressionPointer) InternalLogicalRemove Uses

func (c *ExpressionPointer) 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 (*ExpressionPointer) InternalReplace Uses

func (c *ExpressionPointer) 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 (*ExpressionPointer) Parse Uses

func (c *ExpressionPointer) 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 (*ExpressionPointer) Permutation Uses

func (c *ExpressionPointer) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*ExpressionPointer) Permutations Uses

func (c *ExpressionPointer) Permutations() uint

Permutations returns the number of permutations for this token

func (*ExpressionPointer) PermutationsAll Uses

func (c *ExpressionPointer) PermutationsAll() uint

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

func (*ExpressionPointer) SetScope Uses

func (c *ExpressionPointer) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*ExpressionPointer) String Uses

func (c *ExpressionPointer) String() string

type If Uses

type If struct {
    Pairs []IfPair
}

If implements a condition token which holds a list of IfPairs which belong together (e.g. If Elsif ... Else)

func NewIf Uses

func NewIf(Pairs ...IfPair) *If

NewIf returns a new instance of a If token referencing a list of IfPairs

func (*If) Clone Uses

func (c *If) Clone() token.Token

Clone returns a copy of the token and all its children

func (*If) Parse Uses

func (c *If) 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 (*If) Permutation Uses

func (c *If) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*If) Permutations Uses

func (c *If) Permutations() uint

Permutations returns the number of permutations for this token

func (*If) PermutationsAll Uses

func (c *If) PermutationsAll() uint

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

func (*If) SetScope Uses

func (c *If) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*If) String Uses

func (c *If) String() string

type IfPair Uses

type IfPair struct {
    Head BooleanExpression
    Body token.Token
}

IfPair implements a condition token which holds an If condition with its head and body

func (*IfPair) Clone Uses

func (c *IfPair) Clone() token.Token

Clone returns a copy of the token and all its children

func (*IfPair) Get Uses

func (c *IfPair) 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 (*IfPair) InternalGet Uses

func (c *IfPair) 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 (*IfPair) InternalLen Uses

func (c *IfPair) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*IfPair) InternalLogicalRemove Uses

func (c *IfPair) 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 (*IfPair) InternalReplace Uses

func (c *IfPair) 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 (*IfPair) Len Uses

func (c *IfPair) Len() int

Len returns the number of the current referenced tokens

func (*IfPair) Parse Uses

func (c *IfPair) 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 (*IfPair) Permutation Uses

func (c *IfPair) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*IfPair) Permutations Uses

func (c *IfPair) Permutations() uint

Permutations returns the number of permutations for this token

func (*IfPair) PermutationsAll Uses

func (c *IfPair) PermutationsAll() uint

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

func (*IfPair) String Uses

func (c *IfPair) String() string

type VariableDefined Uses

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

VariableDefined implements a boolean expression which evaluates if a variable is defined in a given scope

func NewVariableDefined Uses

func NewVariableDefined(name string, variableScope *token.VariableScope) *VariableDefined

NewVariableDefined returns a new instance of a VariableDefined token initialzed with the given name and scope

func (*VariableDefined) Clone Uses

func (c *VariableDefined) Clone() token.Token

Clone returns a copy of the token and all its children

func (*VariableDefined) Evaluate Uses

func (c *VariableDefined) Evaluate() bool

Evaluate evaluates the boolean expression and returns its result

func (*VariableDefined) Parse Uses

func (c *VariableDefined) 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 (*VariableDefined) Permutation Uses

func (c *VariableDefined) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*VariableDefined) Permutations Uses

func (c *VariableDefined) Permutations() uint

Permutations returns the number of permutations for this token

func (*VariableDefined) PermutationsAll Uses

func (c *VariableDefined) PermutationsAll() uint

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

func (*VariableDefined) SetScope Uses

func (c *VariableDefined) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*VariableDefined) String Uses

func (c *VariableDefined) String() string

Package conditions imports 5 packages (graph) and is imported by 2 packages. Updated 2018-11-12. Refresh now. Tools for package owners.