go1.20.5
GoThrough

parse.NodeAction

const NodeAction = iota

parse.NodeBool

const NodeBool = iota

parse.NodeBreak

const NodeBreak = iota

parse.NodeChain

const NodeChain = iota

parse.NodeCommand

const NodeCommand = iota

parse.NodeComment

const NodeComment = iota

parse.NodeContinue

const NodeContinue = iota

parse.NodeDot

const NodeDot = iota

parse.NodeField

const NodeField = iota

parse.NodeIdentifier

const NodeIdentifier = iota

parse.NodeIf

const NodeIf = iota

parse.NodeList

const NodeList = iota

parse.NodeNil

const NodeNil = iota

parse.NodeNumber

const NodeNumber = iota

parse.NodePipe

const NodePipe = iota

parse.NodeRange

const NodeRange = iota

parse.NodeString

const NodeString = iota

parse.NodeTemplate

const NodeTemplate = iota

parse.NodeText

const NodeText = iota

parse.NodeVariable

const NodeVariable = iota

parse.NodeWith

const NodeWith = iota

parse.ParseComments

const ParseComments = iota

parse.SkipFuncCheck

const SkipFuncCheck = iota

parse.Node

// A Node is an element in the parse tree. The interface is trivial. // The interface contains an unexported method so that only // types local to this package can satisfy it. type Node interface { Type() NodeType String() string // Copy does a deep copy of the Node and all its components. // To avoid type assertions, some XxxNodes also have specialized // CopyXxx methods that return *XxxNode. Copy() Node Position() Pos }

parse.IsEmptyTree

// IsEmptyTree reports whether this tree (node) is empty of everything but space or comments. func IsEmptyTree(n Node) bool

parse.New

// New allocates a new parse tree with the given name. func New(name string, funcs ...map[string]any) *Tree

parse.NewIdentifier

// NewIdentifier returns a new IdentifierNode with the given identifier name. func NewIdentifier(ident string) *IdentifierNode

parse.Parse

// Parse returns a map from template name to parse.Tree, created by parsing the // templates described in the argument string. The top-level template will be // given the specified name. If an error is encountered, parsing stops and an // empty map is returned with the error. func Parse(name string, text string, leftDelim string, rightDelim string, funcs ...map[string]any) (map[string]*Tree, error)