Commit Graph

1232 Commits

Author SHA1 Message Date
John Flores 87e23659ab README: Fix specification file links 2019-10-03 09:23:15 -07:00
Martin Atkins a545295bc8
README: Fix incorrect link to Version Selection guide 2019-10-02 08:03:34 -07:00
Martin Atkins 181452c162 CHANGELOG: prepare for next release 2019-10-02 08:00:16 -07:00
Martin Atkins 4e12e081a1 Release v2.0.0 2019-10-02 07:58:32 -07:00
Martin Atkins 763cf0ee1e README: Link to the version selection guide 2019-10-02 07:54:25 -07:00
Martin Atkins 9e36050dd7 CHANGELOG: Some small tweaks prior to v2.0.0 release 2019-10-02 07:47:30 -07:00
Martin Atkins 46f91bd139 README: include a short Go example using the hclsimple API 2019-10-01 16:20:52 -07:00
Martin Atkins 34955ebf80 hclsimple: Simple one-shot parse/decode/evaluate API
For programs that don't need fine control over the process of decoding a
configuration, this allow a one-shot decode into a value of a Go struct
type.
2019-10-01 16:18:16 -07:00
Martin Atkins b0134908b0 hclwrite: Allow removing attributes and blocks from bodies
Previously we allowed adding both attributes and blocks, and we allowed
updating attributes, but we had no mechanism to surgically remove
attributes and blocks altogether.
2019-10-01 15:59:10 -07:00
Masayuki Morita 9d1235a5b4 hclwrite: Allow selecting blocks for updating 2019-10-01 15:59:10 -07:00
Martin Atkins ed70541558 hclsyntax: Include legacy index syntax in the specification 2019-10-01 15:59:10 -07:00
Martin Atkins 2c66cf702c hclsyntax: Additional tests for template sequence escapes
In previous versions we had some bugs around template sequence escapes.
These tests show that they no longer seem to be present, and should
hopefully avoid them regressing in future.
2019-10-01 15:59:10 -07:00
Martin Atkins 22ba006718 hclsyntax: Allow parens to force mapping key to be expression
Our error message for the ambiguous situation recommends doing this, but
the parser didn't actually previously allow it. Now we'll accept the form
that the error message recommends.

As before, we also accept a template with an interpolation sequence as
a disambiguation, but the error message doesn't mention that because it's
no longer idiomatic to use an inline string template containing just a
single interpolation sequence.
2019-10-01 15:59:10 -07:00
Martin Atkins ee38c67330 specsuite: Tests for the expression language operators 2019-10-01 15:59:10 -07:00
Martin Atkins 48fbad7bf4 specsuite: tests for primitive type literals 2019-10-01 15:59:10 -07:00
Martin Atkins 791068cd07 cmd/hclspecsuite: run hcldec with --keep-nulls
This gives us a more precise picture of the result, which is helpful to
ensure our tests are not "cheating".
2019-10-01 15:59:10 -07:00
Martin Atkins c366498686 cmd/hcldec: Allow overriding the removal of nulls
We remove properties whose values are null by default in order to produce
output that is more convenient to consume in the common case.

However, sometimes those nulls are significant, so we'll allow the user
to opt in to retaining them, at the expense of producing a result that is
more noisy if the spec contains lots of optional attributes that are not
set.
2019-10-01 15:59:10 -07:00
Martin Atkins af5f398dc0 go get github.com/zclconf/go-cty@v1.1.0 2019-10-01 15:59:10 -07:00
Martin Atkins 75cf5ded6e hclsyntax: Correct specification of the interpretation of tabs
This changed during development as we iterated on the prototype, but the
spec is lagging behind.
2019-10-01 15:59:10 -07:00
Martin Atkins 938b3d3319 build: Simplify Circle-CI run; use Go Module proxy 2019-10-01 15:59:10 -07:00
Martin Atkins 18eab5520f build: Use home directory for Circle-CI test run 2019-10-01 15:59:10 -07:00
Martin Atkins d2dae93c75 build: Disable codecov reporting in Circle-CI for now
This isn't currently enabled for our organization.
2019-10-01 15:59:10 -07:00
Martin Atkins 4755f8bf41 json: Clarify that this package is not interesting to import 2019-10-01 15:59:10 -07:00
Martin Atkins 76cda0e2aa build: Switch from Travis-CI to Circle-CI 2019-10-01 15:59:10 -07:00
Martin Atkins c29bdc1243 hclparse: Go package documentation 2019-10-01 15:59:10 -07:00
Martin Atkins dca4accff0 ext/dynblock: Go package documentation 2019-10-01 15:59:10 -07:00
Martin Atkins b26a9bb7be Add a CHANGELOG 2019-10-01 15:59:10 -07:00
Martin Atkins 6c43130979 specsuite: Move the Go testing stub into the specsuite directory
The separate "spectests" directory was an artifact of our former nesting
of the main package under a "hcl" directory. However, it was confusing
to have both specsuite and spectests directories at the top level, so
instead we'll just conflate these two by putting the automatic Go testing
helper into the specsuite directory.
2019-10-01 15:59:10 -07:00
Martin Atkins 8617b7c8c4 extras/grammar: Remove
These grammar files are not yet feature-complete and so we'll remove them
for now until such time that we're ready to support them.

The main blocker here is in lacking a good testing procedure for updates
to these. While in principle they can be loaded into a number of different
text editors, that is a very manual process that often requires a high
degree of familiarity with the extension API. In order to support these
properly we'd instead need some sort of automatic test suite which can
run various inputs through these rulesets and check that the resulting
tokenization.
2019-10-01 15:59:10 -07:00
Martin Atkins 691f9eea1a ext/include: Remove
This experimental extension is not ready to be included in a release. It
ought to be reworked so that "include" blocks get replaced with what they
include _in-place_, preserving the relative ordering of blocks.

However, there is no application making use of this yet and so we'll defer
that work until there's a real use-case to evaluate it with.
2019-09-10 10:49:36 -07:00
Martin Atkins a0458905ff Update README to reflect that HCL 2 is not experimental anymore 2019-09-09 16:19:38 -07:00
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 0f5ab3bd56 hclpack: Remove
This package remains highly experimental, and so we'll remove it for now
and consider spinning it off into its own repository for further iteration
if the direction seems promising.
2019-09-09 15:46:40 -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 af14e80638 HCL 2.0 replaces HCL 1.0
This is the first step in bringing HCL 2 into the main HCL repository.
Subsequent commits will prune and reorganize this in preparation for
an initial tagged HCL 2 release.
2019-09-09 15:35:18 -07:00
Boris Schrijver 66c59f909e build: Travis-CI testing against Go 1.11 and 1.12 2019-09-09 13:25:36 -07:00
Masayuki Morita 388af45637 hclwrite: Unquoted label should be parsed as *identifier 2019-09-09 13:16:13 -07:00
Radek Simko 0c888d1241 deps: Bump github.com/go-test/deep to 1.0.3 2019-08-21 13:32:43 +01:00
Kazuma Watanabe 72d32879a5 hclwrite: Do not add spaces before template control sequences 2019-08-09 14:00:04 -07:00
Aaron Gallagher 65731f3310 specsuite: tests for flush heredocs with empty lines 2019-08-05 16:24:22 -07:00
nozaq 0c3fe388e4 hclwrite: Fix heredocs never close during format
Waiting for TokenCHeredoc never ends since scanTokens() does not
 produce
 TokenNewlines inside heredocs.

 Related Issue: hashicorp/terraform#21434
2019-07-24 18:06:14 -07:00
nozaq 984d1e8201 hclwrite: Fix improper indent calculation inside heredocs (#107) 2019-07-22 15:57:18 -04:00
Antti Kupila 7fc56095bc hcl: fix minor typos in docs (#71) 2019-07-22 15:50:37 -04:00
Masayuki Morita 57bd5f374f Fix typos (#85) 2019-07-22 15:50:19 -04:00
Buck Doyle 6b2febac15 Remove incorrect quotes around types in examples (#119)
When I tried a spec with quoted types, I got this error:
`A type is required, not string.`

Later in the document, the types don’t have quotes, so I figured that’s what’s expected.
2019-07-22 15:49:22 -04:00
James Bardin 618463aa79
ensure correct type in conditionals w/ DynamicVal (#118)
If an expression in a conditional contains a DynamicVal, we know that
the opposing condition can pass through with no conversion since
converting to a DynamicPseudoType is a noop. We can also just pass
through the Dynamic val, since it is unknown and can't be converted.
2019-07-18 20:26:11 -04:00
James Bardin 5b39d9ff3a
Expect correct type from a conditional with nulls (#116)
The type unification done when evaluating a conditional normally needs
to return a DynamicPseudoType when either condition is dynamic. However,
a null dynamic value represents a known value of the desired type rather
than an unknown type, and we can be certain that it is convertible to
the desired type during the final evaluation.  Rather than unifying
types against nulls, directly assign the needed conversion when
evaluating the conditional.
2019-07-02 14:56:34 -04:00
Martin Atkins 0b64543c96 hclsyntax: Parse indexing brackets with a string literal as a traversal
A sequence like "foo" is represented in the AST as a TemplateExpr with a
single string literal inside rather than as a string literal node
directly, so we need to recognize that situation during parsing and treat
it as a special case so we can get the intended behavior of representing
that index as a traversal step rather than as a dynamic index operation.

Most of the time this distinction doesn't matter, but it's important for
static analysis use-cases. In particular, hcl.AbsTraversalForExpr will now
accept an expression like foo["bar"] where before it would've rejected it.

This also includes a better error message for when an expression cannot be
recognized as a single traversal. There isn't really any context here to
return a direct reference to the construct that was problematic, which is
what we'd ideally do, but at least this new message includes a summary
of what is allowed and some examples of things that are not allowed as an
aid to understanding what "static variable reference" means.
2019-06-18 09:38:56 -07:00
Mahmood Ali 4fba5e1a75
return array value evaluation diagnostics (#113)
Fix a bug where diagnostics found when evaluating array individual
elements are ignored, resulting in suppressed errors.

Nomad observed this issue in https://github.com/hashicorp/nomad/issues/5694.
2019-06-17 12:00:22 -04:00
Lang Martin cf7d376da9
Merge pull request #277 from hashicorp/decode-string-booleans
Decode string booleans
2019-06-11 08:32:18 -04:00