Documentation
¶
Overview ¶
Package tree defines the configuration tree shared by all pipeline stages. Each Node stores raw text, its matched schema definition, captured fields, a source line, an optional raw block body, and a remediation operation. OpNone is the zero value so ordinary nodes have no remediation operation.
A remediation Change can refer to nodes in caller-owned source trees. These references are read-only. Mutation helpers support transforms and folds. CloneValue copies value state but clears the source line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Node ¶
type Node struct {
Text string
Def *schema.Node // The matched schema node, or nil when unknown.
Fields map[string]string // Captured argument values; live, not a copy.
RealIndent int // Raw parsed indentation column.
Line int // A 1-based source line, or zero when absent.
Op Op // The remediation operation.
Block []string // Raw block body lines, or nil for ordinary nodes.
// Parent and Children are maintained by AddChild, ReplaceChild, and InsertChildBefore.
Parent *Node
Children []*Node
}
Node stores one parsed configuration line and its children.
func (*Node) CloneValue ¶
CloneValue deep-copies value state into an unparented node without children, operation, indentation, or source line.
func (*Node) InsertChildBefore ¶
InsertChildBefore inserts parentless c before child ref and retains ref.
func (*Node) ReplaceChild ¶
ReplaceChild replaces old with zero or more parentless nodes.
func (*Node) SetValueFrom ¶
SetValueFrom deep-copies src value state while preserving this node's tree position and children.