Documentation ¶
Index ¶
- type Optional
- func (c *Optional) Activate()
- func (c *Optional) Clone() token.Token
- func (c *Optional) Deactivate()
- func (c *Optional) Get() token.Token
- func (c *Optional) InternalGet() token.Token
- func (c *Optional) InternalLogicalRemove(tok token.Token) token.Token
- func (c *Optional) InternalReplace(oldToken, newToken token.Token) error
- func (c *Optional) IsOptional() bool
- func (c *Optional) Parse(pars *token.InternalParser, cur int) (int, []error)
- func (c *Optional) Permutation(i uint) error
- func (c *Optional) Permutations() uint
- func (c *Optional) PermutationsAll() uint
- func (c *Optional) Reduce(i uint) error
- func (c *Optional) Reduces() uint
- func (c *Optional) String() string
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 ¶
NewOptional returns a new instance of a Optional token referencing the given token and setting the initial state to deactivated
func (*Optional) InternalGet ¶
InternalGet returns the current referenced internal token
func (*Optional) InternalLogicalRemove ¶
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 ¶
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 ¶
IsOptional checks dynamically if this token is in the current state optional
func (*Optional) Parse ¶
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 ¶
Permutation sets a specific permutation for this token
func (*Optional) Permutations ¶
Permutations returns the number of permutations for this token
func (*Optional) PermutationsAll ¶
PermutationsAll returns the number of all possible permutations for this token including its children