terraform/config/lang/ast/ast.go

26 lines
646 B
Go
Raw Normal View History

2015-01-11 21:38:45 +01:00
package ast
// Node is the interface that all AST nodes must implement.
2015-01-12 00:26:54 +01:00
type Node interface {
// Accept is called to dispatch to the visitors.
Accept(Visitor)
}
// Visitors are just implementations of this function.
//
// Note that this isn't a true implementation of the visitor pattern, which
// generally requires proper type dispatch on the function. However,
// implementing this basic visitor pattern style is still very useful even
// if you have to type switch.
type Visitor func(Node)
2015-01-11 21:38:45 +01:00
//go:generate stringer -type=Type
2015-01-11 21:38:45 +01:00
// Type is the type of a literal.
type Type uint
const (
2015-01-12 00:26:54 +01:00
TypeInvalid Type = 0
TypeString = 1 << iota
2015-01-11 21:38:45 +01:00
)