More miscellaneous renaming of ZCL to HCL.
This commit is contained in:
parent
b638b30f98
commit
5956c82199
@ -10,7 +10,7 @@ type File struct {
|
||||
Bytes []byte
|
||||
}
|
||||
|
||||
func (f *File) AsZCLFile() *hcl.File {
|
||||
func (f *File) AsHCLFile() *hcl.File {
|
||||
return &hcl.File{
|
||||
Body: f.Body,
|
||||
Bytes: f.Bytes,
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
)
|
||||
|
||||
// AsZCLBlock returns the block data expressed as a *hcl.Block.
|
||||
func (b *Block) AsZCLBlock() *hcl.Block {
|
||||
// AsHCLBlock returns the block data expressed as a *hcl.Block.
|
||||
func (b *Block) AsHCLBlock() *hcl.Block {
|
||||
lastHeaderRange := b.TypeRange
|
||||
if len(b.LabelRanges) > 0 {
|
||||
lastHeaderRange = b.LabelRanges[len(b.LabelRanges)-1]
|
||||
@ -52,11 +52,11 @@ func (b *Body) Range() hcl.Range {
|
||||
}
|
||||
|
||||
func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics) {
|
||||
content, remainZCL, diags := b.PartialContent(schema)
|
||||
content, remainHCL, diags := b.PartialContent(schema)
|
||||
|
||||
// No we'll see if anything actually remains, to produce errors about
|
||||
// extraneous items.
|
||||
remain := remainZCL.(*Body)
|
||||
remain := remainHCL.(*Body)
|
||||
|
||||
for name, attr := range b.Attributes {
|
||||
if _, hidden := remain.hiddenAttrs[name]; !hidden {
|
||||
@ -156,7 +156,7 @@ func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Bod
|
||||
}
|
||||
|
||||
hiddenAttrs[name] = struct{}{}
|
||||
attrs[name] = attr.AsZCLAttribute()
|
||||
attrs[name] = attr.AsHCLAttribute()
|
||||
}
|
||||
|
||||
blocksWanted := make(map[string]hcl.BlockHeaderSchema)
|
||||
@ -215,7 +215,7 @@ func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Bod
|
||||
continue
|
||||
}
|
||||
|
||||
blocks = append(blocks, block.AsZCLBlock())
|
||||
blocks = append(blocks, block.AsHCLBlock())
|
||||
}
|
||||
|
||||
// We hide blocks only after we've processed all of them, since otherwise
|
||||
@ -268,7 +268,7 @@ func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) {
|
||||
if _, hidden := b.hiddenAttrs[name]; hidden {
|
||||
continue
|
||||
}
|
||||
attrs[name] = attr.AsZCLAttribute()
|
||||
attrs[name] = attr.AsHCLAttribute()
|
||||
}
|
||||
|
||||
return attrs, diags
|
||||
@ -324,8 +324,8 @@ func (a *Attribute) Range() hcl.Range {
|
||||
return a.SrcRange
|
||||
}
|
||||
|
||||
// AsZCLAttribute returns the block data expressed as a *hcl.Attribute.
|
||||
func (a *Attribute) AsZCLAttribute() *hcl.Attribute {
|
||||
// AsHCLAttribute returns the block data expressed as a *hcl.Attribute.
|
||||
func (a *Attribute) AsHCLAttribute() *hcl.Attribute {
|
||||
return &hcl.Attribute{
|
||||
Name: a.Name,
|
||||
Expr: a.Expr,
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
)
|
||||
|
||||
// Token represents a sequence of bytes from some zcl code that has been
|
||||
// Token represents a sequence of bytes from some HCL code that has been
|
||||
// tagged with a type and its range within the source file.
|
||||
type Token struct {
|
||||
Type TokenType
|
||||
@ -82,7 +82,7 @@ const (
|
||||
// The rest are not used in the language but recognized by the scanner so
|
||||
// we can generate good diagnostics in the parser when users try to write
|
||||
// things that might work in other languages they are familiar with, or
|
||||
// simply make incorrect assumptions about the zcl language.
|
||||
// simply make incorrect assumptions about the HCL language.
|
||||
|
||||
TokenBitwiseAnd TokenType = '&'
|
||||
TokenBitwiseOr TokenType = '|'
|
||||
@ -102,7 +102,7 @@ const (
|
||||
)
|
||||
|
||||
func (t TokenType) GoString() string {
|
||||
return fmt.Sprintf("zclsyntax.%s", t.String())
|
||||
return fmt.Sprintf("hclsyntax.%s", t.String())
|
||||
}
|
||||
|
||||
type scanMode int
|
||||
@ -160,7 +160,7 @@ type heredocInProgress struct {
|
||||
}
|
||||
|
||||
// checkInvalidTokens does a simple pass across the given tokens and generates
|
||||
// diagnostics for tokens that should _never_ appear in ZCL source. This
|
||||
// diagnostics for tokens that should _never_ appear in HCL source. This
|
||||
// is intended to avoid the need for the parser to have special support
|
||||
// for them all over.
|
||||
//
|
||||
|
@ -4,12 +4,12 @@ import (
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
)
|
||||
|
||||
// File is the top-level node that results from parsing a ZCL file.
|
||||
// File is the top-level node that results from parsing a HCL file.
|
||||
type File struct {
|
||||
Body Body
|
||||
Bytes []byte
|
||||
|
||||
// Nav is used to integrate with the "zcled" editor integration package,
|
||||
// Nav is used to integrate with the "hcled" editor integration package,
|
||||
// and with diagnostic information formatters. It is not for direct use
|
||||
// by a calling application.
|
||||
Nav interface{}
|
||||
|
Loading…
Reference in New Issue
Block a user