Skip to content

Commit

Permalink
hclparse: rename ParseZCL to ParseHCL
Browse files Browse the repository at this point in the history
  • Loading branch information
apparentlymart committed Sep 12, 2017
1 parent 46b20d4 commit b8b5e0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/hclfmt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ext/include/file_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions hclparse/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit b8b5e0b

Please sign in to comment.