Merge pull request #9781 from hashicorp/update-hcl
vendor: update HCL for printing updates
This commit is contained in:
commit
81f703a6bd
|
@ -118,17 +118,27 @@ func (p *printer) output(n interface{}) []byte {
|
||||||
defer un(trace(p, "ObjectList"))
|
defer un(trace(p, "ObjectList"))
|
||||||
|
|
||||||
var index int
|
var index int
|
||||||
var nextItem token.Pos
|
|
||||||
for {
|
for {
|
||||||
// TODO(arslan): refactor below comment printing, we have the same in objectType
|
// Determine the location of the next actual non-comment
|
||||||
for _, c := range p.standaloneComments {
|
// item. If we're at the end, the next item is at "infinity"
|
||||||
for _, comment := range c.List {
|
var nextItem token.Pos
|
||||||
if index != len(t.Items) {
|
if index != len(t.Items) {
|
||||||
nextItem = t.Items[index].Pos()
|
nextItem = t.Items[index].Pos()
|
||||||
} else {
|
} else {
|
||||||
nextItem = token.Pos{Offset: infinity, Line: infinity}
|
nextItem = token.Pos{Offset: infinity, Line: infinity}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Go through the standalone comments in the file and print out
|
||||||
|
// the comments that we should be for this object item.
|
||||||
|
for _, c := range p.standaloneComments {
|
||||||
|
// Go through all the comments in the group. The group
|
||||||
|
// should be printed together, not separated by double newlines.
|
||||||
|
printed := false
|
||||||
|
for _, comment := range c.List {
|
||||||
|
// We only care about comments after the previous item
|
||||||
|
// we've printed so that comments are printed in the
|
||||||
|
// correct locations (between two objects for example).
|
||||||
|
// And before the next item.
|
||||||
if comment.Pos().After(p.prev) && comment.Pos().Before(nextItem) {
|
if comment.Pos().After(p.prev) && comment.Pos().Before(nextItem) {
|
||||||
// if we hit the end add newlines so we can print the comment
|
// if we hit the end add newlines so we can print the comment
|
||||||
// we don't do this if prev is invalid which means the
|
// we don't do this if prev is invalid which means the
|
||||||
|
@ -138,13 +148,20 @@ func (p *printer) output(n interface{}) []byte {
|
||||||
buf.Write([]byte{newline, newline})
|
buf.Write([]byte{newline, newline})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write the actual comment.
|
||||||
buf.WriteString(comment.Text)
|
buf.WriteString(comment.Text)
|
||||||
|
buf.WriteByte(newline)
|
||||||
|
|
||||||
buf.WriteByte(newline)
|
// Set printed to true to note that we printed something
|
||||||
if index != len(t.Items) {
|
printed = true
|
||||||
buf.WriteByte(newline)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're not at the last item, write a new line so
|
||||||
|
// that there is a newline separating this comment from
|
||||||
|
// the next object.
|
||||||
|
if printed && index != len(t.Items) {
|
||||||
|
buf.WriteByte(newline)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1300,70 +1300,70 @@
|
||||||
"revision": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
"revision": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "8OPDk+bKyRGJoKcS4QNw9F7dpE8=",
|
"checksumSHA1": "gjNr5WSUuPicxQzLLKpv5VsjFg0=",
|
||||||
"path": "github.com/hashicorp/hcl",
|
"path": "github.com/hashicorp/hcl",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=",
|
"checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/ast",
|
"path": "github.com/hashicorp/hcl/hcl/ast",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
|
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/fmtcmd",
|
"path": "github.com/hashicorp/hcl/hcl/fmtcmd",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=",
|
"checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/parser",
|
"path": "github.com/hashicorp/hcl/hcl/parser",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "QjoxNbg+jBmtewexLaBZ8EJEl24=",
|
"checksumSHA1": "JXmCiZ1N2Zv2DIYz8UmnipOgLqQ=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/printer",
|
"path": "github.com/hashicorp/hcl/hcl/printer",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "lgR7PSAZ0RtvAc9OCtCnNsF/x8g=",
|
"checksumSHA1": "lgR7PSAZ0RtvAc9OCtCnNsF/x8g=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/scanner",
|
"path": "github.com/hashicorp/hcl/hcl/scanner",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "JlZmnzqdmFFyb1+2afLyR3BOE/8=",
|
"checksumSHA1": "JlZmnzqdmFFyb1+2afLyR3BOE/8=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/strconv",
|
"path": "github.com/hashicorp/hcl/hcl/strconv",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
|
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/token",
|
"path": "github.com/hashicorp/hcl/hcl/token",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=",
|
"checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=",
|
||||||
"path": "github.com/hashicorp/hcl/json/parser",
|
"path": "github.com/hashicorp/hcl/json/parser",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=",
|
"checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=",
|
||||||
"path": "github.com/hashicorp/hcl/json/scanner",
|
"path": "github.com/hashicorp/hcl/json/scanner",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
|
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
|
||||||
"path": "github.com/hashicorp/hcl/json/token",
|
"path": "github.com/hashicorp/hcl/json/token",
|
||||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||||
"revisionTime": "2016-10-28T23:32:40Z"
|
"revisionTime": "2016-11-01T18:00:25Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "RYz/9y1RMZfg+oMgEyJIWiSl1dU=",
|
"checksumSHA1": "RYz/9y1RMZfg+oMgEyJIWiSl1dU=",
|
||||||
|
|
Loading…
Reference in New Issue