hclparse: rename ParseZCL to ParseHCL
This commit is contained in:
parent
46b20d40af
commit
b8b5e0be6d
@ -119,7 +119,7 @@ func processFile(fn string, in *os.File) error {
|
||||
}
|
||||
|
||||
if *check {
|
||||
_, diags := parser.ParseZCL(inSrc, fn)
|
||||
_, diags := parser.ParseHCL(inSrc, fn)
|
||||
diagWr.WriteDiagnostics(diags)
|
||||
if diags.HasErrors() {
|
||||
checkErrs = true
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/hcl2/hclparse"
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
"github.com/hashicorp/hcl2/hclparse"
|
||||
)
|
||||
|
||||
// FileResolver creates and returns a Resolver that interprets include paths
|
||||
@ -21,7 +21,7 @@ import (
|
||||
// either absolute or relative to the given basePath.
|
||||
//
|
||||
// If the path given in configuration ends with ".json" then the referenced
|
||||
// file is interpreted as JSON. Otherwise, it is interpreted as zcl native
|
||||
// file is interpreted as JSON. Otherwise, it is interpreted as HCL native
|
||||
// syntax.
|
||||
func FileResolver(baseDir string, parser *hclparse.Parser) Resolver {
|
||||
return &fileResolver{
|
||||
@ -45,7 +45,7 @@ func (r fileResolver) ResolveBodyPath(path string, refRange hcl.Range) (hcl.Body
|
||||
if strings.HasSuffix(targetFile, ".json") {
|
||||
f, diags = r.Parser.ParseJSONFile(targetFile)
|
||||
} else {
|
||||
f, diags = r.Parser.ParseZCLFile(targetFile)
|
||||
f, diags = r.Parser.ParseHCLFile(targetFile)
|
||||
}
|
||||
|
||||
return f.Body, diags
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
"github.com/hashicorp/hcl2/hcl/hclsyntax"
|
||||
"github.com/hashicorp/hcl2/hcl/json"
|
||||
"github.com/hashicorp/hcl2/hcl"
|
||||
)
|
||||
|
||||
// NOTE: This is the public interface for parsing. The actual parsers are
|
||||
@ -34,10 +34,10 @@ func NewParser() *Parser {
|
||||
}
|
||||
}
|
||||
|
||||
// ParseZCL parses the given buffer (which is assumed to have been loaded from
|
||||
// ParseHCL parses the given buffer (which is assumed to have been loaded from
|
||||
// the given filename) as a native-syntax configuration file and returns the
|
||||
// hcl.File object representing it.
|
||||
func (p *Parser) ParseZCL(src []byte, filename string) (*hcl.File, hcl.Diagnostics) {
|
||||
func (p *Parser) ParseHCL(src []byte, filename string) (*hcl.File, hcl.Diagnostics) {
|
||||
if existing := p.files[filename]; existing != nil {
|
||||
return existing, nil
|
||||
}
|
||||
@ -47,10 +47,10 @@ func (p *Parser) ParseZCL(src []byte, filename string) (*hcl.File, hcl.Diagnosti
|
||||
return file, diags
|
||||
}
|
||||
|
||||
// ParseZCLFile reads the given filename and parses it as a native-syntax zcl
|
||||
// ParseHCLFile reads the given filename and parses it as a native-syntax HCL
|
||||
// configuration file. An error diagnostic is returned if the given file
|
||||
// cannot be read.
|
||||
func (p *Parser) ParseZCLFile(filename string) (*hcl.File, hcl.Diagnostics) {
|
||||
func (p *Parser) ParseHCLFile(filename string) (*hcl.File, hcl.Diagnostics) {
|
||||
if existing := p.files[filename]; existing != nil {
|
||||
return existing, nil
|
||||
}
|
||||
@ -66,7 +66,7 @@ func (p *Parser) ParseZCLFile(filename string) (*hcl.File, hcl.Diagnostics) {
|
||||
}
|
||||
}
|
||||
|
||||
return p.ParseZCL(src, filename)
|
||||
return p.ParseHCL(src, filename)
|
||||
}
|
||||
|
||||
// ParseJSON parses the given JSON buffer (which is assumed to have been loaded
|
||||
|
Loading…
Reference in New Issue
Block a user