lists

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: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Concatenation

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

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

func NewConcatenation

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

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

func (*Concatenation) Clone

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

Clone returns a copy of the token and all its children

func (*Concatenation) Get

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

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

func (l *Concatenation) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Concatenation) InternalLogicalRemove

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

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

func (l *Concatenation) Len() int

Len returns the number of the current referenced tokens

func (*Concatenation) Minimize

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

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

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

Permutation sets a specific permutation for this token

func (*Concatenation) Permutations

func (l *Concatenation) Permutations() uint

Permutations returns the number of permutations for this token

func (*Concatenation) PermutationsAll

func (l *Concatenation) PermutationsAll() uint

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

func (*Concatenation) String

func (l *Concatenation) String() string

type IndexItem

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

func NewIndexItem(tok token.IndexToken) *IndexItem

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

func (*IndexItem) Clone

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

Clone returns a copy of the token and all its children

func (*IndexItem) Parse

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

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

Permutation sets a specific permutation for this token

func (*IndexItem) Permutations

func (l *IndexItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*IndexItem) PermutationsAll

func (l *IndexItem) PermutationsAll() uint

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

func (*IndexItem) SetScope

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

SetScope sets the scope of the token

func (*IndexItem) String

func (l *IndexItem) String() string

type ListError

type ListError struct {
	Type ListErrorType
}

ListError holds a list error

func (*ListError) Error

func (err *ListError) Error() string

type ListErrorType

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

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

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

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

Clone returns a copy of the token and all its children

func (*ListItem) Index

func (l *ListItem) Index() int

Index returns the index of this token in its parent token

func (*ListItem) Parse

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

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

Permutation sets a specific permutation for this token

func (*ListItem) Permutations

func (l *ListItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*ListItem) PermutationsAll

func (l *ListItem) PermutationsAll() uint

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

func (*ListItem) SetScope

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

SetScope sets the scope of the token

func (*ListItem) String

func (l *ListItem) String() string

type Once

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

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

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

func (*Once) Clone

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

Clone returns a copy of the token and all its children

func (*Once) Get

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

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

func (l *Once) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Once) InternalLogicalRemove

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

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

func (l *Once) Len() int

Len returns the number of the current referenced tokens

func (*Once) Parse

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

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

Permutation sets a specific permutation for this token

func (*Once) Permutations

func (l *Once) Permutations() uint

Permutations returns the number of permutations for this token

func (*Once) PermutationsAll

func (l *Once) PermutationsAll() uint

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

func (*Once) String

func (l *Once) String() string

type One

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

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

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

func (*One) Clone

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

Clone returns a copy of the token and all its children

func (*One) Get

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

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

func (l *One) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*One) InternalLogicalRemove

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

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

func (l *One) Len() int

Len returns the number of the current referenced tokens

func (*One) Minimize

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

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

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

Permutation sets a specific permutation for this token

func (*One) Permutations

func (l *One) Permutations() uint

Permutations returns the number of permutations for this token

func (*One) PermutationsAll

func (l *One) PermutationsAll() uint

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

func (*One) String

func (l *One) String() string

type Repeat

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

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

func NewRepeat

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

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

func (l *Repeat) Activate()

Activate activates this token

func (*Repeat) Clone

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

Clone returns a copy of the token and all its children

func (*Repeat) Deactivate

func (l *Repeat) Deactivate()

Deactivate deactivates this token

func (*Repeat) From

func (l *Repeat) From() int64

From returns the from value of the repeat range

func (*Repeat) Get

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

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

func (l *Repeat) InternalLen() int

InternalLen returns the number of referenced internal tokens

func (*Repeat) InternalLogicalRemove

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

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

func (l *Repeat) IsOptional() bool

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

func (*Repeat) Len

func (l *Repeat) Len() int

Len returns the number of the current referenced tokens

func (*Repeat) Parse

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

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

Permutation sets a specific permutation for this token

func (*Repeat) Permutations

func (l *Repeat) Permutations() uint

Permutations returns the number of permutations for this token

func (*Repeat) PermutationsAll

func (l *Repeat) PermutationsAll() uint

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

func (*Repeat) Reduce

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

Reduce sets a specific reduction for this token

func (*Repeat) Reduces

func (l *Repeat) Reduces() uint

Reduces returns the number of reductions for this token

func (*Repeat) Reset

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

func (l *Repeat) String() string

func (*Repeat) To

func (l *Repeat) To() int64

To returns the to value of the repeat range

type UniqueItem

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

func NewUniqueItem(list token.ListToken) *UniqueItem

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

func (*UniqueItem) Clone

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

Clone returns a copy of the token and all its children

func (*UniqueItem) Index

func (l *UniqueItem) Index() int

Index returns the index of this token in its parent token

func (*UniqueItem) Parse

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

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

Permutation sets a specific permutation for this token

func (*UniqueItem) Permutations

func (l *UniqueItem) Permutations() uint

Permutations returns the number of permutations for this token

func (*UniqueItem) PermutationsAll

func (l *UniqueItem) PermutationsAll() uint

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

func (*UniqueItem) Release

func (l *UniqueItem) Release()

Release gives the token a chance to remove resources

func (*UniqueItem) String

func (l *UniqueItem) String() string

Jump to

Keyboard shortcuts

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