ast

package
v0.0.0-...-2109d8c Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 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

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

func IsInvalidAction

func IsInvalidAction(s string) bool

func IsInvalidEntity

func IsInvalidEntity(s string) bool

func ProcessAliases

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

func ProcessHoles

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

func ProcessRefs

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

func Quote

func Quote(str string) string

func RemoveOptionalHoles

func RemoveOptionalHoles(tree Node)

func VerifyRefs

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

func (a *AST) NewStatement()

func (*AST) StatementDone

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

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

func CollectAliases

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

func NewAliasNode

func NewAliasNode(s string) AliasNode

func (AliasNode) Alias

func (n AliasNode) Alias() string

func (AliasNode) String

func (n AliasNode) String() string

type Command

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

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

func (*CommandNode) ToFillerParams

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

type ConcatenationNode

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

func NewConcatenationNode

func NewConcatenationNode(arr []interface{}) ConcatenationNode

func (ConcatenationNode) Concat

func (n ConcatenationNode) Concat() string

func (ConcatenationNode) String

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

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

func CollectHoles

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

func NewHoleNode

func NewHoleNode(s string) HoleNode

func NewOptionalHoleNode

func NewOptionalHoleNode(s string) HoleNode

func (HoleNode) Hole

func (n HoleNode) Hole() string

func (HoleNode) IsOptional

func (n HoleNode) IsOptional() bool

func (HoleNode) String

func (n HoleNode) String() string

type InterfaceNode

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

func (InterfaceNode) String

func (n InterfaceNode) String() string

func (InterfaceNode) Value

func (n InterfaceNode) Value() interface{}

type ListNode

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

func NewListNode

func NewListNode(arr []interface{}) ListNode

func (ListNode) Elems

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

func (ListNode) String

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

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

func NewRefNode

func NewRefNode(s string) RefNode

func (RefNode) Ref

func (n RefNode) Ref() string

func (RefNode) String

func (n RefNode) String() string

type RightExpressionNode

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

func (*RightExpressionNode) Err

func (n *RightExpressionNode) Err() error

func (*RightExpressionNode) Node

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

func (*RightExpressionNode) Result

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

func (*RightExpressionNode) String

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