ast

package
v1.4.11 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewArrayNode

func NewArrayNode(parent Node) *arrayNode

func NewMapNode

func NewMapNode(parent Node) *mapNode

func NewMapValueNode

func NewMapValueNode(parent Node, key string) (*valueNode, error)

func NewValueNode

func NewValueNode(parent Node, value any) *valueNode

Types

type Context

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

func NewContext

func NewContext(fn EvalFunc) *Context

func (*Context) Label

func (ctx *Context) Label() types.Label

Get the label

func (*Context) Path

func (ctx *Context) Path() types.Label

Return the current path

func (*Context) SetLabel

func (ctx *Context) SetLabel(label types.Label)

Set the label

type EvalFunc

type EvalFunc func(ctx *Context, value any) (any, error)

Evaluate a value node and return the value

type Node

type Node interface {
	// Type of node
	Type() NodeType

	// Parent node
	Parent() Node

	// Node key (plugin name, map key)
	Key() string

	// Node evaluated value
	Value(ctx *Context) (any, error)

	// Child nodes
	Children() []Node

	// Add child node, and return it
	Append(Node) Node
}

type NodeType

type NodeType int
const (
	Map NodeType
	Array
	Value
)

func (NodeType) String

func (r NodeType) String() string

Jump to

Keyboard shortcuts

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