Back to godoc.org

Package hclhil

v0.0.0-...-5239390
Latest Go to latest

The latest major version is .

Published: Jul 28, 2017 | License: MIT | Module: github.com/zclconf/go-zcl

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

func Parse(src []byte, filename string) (*zcl.File, zcl.Diagnostics)

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier