4 "github.com/hashicorp/hcl2/hcl/hclsyntax"
7 type Attribute struct {
16 func newAttribute() *Attribute {
22 func (a *Attribute) init(name string, expr *Expression) {
23 expr.assertUnattached()
25 nameTok := newIdentToken(name)
26 nameObj := newIdentifier(nameTok)
27 a.leadComments = a.children.Append(newComments(nil))
28 a.name = a.children.Append(nameObj)
29 a.children.AppendUnstructuredTokens(Tokens{
31 Type: hclsyntax.TokenEqual,
35 a.expr = a.children.Append(expr)
36 a.expr.list = a.children
37 a.lineComments = a.children.Append(newComments(nil))
38 a.children.AppendUnstructuredTokens(Tokens{
40 Type: hclsyntax.TokenNewline,
46 func (a *Attribute) Expr() *Expression {
47 return a.expr.content.(*Expression)