Documentation ¶
Overview ¶
Package ast contains definitions for the in-memory representation of a Soy template.
Index ¶
- type AddNode
- type AndNode
- type AutoescapeType
- type BinaryOpNode
- type BoolNode
- type CallNode
- type CallParamContentNode
- type CallParamValueNode
- type CssNode
- type DataRefExprNode
- type DataRefIndexNode
- type DataRefKeyNode
- type DataRefNode
- type DebuggerNode
- type DivNode
- type ElvisNode
- type EqNode
- type FloatNode
- type ForNode
- type FunctionNode
- type GlobalNode
- type GtNode
- type GteNode
- type HeaderParamNode
- type IdentNode
- type IfCondNode
- type IfNode
- type IntNode
- type LetContentNode
- type LetValueNode
- type ListLiteralNode
- type ListNode
- type LiteralNode
- type LogNode
- type LtNode
- type LteNode
- type MapLiteralNode
- type ModNode
- type MsgHtmlTagNode
- type MsgNode
- type MsgPlaceholderNode
- type MsgPluralCaseNode
- type MsgPluralNode
- type MulNode
- type NamespaceNode
- type NegateNode
- type Node
- type NotEqNode
- type NotNode
- type NullNode
- type OrNode
- type ParentNode
- type Pos
- type PrintDirectiveNode
- type PrintNode
- type RawTextNode
- type SoyDocNode
- type SoyDocParamNode
- type SoyFileNode
- type StringNode
- type SubNode
- type SwitchCaseNode
- type SwitchNode
- type TemplateNode
- type TernNode
- type TypeNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddNode ¶
type AddNode struct{ BinaryOpNode }
type AndNode ¶
type AndNode struct{ BinaryOpNode }
type AutoescapeType ¶
type AutoescapeType int
const ( AutoescapeUnspecified AutoescapeType = iota AutoescapeOn AutoescapeOff AutoescapeContextual )
type BinaryOpNode ¶
func (*BinaryOpNode) Children ¶
func (n *BinaryOpNode) Children() []Node
func (*BinaryOpNode) String ¶
func (n *BinaryOpNode) String() string
type CallParamContentNode ¶
func (*CallParamContentNode) Children ¶
func (n *CallParamContentNode) Children() []Node
func (*CallParamContentNode) String ¶
func (n *CallParamContentNode) String() string
type CallParamValueNode ¶
func (*CallParamValueNode) Children ¶
func (n *CallParamValueNode) Children() []Node
func (*CallParamValueNode) String ¶
func (n *CallParamValueNode) String() string
type DataRefExprNode ¶
func (*DataRefExprNode) Children ¶
func (n *DataRefExprNode) Children() []Node
func (*DataRefExprNode) String ¶
func (n *DataRefExprNode) String() string
type DataRefIndexNode ¶
func (*DataRefIndexNode) String ¶
func (n *DataRefIndexNode) String() string
type DataRefKeyNode ¶
func (*DataRefKeyNode) String ¶
func (n *DataRefKeyNode) String() string
type DataRefNode ¶
func (*DataRefNode) Children ¶
func (n *DataRefNode) Children() []Node
func (*DataRefNode) String ¶
func (n *DataRefNode) String() string
type DebuggerNode ¶
type DebuggerNode struct {
Pos
}
func (*DebuggerNode) String ¶
func (n *DebuggerNode) String() string
type DivNode ¶
type DivNode struct{ BinaryOpNode }
type ElvisNode ¶
type ElvisNode struct{ BinaryOpNode }
type EqNode ¶
type EqNode struct{ BinaryOpNode }
type ForNode ¶
Note: - "For" node may have anything as the List - "Foreach" node is required to have a DataRefNode as the List
There is no difference in the parsed representation between them. We do not bother to maintain that, because it's not important, as upstream has dropped support for {foreach} entirely, so we treat this as deprecated.
type FunctionNode ¶
func (*FunctionNode) Children ¶
func (n *FunctionNode) Children() []Node
func (*FunctionNode) String ¶
func (n *FunctionNode) String() string
type GlobalNode ¶
func (*GlobalNode) String ¶
func (n *GlobalNode) String() string
type GtNode ¶
type GtNode struct{ BinaryOpNode }
type GteNode ¶
type GteNode struct{ BinaryOpNode }
type HeaderParamNode ¶
type HeaderParamNode struct { Pos Optional bool Name string Type TypeNode // empty if inferred from the default value Default Node // nil if no default was specified }
HeaderParamNode holds a parameter declaration.
HeaderParams MUST appear at the beginning of a TemplateNode's Body.
func (*HeaderParamNode) String ¶
func (n *HeaderParamNode) String() string
type IfCondNode ¶
func (*IfCondNode) Children ¶
func (n *IfCondNode) Children() []Node
func (*IfCondNode) String ¶
func (n *IfCondNode) String() string
type IfNode ¶
type IfNode struct { Pos Conds []*IfCondNode }
type LetContentNode ¶
func (*LetContentNode) Children ¶
func (n *LetContentNode) Children() []Node
func (*LetContentNode) String ¶
func (n *LetContentNode) String() string
type LetValueNode ¶
func (*LetValueNode) Children ¶
func (n *LetValueNode) Children() []Node
func (*LetValueNode) String ¶
func (n *LetValueNode) String() string
type ListLiteralNode ¶
func (*ListLiteralNode) Children ¶
func (n *ListLiteralNode) Children() []Node
func (*ListLiteralNode) String ¶
func (n *ListLiteralNode) String() string
type LiteralNode ¶
func (*LiteralNode) String ¶
func (n *LiteralNode) String() string
type LtNode ¶
type LtNode struct{ BinaryOpNode }
type LteNode ¶
type LteNode struct{ BinaryOpNode }
type MapLiteralNode ¶
func (*MapLiteralNode) Children ¶
func (n *MapLiteralNode) Children() []Node
func (*MapLiteralNode) String ¶
func (n *MapLiteralNode) String() string
type ModNode ¶
type ModNode struct{ BinaryOpNode }
type MsgHtmlTagNode ¶
func (*MsgHtmlTagNode) String ¶
func (n *MsgHtmlTagNode) String() string
type MsgNode ¶
type MsgNode struct { Pos ID uint64 Meaning string Desc string Body ParentNode // top-level children: RawTextNode, MsgPlaceholderNode, MsgPluralNode }
MsgNode represents a localized message.
func (*MsgNode) Placeholder ¶
func (n *MsgNode) Placeholder(name string) *MsgPlaceholderNode
Placeholder returns a placeholder node with the given name within this message node. It requires placeholder names to have been calculated.
type MsgPlaceholderNode ¶
func (*MsgPlaceholderNode) Children ¶
func (n *MsgPlaceholderNode) Children() []Node
func (*MsgPlaceholderNode) String ¶
func (n *MsgPlaceholderNode) String() string
type MsgPluralCaseNode ¶
type MsgPluralCaseNode struct { Pos Value int Body ParentNode // top level children: RawTextNode, MsgPlaceholderNode }
func (*MsgPluralCaseNode) Children ¶
func (n *MsgPluralCaseNode) Children() []Node
func (*MsgPluralCaseNode) String ¶
func (n *MsgPluralCaseNode) String() string
type MsgPluralNode ¶
type MsgPluralNode struct { Pos VarName string Value Node Cases []*MsgPluralCaseNode Default ParentNode }
func (*MsgPluralNode) Children ¶
func (n *MsgPluralNode) Children() []Node
func (*MsgPluralNode) String ¶
func (n *MsgPluralNode) String() string
type MulNode ¶
type MulNode struct{ BinaryOpNode }
type NamespaceNode ¶
type NamespaceNode struct { Pos Name string Autoescape AutoescapeType }
NamespaceNode registers the namespace of the Soy file.
func (*NamespaceNode) String ¶
func (c *NamespaceNode) String() string
type NegateNode ¶
func (*NegateNode) Children ¶
func (n *NegateNode) Children() []Node
func (*NegateNode) String ¶
func (n *NegateNode) String() string
type Node ¶
type Node interface { String() string // String returns the Soy source representation of this node. Position() Pos // byte position of start of node in full original input string }
Node represents any singular piece of a Soy template. For example, a sequence of raw text or a print tag.
type NotEqNode ¶
type NotEqNode struct{ BinaryOpNode }
type OrNode ¶
type OrNode struct{ BinaryOpNode }
type ParentNode ¶
ParentNode is any Node that has descendent nodes. For example, the Children of a AddNode are the two nodes that should be added.
type Pos ¶
type Pos int
Pos represents a byte position in the original input text from which this template was parsed. It is useful to construct helpful error messages.
type PrintDirectiveNode ¶
func (*PrintDirectiveNode) Children ¶
func (n *PrintDirectiveNode) Children() []Node
func (*PrintDirectiveNode) String ¶
func (n *PrintDirectiveNode) String() string
type PrintNode ¶
type PrintNode struct { Pos Arg Node Directives []*PrintDirectiveNode }
type RawTextNode ¶
func (*RawTextNode) String ¶
func (t *RawTextNode) String() string
type SoyDocNode ¶
type SoyDocNode struct { Pos Params []*SoyDocParamNode }
func (*SoyDocNode) Children ¶
func (n *SoyDocNode) Children() []Node
func (*SoyDocNode) String ¶
func (n *SoyDocNode) String() string
type SoyDocParamNode ¶
SoyDocParam represents a parameter to a Soy template. e.g.
/** * Says hello to the person * @param name The name of the person to say hello to. */
func (*SoyDocParamNode) String ¶
func (n *SoyDocParamNode) String() string
type SoyFileNode ¶
SoyFileNode represents a Soy file.
func (SoyFileNode) Children ¶
func (n SoyFileNode) Children() []Node
func (SoyFileNode) Position ¶
func (n SoyFileNode) Position() Pos
func (SoyFileNode) String ¶
func (n SoyFileNode) String() string
type StringNode ¶
type StringNode struct { Pos Quoted string // e.g. 'hello\tworld' Value string // e.g. hello world }
func (*StringNode) String ¶
func (s *StringNode) String() string
type SubNode ¶
type SubNode struct{ BinaryOpNode }
type SwitchCaseNode ¶
func (*SwitchCaseNode) Children ¶
func (n *SwitchCaseNode) Children() []Node
func (*SwitchCaseNode) String ¶
func (n *SwitchCaseNode) String() string
type SwitchNode ¶
type SwitchNode struct { Pos Value Node Cases []*SwitchCaseNode }
func (*SwitchNode) Children ¶
func (n *SwitchNode) Children() []Node
func (*SwitchNode) String ¶
func (n *SwitchNode) String() string
type TemplateNode ¶
type TemplateNode struct { Pos Name string Body *ListNode Autoescape AutoescapeType Private bool }
TemplateNode holds a template body.
func (*TemplateNode) Children ¶
func (n *TemplateNode) Children() []Node
func (*TemplateNode) String ¶
func (n *TemplateNode) String() string