Documentation ¶
Overview ¶
Package hclgen generates formatted HCL from ASTs.
Index ¶
- func AttributeEquiv(a, b *hclsyntax.Attribute) bool
- func AttributesEquiv(a, b hclsyntax.Attributes) bool
- func BlockEquiv(a, b *hclsyntax.Block) bool
- func BlocksEquiv(a, b hclsyntax.Blocks) bool
- func BodyEquiv(a, b hcl.Body) bool
- func ExpressionEquiv(a, b hcl.Expression) bool
- func FileEquiv(a, b *hcl.File) bool
- func FormatBlock(block *hcl.Block) []byte
- func FormatExpression(x hclsyntax.Expression) []byte
- func FormatFile(f *File) []byte
- func LabelsEquiv(a, b []string) bool
- func NewIdentifier(name string, rng hcl.Range) *hclsyntax.ScopeTraversalExpr
- func NewNullLiteral(rng hcl.Range) *hclsyntax.LiteralValueExpr
- func NewObjStringKey(name string, rng hcl.Range) hclsyntax.Expression
- func NewStringLiteral(s string, rng hcl.Range) *hclsyntax.TemplateExpr
- func NewTuple(exprs []hclsyntax.Expression, rng hcl.Range) *hclsyntax.TupleConsExpr
- func TokensForExpression(x hclsyntax.Expression) hclwrite.Tokens
- func WriteTo(w io.Writer, f *File) (int64, error)
- type Attribute
- type Attributes
- type Block
- type Body
- func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics)
- func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics)
- func (b *Body) MissingItemRange() hcl.Range
- func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics)
- func (b *Body) SyntaxAttributes() hclsyntax.Attributes
- func (b *Body) SyntaxBlocks() []*hclsyntax.Block
- func (b *Body) SyntaxBody() *hclsyntax.Body
- type Expression
- type File
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributeEquiv ¶
func AttributesEquiv ¶
func AttributesEquiv(a, b hclsyntax.Attributes) bool
func BlockEquiv ¶
func BlocksEquiv ¶
func ExpressionEquiv ¶
func ExpressionEquiv(a, b hcl.Expression) bool
func FormatBlock ¶
func FormatBlock(block *hcl.Block) []byte
func FormatExpression ¶
func FormatExpression(x hclsyntax.Expression) []byte
func FormatFile ¶
func LabelsEquiv ¶
func NewIdentifier ¶
func NewIdentifier(name string, rng hcl.Range) *hclsyntax.ScopeTraversalExpr
func NewNullLiteral ¶
func NewNullLiteral(rng hcl.Range) *hclsyntax.LiteralValueExpr
func NewObjStringKey ¶
func NewObjStringKey(name string, rng hcl.Range) hclsyntax.Expression
func NewStringLiteral ¶
func NewStringLiteral(s string, rng hcl.Range) *hclsyntax.TemplateExpr
func NewTuple ¶
func NewTuple(exprs []hclsyntax.Expression, rng hcl.Range) *hclsyntax.TupleConsExpr
func TokensForExpression ¶
func TokensForExpression(x hclsyntax.Expression) hclwrite.Tokens
Types ¶
type Attribute ¶
func AttributeFromStructure ¶
func AttributeFromStructure(attribute *hcl.Attribute) *Attribute
type Attributes ¶
type Attributes []*Attribute
func AttributesFromStructure ¶
func AttributesFromStructure(attributes hcl.Attributes) Attributes
func AttributesFromSytnax ¶
func AttributesFromSytnax(attributes hclsyntax.Attributes) Attributes
func (Attributes) Len ¶
func (a Attributes) Len() int
func (Attributes) Less ¶
func (a Attributes) Less(i, j int) bool
Try to preserve the source code order, but fallback to alphabetical.
func (Attributes) Swap ¶
func (a Attributes) Swap(i, j int)
type Block ¶
type Block struct { Type string Labels []string Body *Body TypeRange hcl.Range LabelRanges []hcl.Range OpenBraceRange hcl.Range CloseBraceRange hcl.Range }
func BlockFromStructure ¶
func BlockFromStructure(block *hcl.Block) *Block
func BlockFromSyntax ¶
func BlocksFromStructure ¶
func BlocksFromStructure(blocks []*hcl.Block) []*Block
func BlocksFromSyntax ¶
func (*Block) SyntaxBlock ¶
type Body ¶
type Body struct { Attributes []*hclsyntax.Attribute Blocks []*Block SrcRange hcl.Range EndRange hcl.Range }
func BodyFromStructure ¶
func BodyFromStructure(body hcl.Body) *Body
func BodyFromSyntax ¶
func (*Body) Content ¶
func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics)
func (*Body) JustAttributes ¶
func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics)
func (*Body) MissingItemRange ¶
func (b *Body) MissingItemRange() hcl.Range
func (*Body) PartialContent ¶
func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics)
func (*Body) SyntaxAttributes ¶
func (b *Body) SyntaxAttributes() hclsyntax.Attributes
func (*Body) SyntaxBlocks ¶
func (*Body) SyntaxBody ¶
type Expression ¶
type Expression = hclsyntax.Expression
func ExpressionFromStructure ¶
func ExpressionFromStructure(expr hcl.Expression) Expression
Click to show internal directories.
Click to hide internal directories.