ast

package
v0.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SimpleStringValue = regexp.MustCompile("^[a-zA-Z0-9-._:/+;~@<>*]+$") // in sync with [a-zA-Z0-9-._:/+;~@<>]+ in PEG (with ^ and $ around)

Functions

func IsInvalidAction

func IsInvalidAction(s string) bool

func IsInvalidEntity

func IsInvalidEntity(s string) bool

Types

type AST

type AST struct {
	Statements []*Statement
	// contains filtered or unexported fields
}

func (*AST) Clone

func (a *AST) Clone() *AST

func (*AST) NewStatement added in v0.1.3

func (a *AST) NewStatement()

func (*AST) StatementDone added in v0.1.3

func (a *AST) StatementDone()

func (*AST) String

func (a *AST) String() string

type Action

type Action string
const (
	UnknownAction Action = "unknown"
	NoneAction    Action = "none"

	Create Action = "create"
	Delete Action = "delete"
	Update Action = "update"

	Check Action = "check"

	Start   Action = "start"
	Restart Action = "restart"
	Stop    Action = "stop"

	Attach Action = "attach"
	Detach Action = "detach"

	Copy Action = "copy"

	Import       Action = "import"
	Authenticate Action = "authenticate"
)

type Command added in v0.1.6

type Command interface {
	ParamsSpec() params.Spec
	Run(env.Running, map[string]interface{}) (interface{}, error)
}

type CommandNode

type CommandNode struct {
	Command
	CmdResult interface{}
	CmdErr    error

	Action, Entity string
	Params         map[string]CompositeValue
}

func (*CommandNode) Err

func (c *CommandNode) Err() error

func (*CommandNode) GetHoles added in v0.0.24

func (c *CommandNode) GetHoles() map[string]*Hole

func (*CommandNode) GetRefs added in v0.1.3

func (c *CommandNode) GetRefs() (refs []string)

func (*CommandNode) IsRef added in v0.1.3

func (c *CommandNode) IsRef(key string) bool

func (*CommandNode) Keys

func (c *CommandNode) Keys() (keys []string)

func (*CommandNode) ProcessHoles

func (c *CommandNode) ProcessHoles(fills map[string]interface{}) map[string]interface{}

func (*CommandNode) ProcessRefs

func (c *CommandNode) ProcessRefs(refs map[string]interface{})

func (*CommandNode) ReplaceRef added in v0.1.3

func (c *CommandNode) ReplaceRef(key string, value CompositeValue)

func (*CommandNode) Result

func (c *CommandNode) Result() interface{}

func (*CommandNode) String

func (c *CommandNode) String() string

func (*CommandNode) ToDriverParams added in v0.1.3

func (c *CommandNode) ToDriverParams() map[string]interface{}

func (*CommandNode) ToDriverParamsExcludingRefs added in v0.1.9

func (c *CommandNode) ToDriverParamsExcludingRefs() map[string]interface{}

func (*CommandNode) ToFillerParams added in v0.1.3

func (c *CommandNode) ToFillerParams() map[string]interface{}

type CompositeValue added in v0.1.3

type CompositeValue interface {
	String() string
	Value() interface{}
	Clone() CompositeValue
}

func NewAliasValue added in v0.1.3

func NewAliasValue(alias string) CompositeValue

func NewHoleValue added in v0.1.3

func NewHoleValue(hole string) CompositeValue

func NewInterfaceValue added in v0.1.3

func NewInterfaceValue(i interface{}) CompositeValue

func NewOptionalHoleValue added in v0.1.9

func NewOptionalHoleValue(hole string) CompositeValue

func NewReferenceValue added in v0.1.9

func NewReferenceValue(s string) CompositeValue

type DeclarationNode

type DeclarationNode struct {
	Ident string
	Expr  ExpressionNode
}

func (*DeclarationNode) String

func (n *DeclarationNode) String() string

type Entity

type Entity string

type ExpressionNode

type ExpressionNode interface {
	Node
	Result() interface{}
	Err() error
}

type Hole added in v0.1.9

type Hole struct {
	Name       string
	ParamPaths []string
	IsOptional bool
}

type Node

type Node interface {
	String() string
	// contains filtered or unexported methods
}

type Peg

type Peg struct {
	*AST

	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*Peg) AST

func (t *Peg) AST() *node32

func (*Peg) Add

func (t *Peg) Add(rule pegRule, begin, end, index uint32)

func (*Peg) Execute

func (p *Peg) Execute()

func (*Peg) Init

func (p *Peg) Init()

func (*Peg) Parse

func (p *Peg) Parse(rule ...int) error

func (*Peg) PrettyPrintSyntaxTree

func (t *Peg) PrettyPrintSyntaxTree(buffer string)

func (*Peg) Print

func (t *Peg) Print()

func (*Peg) PrintSyntaxTree

func (p *Peg) PrintSyntaxTree()

func (*Peg) Reset

func (p *Peg) Reset()

func (*Peg) Tokens

func (t *Peg) Tokens() []token32

func (*Peg) Trim

func (t *Peg) Trim(length uint32)

type Statement

type Statement struct {
	Node
}

func (*Statement) Clone

func (s *Statement) Clone() *Statement

type ValueNode added in v0.0.24

type ValueNode struct {
	Value CompositeValue
}

func (*ValueNode) Err added in v0.0.24

func (n *ValueNode) Err() error

func (*ValueNode) GetHoles added in v0.0.24

func (n *ValueNode) GetHoles() map[string]*Hole

func (*ValueNode) GetRefs added in v0.1.3

func (n *ValueNode) GetRefs() (refs []string)

func (*ValueNode) IsRef added in v0.1.3

func (n *ValueNode) IsRef(key string) bool

func (*ValueNode) IsResolved added in v0.0.24

func (n *ValueNode) IsResolved() bool

func (*ValueNode) ProcessHoles added in v0.0.24

func (n *ValueNode) ProcessHoles(fills map[string]interface{}) map[string]interface{}

func (*ValueNode) ProcessRefs added in v0.1.3

func (n *ValueNode) ProcessRefs(refs map[string]interface{})

func (*ValueNode) ReplaceRef added in v0.1.3

func (n *ValueNode) ReplaceRef(key string, value CompositeValue)

func (*ValueNode) Result added in v0.0.24

func (n *ValueNode) Result() interface{}

func (*ValueNode) String added in v0.0.24

func (n *ValueNode) String() string

type WithAlias added in v0.1.3

type WithAlias interface {
	GetAliases() []string
	ResolveAlias(func(string) (string, bool))
}

type WithHoles added in v0.0.24

type WithHoles interface {
	ProcessHoles(fills map[string]interface{}) (processed map[string]interface{})
	GetHoles() map[string]*Hole
}

type WithRefs added in v0.1.3

type WithRefs interface {
	GetRefs() []string
	ProcessRefs(map[string]interface{})
	ReplaceRef(string, CompositeValue)
	IsRef(string) bool
}

Jump to

Keyboard shortcuts

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