func (p *Parser) ParseHCLHIL(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := hclhil.Parse(src, filename)
	p.files[filename] = file
	return file, diags
}
ParseHCLHIL parses the given buffer (which is assumed to have been loaded
from the given filename) using the HCL and HIL parsers, and returns the
zcl.File object representing it.

This HCL/HIL parser is a compatibility interface to ease migration for
apps that previously used HCL and HIL directly.
package zclparse
import (
	"fmt"
	"io/ioutil"
	"github.com/zclconf/go-zcl/zcl"
	"github.com/zclconf/go-zcl/zcl/hclhil"
	"github.com/zclconf/go-zcl/zcl/json"
	"github.com/zclconf/go-zcl/zcl/zclsyntax"
)
type Parser struct {
	files map[string]*zcl.File
}
func NewParser() *Parser {
	return &Parser{
		files: map[string]*zcl.File{},
	}
}
func (p *Parser) ParseZCL(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := zclsyntax.ParseConfig(src, filename, zcl.Pos{Byte: 0, Line: 1, Column: 1})
	p.files[filename] = file
	return file, diags
}
func (p *Parser) ParseZCLFile(filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	src, err := ioutil.ReadFile(filename)
	if err != nil {
		return nil, zcl.Diagnostics{
			{
				Severity: zcl.DiagError,
				Summary:  "Failed to read file",
				Detail:   fmt.Sprintf("The configuration file %q could not be read.", filename),
			},
		}
	}
	return p.ParseZCL(src, filename)
}
func (p *Parser) ParseJSON(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := json.Parse(src, filename)
	p.files[filename] = file
	return file, diags
}
func (p *Parser) ParseJSONWithHIL(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := json.ParseWithHIL(src, filename)
	p.files[filename] = file
	return file, diags
}
func (p *Parser) ParseJSONFile(filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := json.ParseFile(filename)
	p.files[filename] = file
	return file, diags
}
func (p *Parser) ParseJSONFileWithHIL(filename string) (*zcl.File, zcl.Diagnostics) {
	if existing := p.files[filename]; existing != nil {
		return existing, nil
	}
	file, diags := json.ParseFileWithHIL(filename)
	p.files[filename] = file
	return file, diags
}