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

package lists

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

Index

Package Files

concatenation.go items.go lists.go once.go one.go repeat.go

type Concatenation Uses

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

Concatenation implements a list token which holds an ordered set of tokens

func NewConcatenation Uses

func NewConcatenation(toks ...token.Token) *Concatenation

NewConcatenation returns a new instance of a Concatenation token given the set of tokens

func (*Concatenation) Clone Uses

func (l *Concatenation) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Concatenation) Get Uses

func (l *Concatenation) 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 (*Concatenation) InternalGet Uses

func (l *Concatenation) 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 (*Concatenation) InternalLen Uses

func (l *Concatenation) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Concatenation) InternalLogicalRemove Uses

func (l *Concatenation) 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 (*Concatenation) InternalReplace Uses

func (l *Concatenation) 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 (*Concatenation) Len Uses

func (l *Concatenation) Len() int

Len returns the number of the current referenced tokens

func (*Concatenation) Minimize Uses

func (l *Concatenation) Minimize() token.Token

Minimize tries to minimize itself and returns a token if it was successful, or nil if there was nothing to minimize

func (*Concatenation) Parse Uses

func (l *Concatenation) 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 (*Concatenation) Permutation Uses

func (l *Concatenation) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Concatenation) Permutations Uses

func (l *Concatenation) Permutations() uint

Permutations returns the number of permutations for this token

func (*Concatenation) PermutationsAll Uses

func (l *Concatenation) PermutationsAll() uint

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

func (*Concatenation) String Uses

func (l *Concatenation) String() string

type IndexItem Uses

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

IndexItem implements a list item which references an Index token to represent the index itself of this token

func NewIndexItem Uses

func NewIndexItem(tok token.IndexToken) *IndexItem

NewIndexItem returns a new instance of a IndexItem token referencing the given Index token

func (*IndexItem) Clone Uses

func (l *IndexItem) Clone() token.Token

Clone returns a copy of the token and all its children

func (*IndexItem) Parse Uses

func (l *IndexItem) 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 (*IndexItem) Permutation Uses

func (l *IndexItem) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*IndexItem) Permutations Uses

func (l *IndexItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*IndexItem) PermutationsAll Uses

func (l *IndexItem) PermutationsAll() uint

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

func (*IndexItem) SetScope Uses

func (l *IndexItem) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*IndexItem) String Uses

func (l *IndexItem) String() string

type ListError Uses

type ListError struct {
    Type ListErrorType
}

ListError holds a list error

func (*ListError) Error Uses

func (err *ListError) Error() string

type ListErrorType Uses

type ListErrorType int

ListErrorType the list error type

const (
    // ListErrorOutOfBound an index not in the bound of available list items was used.
    ListErrorOutOfBound ListErrorType = iota
)

type ListItem Uses

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

ListItem implements a list item token which references a List token and holds one index of the list to reference a list item

func NewListItem Uses

func NewListItem(index token.Token, list token.ListToken) *ListItem

NewListItem returns a new instance of a ListItem token referencing the given list and the given index

func (*ListItem) Clone Uses

func (l *ListItem) Clone() token.Token

Clone returns a copy of the token and all its children

func (*ListItem) Index Uses

func (l *ListItem) Index() int

Index returns the index of this token in its parent token

func (*ListItem) Parse Uses

func (l *ListItem) 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 (*ListItem) Permutation Uses

func (l *ListItem) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*ListItem) Permutations Uses

func (l *ListItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*ListItem) PermutationsAll Uses

func (l *ListItem) PermutationsAll() uint

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

func (*ListItem) SetScope Uses

func (l *ListItem) SetScope(variableScope *token.VariableScope)

SetScope sets the scope of the token

func (*ListItem) String Uses

func (l *ListItem) String() string

type Once Uses

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

Once implements a list token which holds a set of tokens that get shuffled on every permutation

func NewOnce Uses

func NewOnce(toks ...token.Token) *Once

NewOnce returns a new instance of a Once token given the set of tokens

func (*Once) Clone Uses

func (l *Once) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Once) Get Uses

func (l *Once) 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 (*Once) InternalGet Uses

func (l *Once) 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 (*Once) InternalLen Uses

func (l *Once) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Once) InternalLogicalRemove Uses

func (l *Once) 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 (*Once) InternalReplace Uses

func (l *Once) 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 (*Once) Len Uses

func (l *Once) Len() int

Len returns the number of the current referenced tokens

func (*Once) Parse Uses

func (l *Once) 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 (*Once) Permutation Uses

func (l *Once) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Once) Permutations Uses

func (l *Once) Permutations() uint

Permutations returns the number of permutations for this token

func (*Once) PermutationsAll Uses

func (l *Once) PermutationsAll() uint

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

func (*Once) String Uses

func (l *Once) String() string

type One Uses

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

One implements a list token which chooses of a set of referenced token exactly one token Every permutation chooses one token out of the token set.

func NewOne Uses

func NewOne(toks ...token.Token) *One

NewOne returns a new instance of a One token given the set of tokens

func (*One) Clone Uses

func (l *One) Clone() token.Token

Clone returns a copy of the token and all its children

func (*One) Get Uses

func (l *One) 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 (*One) InternalGet Uses

func (l *One) 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 (*One) InternalLen Uses

func (l *One) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*One) InternalLogicalRemove Uses

func (l *One) 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 (*One) InternalReplace Uses

func (l *One) 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 (*One) Len Uses

func (l *One) Len() int

Len returns the number of the current referenced tokens

func (*One) Minimize Uses

func (l *One) Minimize() token.Token

Minimize tries to minimize itself and returns a token if it was successful, or nil if there was nothing to minimize

func (*One) Parse Uses

func (l *One) 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 (*One) Permutation Uses

func (l *One) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*One) Permutations Uses

func (l *One) Permutations() uint

Permutations returns the number of permutations for this token

func (*One) PermutationsAll Uses

func (l *One) PermutationsAll() uint

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

func (*One) String Uses

func (l *One) String() string

type Repeat Uses

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

Repeat implements a list token which repeats a referenced token by a given range

func NewRepeat Uses

func NewRepeat(tok token.Token, from int64, to int64) *Repeat

NewRepeat returns a new instance of a Repeat token referencing the given token and the given integer range

func NewRepeatWithTokens Uses

func NewRepeatWithTokens(tok token.Token, from token.Token, to token.Token) *Repeat

NewRepeatWithTokens returns a new instance of a Repeat token referencing the given token and the given token range The tokens of the given range must return a valid integer values.

func (*Repeat) Activate Uses

func (l *Repeat) Activate()

Activate activates this token

func (*Repeat) Clone Uses

func (l *Repeat) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Repeat) Deactivate Uses

func (l *Repeat) Deactivate()

Deactivate deactivates this token

func (*Repeat) From Uses

func (l *Repeat) From() int64

From returns the from value of the repeat range

func (*Repeat) Get Uses

func (l *Repeat) 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 (*Repeat) InternalGet Uses

func (l *Repeat) 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 (*Repeat) InternalLen Uses

func (l *Repeat) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Repeat) InternalLogicalRemove Uses

func (l *Repeat) 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 (*Repeat) InternalReplace Uses

func (l *Repeat) 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 (*Repeat) IsOptional Uses

func (l *Repeat) IsOptional() bool

IsOptional checks dynamically if this token is in the current state optional

func (*Repeat) Len Uses

func (l *Repeat) Len() int

Len returns the number of the current referenced tokens

func (*Repeat) Parse Uses

func (l *Repeat) 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 (*Repeat) Permutation Uses

func (l *Repeat) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Repeat) Permutations Uses

func (l *Repeat) Permutations() uint

Permutations returns the number of permutations for this token

func (*Repeat) PermutationsAll Uses

func (l *Repeat) PermutationsAll() uint

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

func (*Repeat) Reduce Uses

func (l *Repeat) Reduce(i uint) error

Reduce sets a specific reduction for this token

func (*Repeat) Reduces Uses

func (l *Repeat) Reduces() uint

Reduces returns the number of reductions for this token

func (*Repeat) Reset Uses

func (l *Repeat) Reset() error

Reset resets the (internal) state of this token and its dependences, returns an error if the reseted state should not be used for a generation.

func (*Repeat) String Uses

func (l *Repeat) String() string

func (*Repeat) To Uses

func (l *Repeat) To() int64

To returns the to value of the repeat range

type UniqueItem Uses

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

UniqueItem implements a list item token which holds an distinct list item of a referenced List token

func NewUniqueItem Uses

func NewUniqueItem(list token.ListToken) *UniqueItem

NewUniqueItem returns a new instance of a UniqueItem token referencing the given List token

func (*UniqueItem) Clone Uses

func (l *UniqueItem) Clone() token.Token

Clone returns a copy of the token and all its children

func (*UniqueItem) Index Uses

func (l *UniqueItem) Index() int

Index returns the index of this token in its parent token

func (*UniqueItem) Parse Uses

func (l *UniqueItem) 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 (*UniqueItem) Permutation Uses

func (l *UniqueItem) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*UniqueItem) Permutations Uses

func (l *UniqueItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*UniqueItem) PermutationsAll Uses

func (l *UniqueItem) PermutationsAll() uint

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

func (*UniqueItem) Release Uses

func (l *UniqueItem) Release()

Release gives the token a chance to remove resources

func (*UniqueItem) String Uses

func (l *UniqueItem) String() string

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