hcl/hclwrite
Martin Atkins f1f3985230 hclsyntax: Explicit AST node for parentheses
So far the expression parentheses syntax has been handled entirely in the
parser and has been totally invisible in the AST. That's fine for typical
expression evaluation, but over the years it's led to a few quirky
behaviors in less common situations where we've assumed that all
expressions are covered by the AST itself or by the source ranges that the
AST captures.

In particular, hclwrite assumes that all expressions will have source
ranges that cover their tokens, and it generates an incorrect physical
syntax tree when the AST doesn't uphold that.

After resisting through a few other similar bugs, this commit finally
introduces an explicit AST node for parentheses, which makes the
parentheses explicit in the AST and captures the larger source range that
includes the TokenOParen and the TokenCParen.

This means that parentheses will now be visible as a distinct node when
walking the AST, as reflected in the updated tests here. That may cause
downstream applications that traverse the tree to exhibit different
behaviors but we're not considering that as a "breaking change" because
the Walk function doesn't make any guarantees about the specific AST
shape.
2020-12-02 12:03:00 -08:00
..
fuzz hclwrite: Add fuzz testing 2020-05-14 15:03:29 -04:00
ast_attribute.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
ast_block_test.go hclwrite: Allow blank quoted string block labels 2020-11-18 09:21:23 -05:00
ast_block.go hclwrite: Allow blank quoted string block labels 2020-11-18 09:21:23 -05:00
ast_body_test.go hclwrite: Allow constructing expressions from raw tokens 2019-11-19 15:35:01 -08:00
ast_body.go hclwrite: Allow constructing expressions from raw tokens 2019-11-19 15:35:01 -08:00
ast_expression.go hclwrite: Allow constructing expressions from raw tokens 2019-11-19 15:35:01 -08:00
ast_test.go hclwrite: Simplify internal data structures 2018-08-01 08:46:31 -07:00
ast.go hclwrite: NewEmptyFile function 2018-11-03 20:45:25 +00:00
doc.go hclwrite: Split Attribute and Block into their own source files 2018-11-03 09:21:43 -07:00
examples_test.go hclwrite: Generate multi-line objects and maps 2020-05-06 09:45:13 -04:00
format_test.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
format.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
generate_test.go hclwrite: Generate multi-line objects and maps 2020-05-06 09:45:13 -04:00
generate.go hclwrite: Generate multi-line objects and maps 2020-05-06 09:45:13 -04:00
native_node_sorter.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
node.go hclwrite: Make block labels a node in their own right 2020-08-21 11:30:32 -07:00
parser_test.go hclsyntax: Explicit AST node for parentheses 2020-12-02 12:03:00 -08:00
parser.go hclwrite: Make block labels a node in their own right 2020-08-21 11:30:32 -07:00
public.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
round_trip_test.go Unfold the "hcl" directory up into the root 2019-09-09 16:08:19 -07:00
tokens.go Use Unicode 12.0.0 grapheme cluster segmentation rules 2020-03-09 09:16:33 -07:00