MCPcopy
hub / github.com/hashicorp/hcl / ParseHCL

Method ParseHCL

hclparse/parser.go:55–63  ·  view source on GitHub ↗

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.

(src []byte, filename string)

Source from the content-addressed store, hash-verified

53// the given filename) as a native-syntax configuration file and returns the
54// hcl.File object representing it.
55func (p *Parser) ParseHCL(src []byte, filename string) (*hcl.File, hcl.Diagnostics) {
56 if existing := p.files[filename]; existing != nil {
57 return existing, nil
58 }
59
60 file, diags := hclsyntax.ParseConfig(src, filename, hcl.Pos{Byte: 0, Line: 1, Column: 1})
61 p.files[filename] = file
62 return file, diags
63}
64
65// ParseHCLFile reads the given filename and parses it as a native-syntax HCL
66// configuration file. An error diagnostic is returned if the given file

Callers 3

ParseHCLFileMethod · 0.95
processFileFunction · 0.80
realmainFunction · 0.80

Calls 1

ParseConfigFunction · 0.92

Tested by

no test coverage detected