ast

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2018 License: Apache-2.0 Imports: 10 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 CollectUniqueHoles added in v0.1.10

func CollectUniqueHoles(tree Node) map[HoleNode][]string

func IsInvalidAction

func IsInvalidAction(s string) bool

func IsInvalidEntity

func IsInvalidEntity(s string) bool

func ProcessAliases added in v0.1.10

func ProcessAliases(tree Node, aliasFunc func(action, entity string, key string) func(string) (string, bool))

func ProcessHoles added in v0.1.10

func ProcessHoles(tree Node, fillers map[string]interface{}) map[string]interface{}

func ProcessRefs added in v0.1.10

func ProcessRefs(tree Node, fillers map[string]interface{})

func Quote added in v0.1.10

func Quote(str string) string

func RemoveOptionalHoles added in v0.1.10

func RemoveOptionalHoles(tree Node)

func VerifyRefs added in v0.1.10

func VerifyRefs(tree Node) error

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 AliasNode added in v0.1.10

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

func CollectAliases added in v0.1.10

func CollectAliases(tree Node) (aliases []AliasNode)

func NewAliasNode added in v0.1.10

func NewAliasNode(s string) AliasNode

func (AliasNode) Alias added in v0.1.10

func (n AliasNode) Alias() string

func (AliasNode) String added in v0.1.10

func (n AliasNode) String() string

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
	ParamNodes     map[string]interface{}
	Refs           map[string]interface{}
}

func (*CommandNode) Err

func (c *CommandNode) Err() error

func (*CommandNode) Keys

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

func (*CommandNode) ProcessRefs

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

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) ToFillerParams added in v0.1.3

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

type CompiledCommand added in v0.1.10

type CompiledCommand struct {
	Params map[string]interface{}
	Refs   map[string]string
}

type ConcatenationNode added in v0.1.10

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

func NewConcatenationNode added in v0.1.10

func NewConcatenationNode(arr []interface{}) ConcatenationNode

func (ConcatenationNode) Concat added in v0.1.10

func (n ConcatenationNode) Concat() string

func (ConcatenationNode) String added in v0.1.10

func (n ConcatenationNode) String() string

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 HoleNode added in v0.1.10

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

func CollectHoles added in v0.1.10

func CollectHoles(tree Node) (holes []HoleNode)

func NewHoleNode added in v0.1.10

func NewHoleNode(s string) HoleNode

func NewOptionalHoleNode added in v0.1.10

func NewOptionalHoleNode(s string) HoleNode

func (HoleNode) Hole added in v0.1.10

func (n HoleNode) Hole() string

func (HoleNode) IsOptional added in v0.1.10

func (n HoleNode) IsOptional() bool

func (HoleNode) String added in v0.1.10

func (n HoleNode) String() string

type InterfaceNode added in v0.1.10

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

func (InterfaceNode) String added in v0.1.10

func (n InterfaceNode) String() string

func (InterfaceNode) Value added in v0.1.10

func (n InterfaceNode) Value() interface{}

type ListNode added in v0.1.10

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

func NewListNode added in v0.1.10

func NewListNode(arr []interface{}) ListNode

func (ListNode) Elems added in v0.1.10

func (n ListNode) Elems() []interface{}

func (ListNode) String added in v0.1.10

func (n ListNode) String() string

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 RefNode added in v0.1.10

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

func NewRefNode added in v0.1.10

func NewRefNode(s string) RefNode

func (RefNode) Ref added in v0.1.10

func (n RefNode) Ref() string

func (RefNode) String added in v0.1.10

func (n RefNode) String() string

type RightExpressionNode added in v0.1.10

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

func (*RightExpressionNode) Err added in v0.1.10

func (n *RightExpressionNode) Err() error

func (*RightExpressionNode) Node added in v0.1.10

func (n *RightExpressionNode) Node() interface{}

func (*RightExpressionNode) Result added in v0.1.10

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

func (*RightExpressionNode) String added in v0.1.10

func (n *RightExpressionNode) String() string

type Statement

type Statement struct {
	Node
}

func (*Statement) Clone

func (s *Statement) Clone() *Statement

Jump to

Keyboard shortcuts

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