vendor: update HCL for printing updates
This commit is contained in:
parent
3630bb0e3f
commit
3b2aa0ad0d
|
@ -118,17 +118,27 @@ func (p *printer) output(n interface{}) []byte {
|
|||
defer un(trace(p, "ObjectList"))
|
||||
|
||||
var index int
|
||||
var nextItem token.Pos
|
||||
for {
|
||||
// TODO(arslan): refactor below comment printing, we have the same in objectType
|
||||
for _, c := range p.standaloneComments {
|
||||
for _, comment := range c.List {
|
||||
if index != len(t.Items) {
|
||||
nextItem = t.Items[index].Pos()
|
||||
} else {
|
||||
nextItem = token.Pos{Offset: infinity, Line: infinity}
|
||||
}
|
||||
// Determine the location of the next actual non-comment
|
||||
// item. If we're at the end, the next item is at "infinity"
|
||||
var nextItem token.Pos
|
||||
if index != len(t.Items) {
|
||||
nextItem = t.Items[index].Pos()
|
||||
} else {
|
||||
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 we hit the end add newlines so we can print the comment
|
||||
// we don't do this if prev is invalid which means the
|
||||
|
@ -138,14 +148,21 @@ func (p *printer) output(n interface{}) []byte {
|
|||
buf.Write([]byte{newline, newline})
|
||||
}
|
||||
|
||||
// Write the actual comment.
|
||||
buf.WriteString(comment.Text)
|
||||
|
||||
buf.WriteByte(newline)
|
||||
if index != len(t.Items) {
|
||||
buf.WriteByte(newline)
|
||||
}
|
||||
|
||||
// Set printed to true to note that we printed something
|
||||
printed = true
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
if index == len(t.Items) {
|
||||
|
|
|
@ -1300,70 +1300,70 @@
|
|||
"revision": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "8OPDk+bKyRGJoKcS4QNw9F7dpE8=",
|
||||
"checksumSHA1": "gjNr5WSUuPicxQzLLKpv5VsjFg0=",
|
||||
"path": "github.com/hashicorp/hcl",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/ast",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/fmtcmd",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/parser",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "QjoxNbg+jBmtewexLaBZ8EJEl24=",
|
||||
"checksumSHA1": "JXmCiZ1N2Zv2DIYz8UmnipOgLqQ=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/printer",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "lgR7PSAZ0RtvAc9OCtCnNsF/x8g=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/scanner",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "JlZmnzqdmFFyb1+2afLyR3BOE/8=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/strconv",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
|
||||
"path": "github.com/hashicorp/hcl/hcl/token",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=",
|
||||
"path": "github.com/hashicorp/hcl/json/parser",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=",
|
||||
"path": "github.com/hashicorp/hcl/json/scanner",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
|
||||
"path": "github.com/hashicorp/hcl/json/token",
|
||||
"revision": "8fa153c5b4e9d1ccecda7075821ffc7c1f6d912b",
|
||||
"revisionTime": "2016-10-28T23:32:40Z"
|
||||
"revision": "6e968a3fcdcbab092f5307fd0d85479d5af1e4dc",
|
||||
"revisionTime": "2016-11-01T18:00:25Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "RYz/9y1RMZfg+oMgEyJIWiSl1dU=",
|
||||
|
|
Loading…
Reference in New Issue