aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/hashicorp/hcl
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/hcl')
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/ast/ast.go3
-rw-r--r--vendor/github.com/hashicorp/hcl/hcl/parser/parser.go6
-rw-r--r--vendor/github.com/hashicorp/hcl/json/parser/parser.go9
3 files changed, 17 insertions, 1 deletions
diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
index ea3734f..6e5ef65 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go
@@ -156,7 +156,8 @@ func (o *ObjectKey) Pos() token.Pos {
type LiteralType struct {
Token token.Token
- // associated line comment, only when used in a list
+ // comment types, only used when in a list
+ LeadComment *CommentGroup
LineComment *CommentGroup
}
diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
index f46ed4c..0aa080f 100644
--- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
+++ b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go
@@ -337,6 +337,12 @@ func (p *Parser) listType() (*ast.ListType, error) {
return nil, err
}
+ // If there is a lead comment, apply it
+ if p.leadComment != nil {
+ node.LeadComment = p.leadComment
+ p.leadComment = nil
+ }
+
l.Add(node)
needComma = true
case token.COMMA:
diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser.go b/vendor/github.com/hashicorp/hcl/json/parser/parser.go
index 3a62ec3..acf9594 100644
--- a/vendor/github.com/hashicorp/hcl/json/parser/parser.go
+++ b/vendor/github.com/hashicorp/hcl/json/parser/parser.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/hashicorp/hcl/hcl/ast"
+ hcltoken "github.com/hashicorp/hcl/hcl/token"
"github.com/hashicorp/hcl/json/scanner"
"github.com/hashicorp/hcl/json/token"
)
@@ -103,6 +104,14 @@ func (p *Parser) objectItem() (*ast.ObjectItem, error) {
switch p.tok.Type {
case token.COLON:
+ pos := p.tok.Pos
+ o.Assign = hcltoken.Pos{
+ Filename: pos.Filename,
+ Offset: pos.Offset,
+ Line: pos.Line,
+ Column: pos.Column,
+ }
+
o.Val, err = p.objectValue()
if err != nil {
return nil, err