Documentation
¶
Overview ¶
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 zcl while remaining generally compatible with their previous configuration formats.
Index ¶
- func Parse(src []byte, filename string) (*zcl.File, zcl.Diagnostics)
- func ParseFile(filename string) (*zcl.File, zcl.Diagnostics)
- func ParseTemplate(src []byte, filename string) (zcl.Expression, zcl.Diagnostics)
- func ParseTemplateEmbedded(src []byte, filename string, startPos zcl.Pos) (zcl.Expression, zcl.Diagnostics)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
Parse attempts to parse the given buffer as HCL with HIL expressions and, if successful, returns a zcl.File for the zcl configuration represented by it.
The returned file is valid only if the returned diagnostics returns false from its HasErrors method. If HasErrors returns true, the file represents the subset of data that was able to be parsed, which may be none.
func ParseFile ¶
func ParseFile(filename string) (*zcl.File, zcl.Diagnostics)
ParseFile is a convenience wrapper around Parse that first attempts to load data from the given filename, passing the result to Parse if successful.
If the file cannot be read, an error diagnostic with nil context is returned.
func ParseTemplate ¶
func ParseTemplate(src []byte, filename string) (zcl.Expression, zcl.Diagnostics)
ParseTemplate attempts to parse the given buffer as a HIL template and, if successful, returns a zcl.Expression for the value represented by it.
The returned file is valid only if the returned diagnostics returns false from its HasErrors method. If HasErrors returns true, the file represents the subset of data that was able to be parsed, which may be none.
func ParseTemplateEmbedded ¶
func ParseTemplateEmbedded(src []byte, filename string, startPos zcl.Pos) (zcl.Expression, zcl.Diagnostics)
ParseTemplateEmbedded is like ParseTemplate but is for templates that are embedded in a file in another language. Practically-speaking this just offsets the source positions returned in diagnostics, etc to be relative to the given position.
Types ¶
This section is empty.