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
8ec7833c13
Merge pull request #51 from hashicorp/fix-comma
...
parser: fix syntax error on missing comma
2015-11-12 08:17:48 -08:00
Mitchell Hashimoto
21da63e4d5
Merge pull request #52 from hashicorp/add-travis
...
Add travis.yml file
2015-11-12 08:16:43 -08:00
Fatih Arslan
285f30bf10
Add travis.yml file
...
We have many tests, having this would simplify contributing also easier
because Github would show us the CI result on PR's.
2015-11-12 17:56:38 +02:00
Fatih Arslan
99ce7c7e2c
parser: fix syntax error on missing comma
...
Fixes hashicorp/terraform#3877
2015-11-12 15:26:23 +02:00
Mitchell Hashimoto
fa160f1206
Merge pull request #49 from hashicorp/b-heredoc
...
Heredoc support
2015-11-10 15:09:49 -08:00
Mitchell Hashimoto
aed824cf55
add more heredoc tests
2015-11-10 15:08:59 -08:00
Mitchell Hashimoto
616214bb2e
hcl/printer: cleanup how we handle heredocs
2015-11-10 15:06:32 -08:00
Mitchell Hashimoto
7b107c7b54
hcl/printer: clear trailing newline from heredoc
2015-11-10 15:02:21 -08:00
Mitchell Hashimoto
16dcdb88fa
hcl/printer: unindent for heredocs
2015-11-10 14:54:46 -08:00
Mitchell Hashimoto
db97e1a99c
hcl/token: Value for heredoc
2015-11-10 14:09:01 -08:00
Mitchell Hashimoto
0f965478b6
hcl/parser: parse heredocs
2015-11-10 14:03:29 -08:00
Mitchell Hashimoto
6c34ace97d
hcl/token: heredoc token
2015-11-10 14:02:37 -08:00
Mitchell Hashimoto
82ad2beb52
hcl/scanner: scan heredocs
2015-11-10 14:01:56 -08:00
Mitchell Hashimoto
e5d4045cf0
Test for GH-46
2015-11-09 20:02:20 -08:00
Mitchell Hashimoto
2829433f7c
Merge pull request #45 from hashicorp/f-new-parser
...
New HCL and JSON parser in pure Go, printer support
2015-11-09 10:34:29 -08:00
Mitchell Hashimoto
d726517f58
hcl/ast: tests for Filter
2015-11-09 09:08:05 -08:00
Mitchell Hashimoto
8362abbcb9
update README
2015-11-08 16:42:43 -08:00
Mitchell Hashimoto
9e5a4f89ab
Merge pull request #44 from hashicorp/f-new-json
...
Convert JSON parser to pure Go
2015-11-08 16:29:24 -08:00
Mitchell Hashimoto
637d86c42d
json/parser: can parse lists of objects
2015-11-08 16:28:18 -08:00
Mitchell Hashimoto
eabb04dcd5
hcl/ast: filter should compare value string
2015-11-08 16:25:40 -08:00
Mitchell Hashimoto
407a4ff94c
json/parser: flatten
2015-11-08 16:20:34 -08:00
Mitchell Hashimoto
278bb105f2
hcl/ast: style
2015-11-08 16:20:22 -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
b3a9867999
replace parse with new json parser
2015-11-08 15:53:33 -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
338eebdbf7
test for decoding structures within lists
2015-11-07 16:48:38 -08:00
Mitchell Hashimoto
15fce08259
hcl/ast: walk the objectlist within an objecttype
2015-11-07 16:47:50 -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
0704c168e1
hcl/printer: make boolean logic one line
2015-11-07 15:15:40 -08:00
Mitchell Hashimoto
b24dfd1bb1
hcl/printer: output an equal sign only if we had one originally
2015-11-07 15:13:05 -08:00
Mitchell Hashimoto
3bac6be959
json: make root look the same as HCL root
2015-11-07 11:33:31 -08:00
Mitchell Hashimoto
54464e89f1
allow decoding into slices that are empty
2015-11-07 11:30:53 -08:00
Mitchell Hashimoto
9ca9a4e1c3
hcl/ast: simplify API
2015-11-07 10:25:22 -08:00
Mitchell Hashimoto
32411ba6af
hcl/ast: Get should return a list
2015-11-07 09:52:50 -08:00
Mitchell Hashimoto
8754ac7343
decode bool typed properly
2015-11-07 00:29:51 -08:00
Mitchell Hashimoto
3e6a61bda5
decoder allows non-root files
2015-11-07 00:27:57 -08:00
Mitchell Hashimoto
671ef91008
tests... pass
2015-11-07 00:21:44 -08:00
Mitchell Hashimoto
e370e34aeb
down to one failing test
2015-11-07 00:12:04 -08:00
Mitchell Hashimoto
5aaa3e75b9
hcl/parser: scan errors should come through as well
2015-11-06 23:42:45 -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
6cc18eb70b
hcl/scanner: actually scan all things with exponents as floats
2015-11-06 23:33:25 -08:00