zclparse: Stub API for HCL/HIL file parsing
This is intended as a backward-compatibility interface, allowing applications that previously used HCL/HIL to adopt zcl while still being able to parse their old HCL/HIL-based configuration file formats.
This commit is contained in:
parent
49641f2a9a
commit
e765ff422a
8
zcl/hclhil/doc.go
Normal file
8
zcl/hclhil/doc.go
Normal file
@ -0,0 +1,8 @@
|
||||
// Package hclhil adapts Hashicorp Configuration Language and Hashicorp
|
||||
// Interpolation Language (HCL and HIL, respectively) to work within the
|
||||
// ZCL API.
|
||||
//
|
||||
// This is intended to help applications that previously used HCL/HIL to
|
||||
// gradually adopt hcl while remaining generally compatible with their
|
||||
// previous configuration formats.
|
||||
package hclhil
|
@ -47,6 +47,23 @@ func (p *Parser) ParseJSONFile(filename string) (*zcl.File, zcl.Diagnostics) {
|
||||
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.
|
||||
func (p *Parser) ParseHCLHIL(src []byte, filename string) (*zcl.File, zcl.Diagnostics) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// ParseHCLHILFile reads the given filename and parses it as HCL/HIL, similarly
|
||||
// to ParseHCLHIL. An error diagnostic is returned if the given file cannot be
|
||||
// read.
|
||||
func (p *Parser) ParseHCLHILFile(filename string) (*zcl.File, zcl.Diagnostics) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// AddFile allows a caller to record in a parser a file that was parsed some
|
||||
// other way, thus allowing it to be included in the registry of sources.
|
||||
func (p *Parser) AddFile(filename string, file *zcl.File) {
|
||||
|
Loading…
Reference in New Issue
Block a user