constraints

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Optional

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

Optional implements a constraint and optional token which references another token which can be de(activated)

func NewOptional

func NewOptional(tok token.Token) *Optional

NewOptional returns a new instance of a Optional token referencing the given token and setting the initial state to deactivated

func (*Optional) Activate

func (c *Optional) Activate()

Activate activates this token

func (*Optional) Clone

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

Clone returns a copy of the token and all its children

func (*Optional) Deactivate

func (c *Optional) Deactivate()

Deactivate deactivates this token

func (*Optional) Get

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

Get returns the current referenced token

func (*Optional) InternalGet

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

InternalGet returns the current referenced internal token

func (*Optional) InternalLogicalRemove

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

func (c *Optional) 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 (*Optional) IsOptional

func (c *Optional) IsOptional() bool

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

func (*Optional) Parse

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

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

Permutation sets a specific permutation for this token

func (*Optional) Permutations

func (c *Optional) Permutations() uint

Permutations returns the number of permutations for this token

func (*Optional) PermutationsAll

func (c *Optional) PermutationsAll() uint

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

func (*Optional) Reduce

func (c *Optional) Reduce(i uint) error

Reduce sets a specific reduction for this token

func (*Optional) Reduces

func (c *Optional) Reduces() uint

Reduces returns the number of reductions for this token

func (*Optional) String

func (c *Optional) String() string

Jump to

Keyboard shortcuts

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