primitives

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CharacterClass

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

func NewCharacterClass(pattern string) *CharacterClass

NewCharacterClass returns a new instance of a CharacterClass token

func (*CharacterClass) Clone

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

Clone returns a copy of the token and all its children

func (*CharacterClass) Parse

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

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

Permutation sets a specific permutation for this token

func (*CharacterClass) Permutations

func (c *CharacterClass) Permutations() uint

Permutations returns the number of permutations for this token

func (*CharacterClass) PermutationsAll

func (c *CharacterClass) PermutationsAll() uint

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

func (*CharacterClass) String

func (c *CharacterClass) String() string

type ConstantInt

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

ConstantInt implements an integer token which holds a constant integer

func NewConstantInt

func NewConstantInt(value int) *ConstantInt

NewConstantInt returns a new instance of a ConstantInt token

func (*ConstantInt) Clone

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

Clone returns a copy of the token and all its children

func (*ConstantInt) Parse

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

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

Permutation sets a specific permutation for this token

func (*ConstantInt) Permutations

func (p *ConstantInt) Permutations() uint

Permutations returns the number of permutations for this token

func (*ConstantInt) PermutationsAll

func (p *ConstantInt) PermutationsAll() uint

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

func (*ConstantInt) SetValue

func (p *ConstantInt) SetValue(v int)

SetValue sets the value of the token

func (*ConstantInt) String

func (p *ConstantInt) String() string

func (*ConstantInt) Value

func (p *ConstantInt) Value() int

Value returns the value of the token

type ConstantString

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

ConstantString implements a string token which holds a constant string

func NewConstantString

func NewConstantString(value string) *ConstantString

NewConstantString returns a new instance of a ConstantString token

func (*ConstantString) Clone

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

Clone returns a copy of the token and all its children

func (*ConstantString) Parse

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

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

Permutation sets a specific permutation for this token

func (*ConstantString) Permutations

func (p *ConstantString) Permutations() uint

Permutations returns the number of permutations for this token

func (*ConstantString) PermutationsAll

func (p *ConstantString) PermutationsAll() uint

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

func (*ConstantString) String

func (p *ConstantString) String() string

type Pointer

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

Pointer implements a general pointer token which references a token

func NewEmptyPointer

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

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

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

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

Clone returns a copy of the token and all its children

func (*Pointer) Get

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

Get returns the current referenced token

func (*Pointer) InternalGet

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

InternalGet returns the current referenced internal token

func (*Pointer) InternalLogicalRemove

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

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

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

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

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

Permutation sets a specific permutation for this token

func (*Pointer) Permutations

func (p *Pointer) Permutations() uint

Permutations returns the number of permutations for this token

func (*Pointer) PermutationsAll

func (p *Pointer) PermutationsAll() uint

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

func (*Pointer) Resolve

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

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

func (*Pointer) Set

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

func (p *Pointer) String() string

type RangeInt

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

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

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

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

Clone returns a copy of the token and all its children

func (*RangeInt) From

func (p *RangeInt) From() int

From returns the from value of the range

func (*RangeInt) Parse

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

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

Permutation sets a specific permutation for this token

func (*RangeInt) Permutations

func (p *RangeInt) Permutations() uint

Permutations returns the number of permutations for this token

func (*RangeInt) PermutationsAll

func (p *RangeInt) PermutationsAll() uint

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

func (*RangeInt) Step

func (p *RangeInt) Step() int

Step returns the step value

func (*RangeInt) String

func (p *RangeInt) String() string

func (*RangeInt) To

func (p *RangeInt) To() int

To returns the to value of the range

type Scope

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

Scope implements a general scope token which references a token

func NewScope

func NewScope(tok token.Token) *Scope

NewScope returns a new instance of a Scope token

func (*Scope) Clone

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

Clone returns a copy of the token and all its children

func (*Scope) Get

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

Get returns the current referenced token

func (*Scope) InternalGet

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

InternalGet returns the current referenced internal token

func (*Scope) InternalLogicalRemove

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

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

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

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

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

Permutation sets a specific permutation for this token

func (*Scope) Permutations

func (p *Scope) Permutations() uint

Permutations returns the number of permutations for this token

func (*Scope) PermutationsAll

func (p *Scope) PermutationsAll() uint

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

func (*Scope) Resolve

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

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

func (*Scope) Scoping

func (p *Scope) Scoping() bool

Scoping returns if the token holds a new scope

func (*Scope) String

func (p *Scope) String() string

Jump to

Keyboard shortcuts

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