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

package primitives

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

Index

Package Files

char.go int.go pointer.go scope.go string.go

type CharacterClass Uses

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

CharacterClass implements a char token which holds a pattern of characters and character classes Each character class characters is added to the set of characters of the token. Every permutations chooses one character out of the available set of characters as the current value of the token.

func NewCharacterClass Uses

func NewCharacterClass(pattern string) *CharacterClass

NewCharacterClass returns a new instance of a CharacterClass token

func (*CharacterClass) Clone Uses

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

Clone returns a copy of the token and all its children

func (*CharacterClass) Parse Uses

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

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

Permutation sets a specific permutation for this token

func (*CharacterClass) Permutations Uses

func (c *CharacterClass) Permutations() uint

Permutations returns the number of permutations for this token

func (*CharacterClass) PermutationsAll Uses

func (c *CharacterClass) PermutationsAll() uint

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

func (*CharacterClass) String Uses

func (c *CharacterClass) String() string

type ConstantInt Uses

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

ConstantInt implements an integer token which holds a constant integer

func NewConstantInt Uses

func NewConstantInt(value int) *ConstantInt

NewConstantInt returns a new instance of a ConstantInt token

func (*ConstantInt) Clone Uses

func (p *ConstantInt) Clone() token.Token

Clone returns a copy of the token and all its children

func (*ConstantInt) Parse Uses

func (p *ConstantInt) 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 (*ConstantInt) Permutation Uses

func (p *ConstantInt) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*ConstantInt) Permutations Uses

func (p *ConstantInt) Permutations() uint

Permutations returns the number of permutations for this token

func (*ConstantInt) PermutationsAll Uses

func (p *ConstantInt) PermutationsAll() uint

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

func (*ConstantInt) SetValue Uses

func (p *ConstantInt) SetValue(v int)

SetValue sets the value of the token

func (*ConstantInt) String Uses

func (p *ConstantInt) String() string

func (*ConstantInt) Value Uses

func (p *ConstantInt) Value() int

Value returns the value of the token

type ConstantString Uses

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

ConstantString implements a string token which holds a constant string

func NewConstantString Uses

func NewConstantString(value string) *ConstantString

NewConstantString returns a new instance of a ConstantString token

func (*ConstantString) Clone Uses

func (p *ConstantString) Clone() token.Token

Clone returns a copy of the token and all its children

func (*ConstantString) Parse Uses

func (p *ConstantString) 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 (*ConstantString) Permutation Uses

func (p *ConstantString) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*ConstantString) Permutations Uses

func (p *ConstantString) Permutations() uint

Permutations returns the number of permutations for this token

func (*ConstantString) PermutationsAll Uses

func (p *ConstantString) PermutationsAll() uint

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

func (*ConstantString) String Uses

func (p *ConstantString) String() string

type Pointer Uses

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

Pointer implements a general pointer token which references a token

func NewEmptyPointer Uses

func NewEmptyPointer(typ interface{}) *Pointer

NewEmptyPointer returns a new instance of a Pointer token with a token reference type but without a referenced token

func NewPointer Uses

func NewPointer(tok token.Token) *Pointer

NewPointer returns a new instance of a Pointer token and sets the token reference type to the token's type

func NewTokenPointer Uses

func NewTokenPointer(tok token.Token) *Pointer

NewTokenPointer returns a new instance of a Pointer token with the token reference type Token but without a referenced token

func (*Pointer) Clone Uses

func (p *Pointer) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Pointer) Get Uses

func (p *Pointer) Get() token.Token

Get returns the current referenced token

func (*Pointer) InternalGet Uses

func (p *Pointer) InternalGet() token.Token

InternalGet returns the current referenced internal token

func (*Pointer) InternalLogicalRemove Uses

func (p *Pointer) 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 (*Pointer) InternalReplace Uses

func (p *Pointer) 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 (*Pointer) Minimize Uses

func (p *Pointer) 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 (*Pointer) Parse Uses

func (p *Pointer) 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 (*Pointer) Permutation Uses

func (p *Pointer) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Pointer) Permutations Uses

func (p *Pointer) Permutations() uint

Permutations returns the number of permutations for this token

func (*Pointer) PermutationsAll Uses

func (p *Pointer) PermutationsAll() uint

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

func (*Pointer) Resolve Uses

func (p *Pointer) Resolve() token.Token

Resolve returns the token which is referenced by the token, or a path of tokens

func (*Pointer) Set Uses

func (p *Pointer) Set(o token.Token) error

Set sets the referenced token which must conform to the pointers token reference type

func (*Pointer) String Uses

func (p *Pointer) String() string

type RangeInt Uses

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

RangeInt implements an integer token holding a range of integers Every permutation generates a new value within the defined range and step. For example the range 1 to 10 with step 2 can hold the integers 1, 3, 5, 7 and 9.

func NewRangeInt Uses

func NewRangeInt(from, to int) *RangeInt

NewRangeInt returns a new instance of a RangeInt token with the given range and step value of 1

func NewRangeIntWithStep Uses

func NewRangeIntWithStep(from, to, step int) *RangeInt

NewRangeIntWithStep returns a new instance of a RangeInt token with the given range and step value

func (*RangeInt) Clone Uses

func (p *RangeInt) Clone() token.Token

Clone returns a copy of the token and all its children

func (*RangeInt) From Uses

func (p *RangeInt) From() int

From returns the from value of the range

func (*RangeInt) Parse Uses

func (p *RangeInt) 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 (*RangeInt) Permutation Uses

func (p *RangeInt) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*RangeInt) Permutations Uses

func (p *RangeInt) Permutations() uint

Permutations returns the number of permutations for this token

func (*RangeInt) PermutationsAll Uses

func (p *RangeInt) PermutationsAll() uint

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

func (*RangeInt) Step Uses

func (p *RangeInt) Step() int

Step returns the step value

func (*RangeInt) String Uses

func (p *RangeInt) String() string

func (*RangeInt) To Uses

func (p *RangeInt) To() int

To returns the to value of the range

type Scope Uses

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

Scope implements a general scope token which references a token

func NewScope Uses

func NewScope(tok token.Token) *Scope

NewScope returns a new instance of a Scope token

func (*Scope) Clone Uses

func (p *Scope) Clone() token.Token

Clone returns a copy of the token and all its children

func (*Scope) Get Uses

func (p *Scope) Get() token.Token

Get returns the current referenced token

func (*Scope) InternalGet Uses

func (p *Scope) InternalGet() token.Token

InternalGet returns the current referenced internal token

func (*Scope) InternalLogicalRemove Uses

func (p *Scope) 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 (*Scope) InternalReplace Uses

func (p *Scope) 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 (*Scope) Minimize Uses

func (p *Scope) 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 (*Scope) Parse Uses

func (p *Scope) 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 (*Scope) Permutation Uses

func (p *Scope) Permutation(i uint) error

Permutation sets a specific permutation for this token

func (*Scope) Permutations Uses

func (p *Scope) Permutations() uint

Permutations returns the number of permutations for this token

func (*Scope) PermutationsAll Uses

func (p *Scope) PermutationsAll() uint

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

func (*Scope) Resolve Uses

func (p *Scope) Resolve() token.Token

Resolve returns the token which is referenced by the token, or a path of tokens

func (*Scope) Scoping Uses

func (p *Scope) Scoping() bool

Scoping returns if the token holds a new scope

func (*Scope) String Uses

func (p *Scope) String() string

Package primitives imports 10 packages (graph) and is imported by 16 packages. Updated 2018-11-29. Refresh now. Tools for package owners.