Commit Graph

4 Commits

Author SHA1 Message Date
Martin Atkins
30da06ec3f hclpack: Implement UnwrapExpression for our expressions
This allows the static analysis functions in the main HCL package to dig
through our wrapper to get the native expression object needed for most
analyses.

For example, this allows an expression with a native expression source
type whose source contains valid tuple constructor syntax to be used with
hcl.ExprList.
2018-11-11 08:34:44 -08:00
Martin Atkins
06d5709118 hclpack: Support literal JSON as an additional expression syntax
hclpack can potentially be used as an intermediary to more easily bring
non-HCL input into the HCL API, and so allowing a literal value in JSON
format as an expression type means that such a transcoder doesn't need to
worry about formatting values it encounters using HCL syntax and can
instead just encode directly to JSON, but at the expense of then not being
able to use the full expression/template syntax.
2018-11-11 08:26:37 -08:00
Martin Atkins
309e278914 hclpack: Implement JSON marshaling (but not unmarshaling, yet) 2018-11-11 03:25:19 +00:00
Martin Atkins
5e07d8e1f9 hclpack: New package for wire representations of hcl bodies
In most applications it's possible to fully evaluate configuration at the
beginning and work only with resolved values after that, but in some
unusual cases it's necessary to split parsing and decoding between two
separate processes connected by a pipe or network connection.

hclpack is intended to provide compact wire formats for sending bodies
over the network such that they can be decoded and evaluated and get the
same results. This is not something that can happen fully automatically
because a hcl.Body is an abstract node rather than a physical construct,
and so access to the original source code is required to construct such
a representation, and to interpret any source ranges that emerged from
the final evaluation.
2018-11-10 09:36:26 -08:00