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
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
Sander van Harmelen
cf83c24abf
Fix flattening of empty objects
2015-11-20 17:56:37 +01:00
Paul Hinze
da2740d4c5
Merge pull request #62 from hashicorp/phinze/handle-escaped-quotes-within-interpolations
...
Restore old behavior for \" within interpolations
2015-11-19 12:05:59 -06:00
Paul Hinze
feb701804f
Restore old behavior for \" within interpolations
...
Before the parser rewrite, HCL would silently convert `\"` within
interpolation braces to `"`.
After the conversion, this became a syntax error.
We've found several instances of Terraform configs in the wild using
this syntax. It results in a hard "syntax error" message during config
parsing. While avoiding the extra escape on double quotes within
interpolations is definitely preferred, the UX of the syntax error feels
harsh enough to be worth inserting this backwards compatibility for now,
leaving us the option of deprecating it with a warning down the line.
2015-11-19 12:04:02 -06:00
Sander van Harmelen
2f117c801c
This fixes a bug in the flattener so that objects are flattened as one list object
2015-11-19 17:42:55 +01:00
Fatih Arslan
d45f5d133c
ast: change signature of Walk() to allow rewriting AST
...
With the previous Walk function it's not easy to rewrite the node as we
don't have any kind of reference to the parent. If we want to rewrite a
given AST, we have to manually traverse it as Walk is not usable. To
allow us rewriting the AST we change the signature of the function
passed to Walk. It'll allow us to rewrite the AST and return back.
Internally Walk() overrides the returned AST.
This idea was also talked here:
https://groups.google.com/forum/#!topic/golang-nuts/cRZQV36IckM
extensively.
2015-11-14 21:58:31 +02:00
Mitchell Hashimoto
637d86c42d
json/parser: can parse lists of objects
2015-11-08 16:28:18 -08:00
Mitchell Hashimoto
407a4ff94c
json/parser: flatten
2015-11-08 16:20:34 -08:00
Mitchell Hashimoto
7ccda83497
json/parser: can parse multiple objects
2015-11-08 16:11:15 -08:00
Mitchell Hashimoto
340f0af3c0
json/token: fix issues with unquoting sttrings from JSON
2015-11-08 16:08:36 -08:00
Mitchell Hashimoto
e9e082dff4
json/token: remove Value
2015-11-08 15:54:48 -08:00
Mitchell Hashimoto
cf0da81e50
Remove json files, add flatten.go to json/parse
2015-11-08 15:52:57 -08:00
Mitchell Hashimoto
f5a27d4be4
json/parser
2015-11-08 15:50:37 -08:00
Mitchell Hashimoto
ca0ea00fe9
json/token: add comma token
2015-11-08 14:39:58 -08:00
Mitchell Hashimoto
0fce9beccf
json/scanner: beef up tests with real example
2015-11-08 14:39:43 -08:00
Mitchell Hashimoto
87a91d1019
json: scanner and token
2015-11-07 18:14:32 -08:00
Mitchell Hashimoto
e3ed2553ca
json: pass to clean up objcet lists
2015-11-07 16:34:47 -08:00
Mitchell Hashimoto
60534579be
json: magic flatten step to make things more HCL-like
2015-11-07 16:00:02 -08:00
Mitchell Hashimoto
3bac6be959
json: make root look the same as HCL root
2015-11-07 11:33:31 -08:00
Mitchell Hashimoto
98b069abb0
json: fix more errors
2015-11-06 23:42:40 -08:00
Mitchell Hashimoto
23d42714de
json: fix parse errors
2015-11-06 23:33:40 -08:00
Mitchell Hashimoto
bfa1019160
json: this might work
2015-11-06 16:48:00 -08:00
Mitchell Hashimoto
4de51957ef
hcl: fix trailing comma + comment parse error
...
https://github.com/hashicorp/terraform/issues/3249
2015-09-16 09:54:29 -07:00
Mitchell Hashimoto
3c3a30a1e5
Use go generate to generate parsers
2015-01-15 15:11:14 -08:00
Atin Malaviya
98bdeedb2c
Missed one more go-multierror
2014-12-24 18:34:28 -05:00
Mitchell Hashimoto
2c88e7ea6e
json: true, false, null lex [GH-22]
2014-11-21 10:59:12 -08:00
Mitchell Hashimoto
e51eabcdf8
parse floats 1.02 properly [GH-19]
2014-11-12 21:29:07 -08:00
Mitchell Hashimoto
88ef419bd9
Properly decode \\n
2014-11-12 21:12:45 -08:00
Sebastien Binet
8438e17f49
all: first stab to full scientific notation support
2014-08-22 10:34:03 +02:00
Mitchell Hashimoto
8a779f6e41
json: support \n
2014-08-21 14:42:02 -07:00
Mitchell Hashimoto
f65d314d58
hcl: support variable interpolations for compat with libucl
2014-08-21 14:38:45 -07:00
Mitchell Hashimoto
e868ca02fd
Support decoding floats, scientific notation for JSON [GH-5]
2014-08-21 11:22:37 -07:00
Mitchell Hashimoto
99d585c297
Tests pass.
2014-08-11 20:58:20 -07:00
Mitchell Hashimoto
e704c5b624
json: parses
2014-08-11 16:23:28 -07:00
Mitchell Hashimoto
437eb0d851
decode JSON equally
2014-08-08 15:58:34 -07:00
Mitchell Hashimoto
398c583f25
hcl,json: fix list and object ordering
2014-08-04 21:53:39 -07:00
Mitchell Hashimoto
783acc2aa1
ObjectNodes can only have assignments
2014-08-03 21:56:50 -07:00
Mitchell Hashimoto
9e89ffabde
json: can parse negative numbers and floats
2014-08-03 13:34:08 -07:00
Mitchell Hashimoto
59e0ca9d5a
Start the decoder
2014-08-02 15:44:45 -07:00
Mitchell Hashimoto
358b43ddbc
JSON parser
2014-08-02 11:38:41 -07:00