From b8b5e0be6dbd5129c12602f5e851f088b6d8ade8 Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 11 Sep 2017 17:22:10 -0700 Subject: [PATCH] hclparse: rename ParseZCL to ParseHCL --- cmd/hclfmt/main.go | 2 +- ext/include/file_resolver.go | 6 +++--- hclparse/parser.go | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cmd/hclfmt/main.go b/cmd/hclfmt/main.go index 12f89b0..cb9a1fe 100644 --- a/cmd/hclfmt/main.go +++ b/cmd/hclfmt/main.go @@ -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 diff --git a/ext/include/file_resolver.go b/ext/include/file_resolver.go index fc929b3..c79a094 100644 --- a/ext/include/file_resolver.go +++ b/ext/include/file_resolver.go @@ -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 diff --git a/hclparse/parser.go b/hclparse/parser.go index 275119f..6d47f12 100644 --- a/hclparse/parser.go +++ b/hclparse/parser.go @@ -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