Mitchell Hashimoto
8d4635e72c
hcl/parser: literal elements in a list can have a lead comment
2016-10-08 14:40:39 +08:00
Mitchell Hashimoto
7d7bae6bc1
hcl/parser: line comment tests for list items
2016-10-08 14:33:53 +08:00
Seth Vargo
d89a50c879
Merge pull request #155 from hashicorp/sethvargo/it
...
Add issue template
2016-10-08 11:47:34 +08:00
Mitchell Hashimoto
0296f28f71
Merge pull request #156 from hashicorp/b-bare-newlines
...
hcl/printer: file with only comments formats properly
2016-10-08 11:46:21 +08:00
Seth Vargo
69969c2a20
Only test master
2016-10-08 11:45:51 +08:00
Seth Vargo
6aead19b62
Add issue template
2016-10-08 11:43:23 +08:00
Mitchell Hashimoto
16dda36a23
hcl/printer: file with only comments formats properly
2016-10-08 11:42:34 +08:00
Mitchell Hashimoto
3c8ec494b1
hcl/printer: clean up some files, add subtests to testing printer
2016-10-08 11:42:01 +08:00
James Bardin
ef8133da8c
Merge pull request #152 from hashicorp/jbardin/undecoded
...
missing fields when decoding JSON
2016-09-16 09:01:00 -04:00
James Bardin
0bcadf025b
install test deps in appveyor
2016-09-16 08:54:14 -04:00
James Bardin
88422edf64
Update Makefile with new deps, go1.7 in travis
2016-09-16 08:54:14 -04:00
James Bardin
bdd93440d8
Simplify the code to expand objects
...
Now that we know only individual items in a slice need to be expanded,
we can simplify the code flow to expand the ast in place while decoding.
2016-09-16 08:54:06 -04:00
James Bardin
769aa72436
Added more tests for decoding JSON->maps
...
Make TestDecode_flattenedJSON table driven to add more test cases as
reproduced in terraform.
2016-09-16 08:53:45 -04:00
James Bardin
d3228f113d
Unflatten single objects from a list
...
A single json object with nested objects is flattened by the json parser
to a list of objects sharing the parent key. If we're decoding into
struct this was likely a mistake, and we need to re-expand the ast.
2016-09-15 09:28:16 -04:00
James Bardin
77eac88c9f
Simplify the failing test
...
Remove a level of nesting and separate the passing and failing cases.
2016-09-14 12:47:17 -04:00
James Bardin
6502ffef22
Add failing test for missing fields when decoding
...
A JSON object with a single entry containing a single object fails to
decode.
2016-09-13 17:50:57 -04:00
Mitchell Hashimoto
62ebf9354f
hcl: don't escape ANYTHING in ${}, let lower layer handle it
2016-09-09 19:56:15 -06:00
Marius
28370ddc98
json/parser: set Assign property when parsing object item
2016-09-05 21:46:43 +02:00
Mitchell Hashimoto
99df0eb941
Test that #121 doesn't happen
2016-09-02 09:52:19 -07:00
James Nugent
7a6c44ace5
Merge pull request #147 from hashicorp/revert-121-filter-skip-nil-item
...
Revert "Skip a nil item during filtering"
2016-09-02 11:48:36 -05:00
James Nugent
e3d360614a
Revert "Skip a nil item during filtering"
2016-09-02 09:48:18 -07:00
Tim
ef28deed85
Added hcl to json example for nested objects ( #36 )
...
It was unclear how nested object example in hcl would map to json.
README now updated to include an example of the son equivalent
to a hcl nested object.
2016-09-02 11:46:43 -05:00
James Nugent
9edfb078e1
Merge pull request #121 from hashicorp/filter-skip-nil-item
...
Skip nil items during filtering
2016-09-02 11:32:56 -05:00
Mitchell Hashimoto
2fd69cb0a5
json: interpolations have to be escaped
...
At some point we ignored the " in interpolations. We do this for HCL and
it is correct but this is invalid JSON syntax and for JSON we've always
had the stance that we have to escape them.
2016-09-02 11:31:47 -05:00
James Nugent
05be7a778d
Merge pull request #146 from hashicorp/b-comment
...
hcl/scanner: single line '//' commments verify second '/'
2016-09-02 11:27:27 -05:00
Mitchell Hashimoto
9250907631
hcl/scanner: single line '//' commments verify second '/'
...
The way the scanner works '/ foo' was actually valid comment syntax.
This obviously is not what we want. This modifies the scanner to verify
that '//' comments in fact have the second '/'.
2016-09-01 19:50:55 -07:00
Mitchell Hashimoto
baeb59c710
hcl/parser: test case for error in "10kb"
...
https://github.com/hashicorp/terraform/issues/3287#issuecomment-195779840
2016-08-22 14:41:45 -07:00
Mitchell Hashimoto
bc40da04e8
Merge pull request #143 from hashicorp/b-invalid-object-value
...
Fix panic when decoding invalid value structure into struct
2016-08-22 12:37:30 -04:00
Mitchell Hashimoto
40a9504600
fix panic when decoding invalid value structure into struct
...
When decoding an object into a struct where the object structure doesn't
match the Go struct structure, the case tested here would panic. This
introduces additional checks to guard against the edge case being hit to
avoid the panic.
The specific checks being added are: if an item being decoded into a
struct is a literal type, the item to be decoded must be non-nil in
order to use it. This isn't super clear and to be honest I also don't
fully understand it but this fixes the problem without introducing any
more test failures and without significant code complexity.
2016-08-21 23:44:35 -07:00
James Nugent
d8c773c4cb
Merge pull request #138 from hashicorp/multiline-strings
...
Support multiline string literals in HCL
2016-07-11 17:17:52 -06:00
James Nugent
a55c206bd0
Support multiline string literals in HCL
...
This allows multiline strings to be parsed in order to make HIL
interpolations nicer in Terraform:
```
my_complex_thing = "${merge(var.list1,
var.list2,
var.list3)}"
```
2016-07-11 14:33:17 -06:00
Paul Hinze
364df43084
Merge pull request #137 from hashicorp/f-list-of-maps
...
hcl/parser: Support lists of objects
2016-07-08 09:13:38 -05:00
James Nugent
5c900ca702
Add test for list of objects in printer
2016-07-08 13:25:14 +01:00
James Nugent
c30e0cdccf
Update documentation for lists of maps
2016-07-08 12:04:41 +01:00
James Nugent
d7ee01d2a7
Merge pull request #135 from hashicorp/b-null
...
hcl/scanner: handle \"\\0 input properly
2016-07-08 11:51:59 +01:00
Paul Hinze
92237bfa68
hcl/parser: Support lists of objects
...
a.k.a lists of maps
Implementation was pretty straightforward - I had to tweak the `needsComma`
handling since it was stuck inside literal parsing. It happens out front
now. I also promoted the `assign_deep.hcl` parser test to a decoder
test that passes, since it was testing for an error to occur but now it
works! :)
Additionally we make ObjectLists support being comma-delimited, which
enables maps to defined inline like `{one = 1, two = 2}`.
Refs https://github.com/hashicorp/terraform/issues/7142
2016-07-06 13:01:52 -05:00
James Nugent
61f5143284
Merge pull request #134 from hashicorp/b-fuzz
...
Fix parser bugs found via fuzzing from GH-128
2016-06-24 15:12:30 +03:00
Mitchell Hashimoto
5b7dbf7eef
Merge pull request #117 from dcarley/fmt_docs_write
...
hcl/fmtcmd: Clarify docs for Options.Diff
2016-06-21 13:42:41 -07:00
Mitchell Hashimoto
eb82ad4309
Merge pull request #120 from mirdhyn/ignored-tag
...
Ignore field when tag is "-" when decoding structs
2016-06-21 13:42:14 -07:00
Mitchell Hashimoto
66b2aabe46
hcl/scanner: more comments
2016-06-21 13:39:12 -07:00
Mitchell Hashimoto
a6c7514d8d
hcl/scanner: handle \"\\0 input properly
2016-06-21 13:38:25 -07:00
Mitchell Hashimoto
c9b6178f09
hcl/parser: remove spew
2016-06-21 13:26:05 -07:00
Mitchell Hashimoto
cb3a023ffc
add final fuzz case for GH-128
2016-06-21 13:23:11 -07:00
Mitchell Hashimoto
50042432b0
hcl/parser: fix broken parsing of: "v=/\n[,"
2016-06-21 13:21:48 -07:00
Mitchell Hashimoto
6816a5c3fb
fix panic on decode of "t=0t d{}"
2016-06-21 13:18:51 -07:00
Mitchell Hashimoto
352bb4b5e3
hcl/parser: don't allow objects with no keys
2016-06-21 13:07:06 -07:00
Mitchell Hashimoto
685b5f7416
json: verify that objects have keys [GH-128]
2016-06-21 12:57:45 -07:00
James Nugent
da48636430
Merge pull request #133 from hashicorp/json-null-string
...
Fix bug with unquoting null from JSON-encoded HCL
2016-06-20 19:04:52 +02:00
James Nugent
39143f46f8
Fix bug with unquoting null from JSON-encoded HCL
...
Fixes hashicorp/terraform#6774 .
2016-06-20 20:02:34 +03:00
Paul Hinze
aa7699b7b6
Merge pull request #132 from hashicorp/b-remove-bc-double-quote-behavior
...
Remove BC escaped double quote behavior
2016-06-16 23:00:17 +02:00