1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 07:34:43 +01:00
liquid/parser/ast.go
2017-07-07 05:51:40 -04:00

43 lines
779 B
Go

package parser
import (
"github.com/osteele/liquid/expression"
)
// ASTNode is a node of an AST.
type ASTNode interface{}
// ASTBlock represents a {% tag %}…{% endtag %}.
type ASTBlock struct {
Chunk
syntax BlockSyntax
Body []ASTNode // Body is the nodes before the first branch
Branches []*ASTBlock // E.g. else and elseif w/in an if
}
// ASTRaw holds the text between the start and end of a raw tag.
type ASTRaw struct {
Slices []string
}
// ASTTag is a tag.
type ASTTag struct {
Chunk
}
// ASTText is a text chunk, that is rendered verbatim.
type ASTText struct {
Chunk
}
// ASTObject is an {{ object }} object.
type ASTObject struct {
Chunk
Expr expression.Expression
}
// ASTSeq is a sequence of nodes.
type ASTSeq struct {
Children []ASTNode
}