Commit Graph

3 Commits

Author SHA1 Message Date
Martin Atkins 6c4344623b Unfold the "hcl" directory up into the root
The main HCL package is more visible this way, and so it's easier than
having to pick it out from dozens of other package directories.
2019-09-09 16:08:19 -07:00
Martin Atkins 3327dee567 Change module path to github.com/hashicorp/hcl/v2
This is in preparation for the first v2 release from the main HCL
repository.
2019-09-09 15:46:40 -07:00
Martin Atkins be66a72aa8 ext/typeexpr: HCL extension for "type expressions"
This uses the expression static analysis features to interpret
a combination of static calls and static traversals as the description
of a type.

This is intended for situations where applications need to accept type
information from their end-users, providing a concise syntax for doing
so.

Since this is implemented using static analysis, the type vocabulary is
constrained only to keywords representing primitive types and type
construction functions for complex types. No other expression elements
are allowed.

A separate function is provided for parsing type constraints, which allows
the additonal keyword "any" to represent the dynamic pseudo-type.

Finally, a helper function is provided to convert a type back into a
string representation resembling the original input, as an aid to
applications that need to produce error messages relating to user-entered
types.
2018-03-04 14:45:25 -08:00