Martin Atkins
41527d1a3c
Retain the bytes used to construct a file
...
Later on this will be useful when printing diagnostics with source code
snippets as context.
2017-05-18 08:07:52 -07:00
Martin Atkins
160f56abb1
json: beginnings of parsing JSON into File objects
...
The returned file objects are not actually functional yet, but this
establishes the interface.
2017-05-18 07:57:04 -07:00
Martin Atkins
87677ae03a
Rename "Element" to "Block"
...
The term "element" is already used for an item from a collection in cty,
so we'll use "block" to talk about the nested blocks in a zcl config to
reduce confusion.
2017-05-18 07:21:21 -07:00
Martin Atkins
eca76d650c
json: Detect and report extraneous data at EOF
2017-05-17 07:59:41 -07:00
Martin Atkins
0ef4932962
json: parsing of arrays
...
(and assorted bugfixes in parsing of objects that were found in the
process of adapting that code for arrays.)
2017-05-17 07:55:21 -07:00
Martin Atkins
b073937523
json: Basic parsing of number values
2017-05-17 07:34:33 -07:00
Martin Atkins
4100bdfd2f
json: Parsing of strings and objects
2017-05-16 08:00:07 -07:00
Martin Atkins
b5a78fd826
Helper for determining if a Diagnostics contains errors
...
Checking if it's non-nil, as we would for Go errors, doesn't work here
because there may be warnings.
2017-05-16 07:58:34 -07:00
Martin Atkins
8dfc3c4bbe
json: fix overly-greedy keyword scanning
...
Logic error in the scanner caused it to always consume the remainder of
the string.
2017-05-16 07:23:33 -07:00
Martin Atkins
bd0cbc1c81
more detailed default stringification of diagnostics
2017-05-16 07:22:56 -07:00
Martin Atkins
66c38447d3
json: fix buggy peeker.Read
2017-05-16 06:51:19 -07:00
Martin Atkins
f6bd122f4b
json: parsing of keywords
2017-05-16 06:51:19 -07:00
Martin Atkins
f754328a91
json: beginnings of parser
...
Only supports parsing objects right now, and even then doesn't really
because objects have to contain strings and that isn't implemented yet.
2017-05-15 08:35:32 -07:00
Martin Atkins
377e20b7b8
json: AST node types
2017-05-15 08:34:35 -07:00
Martin Atkins
838a0332e6
json: token peeker
...
This will help our hand-written recursive-descent parser walk the tokens
with one token of lookahead.
2017-05-15 08:34:00 -07:00
Martin Atkins
0c1a99df48
Utilities for constructing diagnostics
...
Wrangling diagnostics is a common concern in the parsers and evaluator,
and these helper functions are intended to make that code more concise.
2017-05-15 08:33:22 -07:00
Martin Atkins
45d426b99c
json: Generate EOF tokens marking the end of scanning
...
This helps the parser include a good position when it needs to generate
"unexpected EOF" diagnostics.
2017-05-15 07:15:53 -07:00
Martin Atkins
b5ce4360cd
json: initial scanner implementation
...
Currently lacking correct support for unicode text segmentation into
grapheme clusters, so it miscounts "Column" in positions. This will be
addressed later.
2017-05-15 07:02:13 -07:00
Martin Atkins
b9183e85e4
Initial stubs of the public API
2017-05-13 17:44:11 -07:00
Martin Atkins
bde4c176b9
LICENSE
2017-05-13 08:51:32 -07:00
Martin Atkins
fb168c8128
Why, hello!
2017-05-13 08:50:05 -07:00
Jelte Fennema
392dba7d90
Support decoding HCL floats into Go float32
2017-05-09 15:53:59 -07:00
James Bardin
a4b07c25de
Merge pull request #173 from hashicorp/jbardin/crlf
...
Remove CRLF line endings
2017-05-04 15:02:34 -04:00
Mitchell Hashimoto
7fa7fff964
Merge pull request #197 from sean-/f-stray-error
...
Return an error instead of printing stray `illegal\n` to stdout.
2017-04-20 16:14:34 -07:00
Sean Chittenden
20ef8cf57f
Return an error instead of printing stray illegal\n
to stdout.
2017-04-20 16:09:49 -07:00
Mitchell Hashimoto
630949a3c5
Merge pull request #190 from hashicorp/b-singleline
...
hcl/printer: singleline objects followed by non-singleline need blank
2017-02-17 08:47:38 -08:00
Mitchell Hashimoto
b943d49ebc
Update .travis.yml
2017-02-17 08:47:33 -08:00
Mitchell Hashimoto
b979c7a8d6
hcl/printer: singleline objects followed by non-singleline need blank
...
Fixes https://github.com/hashicorp/terraform/issues/12017
2017-02-17 08:45:53 -08:00
Mitchell Hashimoto
372e8ddaa1
Merge pull request #186 from hashicorp/b-comments
...
hcl/printer: cleaner handling of standalone comments at end of file
2017-02-01 16:05:34 -08:00
Mitchell Hashimoto
47562ccf19
hcl/printer: cleaner handling of standalone comments at end of file
2017-02-01 16:03:59 -08:00
Mitchell Hashimoto
88e9565e99
Merge pull request #185 from hashicorp/f-list-of-lists
...
hcl/parser: parse list of lists
2017-01-30 13:06:51 -08:00
Mitchell Hashimoto
08c7efd78d
hcl/parser: parse list of lists
2017-01-30 13:05:20 -08:00
Mitchell Hashimoto
db4f076892
Merge pull request #184 from hashicorp/b-singleline-obj
...
hcl/printer: format single line objects to not have newline between
2017-01-24 17:06:35 -08:00
Mitchell Hashimoto
e2dbf84eb0
hcl/printer: format single line objects to not have newline between
...
Fixes #161
See #161 and test cases for examples.
2017-01-24 17:05:35 -08:00
Mitchell Hashimoto
72ac8ca2e6
Merge pull request #183 from hashicorp/b-list-comment
...
hcl/printer: preserve list comment on first line
2017-01-24 16:52:30 -08:00
Mitchell Hashimoto
efcf294794
hcl/printer: preserve list comment on first line
2017-01-24 16:51:14 -08:00
Mitchell Hashimoto
4f21d59dc7
Merge pull request #182 from hashicorp/b-comment
...
hcl/printer: format comments across multiple lines in an object
2017-01-24 16:46:15 -08:00
Mitchell Hashimoto
db65f66984
hcl/printer: format comments across multiple lines in an object
...
https://github.com/hashicorp/terraform/issues/11209
See the TF issue above for an example, and test cases for a fix. This
didn't affect any other formatting tests.
2017-01-24 16:44:23 -08:00
Mitchell Hashimoto
dfbfb1c68d
Merge pull request #181 from hashicorp/b-heredoc-single
...
hcl: print single heredoc elements properly
2017-01-24 16:28:40 -08:00
Mitchell Hashimoto
1bed77586d
hcl: print single heredoc elements properly
2017-01-24 16:26:48 -08:00
Mitchell Hashimoto
8c0b1f045f
hcl/printer: verify list element with one heredoc is formatted properly
2017-01-24 16:19:14 -08:00
Mitchell Hashimoto
39fa3a62ba
Merge pull request #180 from hashicorp/b-bool-list
...
hcl/parser: support bools in lists
2017-01-19 17:07:30 -08:00
Mitchell Hashimoto
e59762bcc7
hcl/parser: support bools in lists
2017-01-19 17:06:02 -08:00
Mitchell Hashimoto
eb6f65b2d7
Merge pull request #177 from hashicorp/b-fmt-heredoc
...
hcl/printer: newline after heredoc items in lists
2017-01-08 16:25:15 -08:00
Mitchell Hashimoto
4f76b0e04a
hcl/printer: newline after heredoc items in lists
2017-01-08 16:24:08 -08:00
Mitchell Hashimoto
e930f8e5fe
hcl/fmtcmd: include filename in error
2017-01-08 16:13:04 -08:00
Mitchell Hashimoto
80e628d796
Merge pull request #176 from theherk/feature/build-on-Go-before-1.7
...
Modify new bytes.ContainsRune to backward compatible bytes.IndexRune
2016-12-15 14:58:39 -08:00
Herkermer Sherwood
f3dd3ed758
Modify new bytes.ContainsRune to backward compatible bytes.IndexRune
2016-12-15 14:49:10 -08:00
James Bardin
dd5495f43c
Fix newlines in test-fixture
...
hcl/parser/test-fixtures/comment.hcl already contained CRLF line
endings. Convert that to unix and remove the extra cariiage returns
from comment_crlf.hcl.
2016-12-01 13:05:58 -05:00
James Bardin
aaca009935
Don't convert windows newlines
...
If the canonical newline is a single LF, don't insert CRLF in tests
2016-12-01 12:10:09 -05:00