Merge pull request #14225 from hashicorp/jbardin/hcl-update

update vendored hcl
This commit is contained in:
James Bardin 2017-05-04 18:22:00 -04:00 committed by GitHub
commit e76654af01
5 changed files with 34 additions and 29 deletions

View File

@ -4,7 +4,7 @@ clone_folder: c:\gopath\src\github.com\hashicorp\hcl
environment: environment:
GOPATH: c:\gopath GOPATH: c:\gopath
init: init:
- git config --global core.autocrlf true - git config --global core.autocrlf false
install: install:
- cmd: >- - cmd: >-
echo %Path% echo %Path%

View File

@ -3,6 +3,7 @@
package parser package parser
import ( import (
"bytes"
"errors" "errors"
"fmt" "fmt"
"strings" "strings"
@ -36,6 +37,11 @@ func newParser(src []byte) *Parser {
// Parse returns the fully parsed source and returns the abstract syntax tree. // Parse returns the fully parsed source and returns the abstract syntax tree.
func Parse(src []byte) (*ast.File, error) { func Parse(src []byte) (*ast.File, error) {
// normalize all line endings
// since the scanner and output only work with "\n" line endings, we may
// end up with dangling "\r" characters in the parsed data.
src = bytes.Replace(src, []byte("\r\n"), []byte("\n"), -1)
p := newParser(src) p := newParser(src)
return p.Parse() return p.Parse()
} }

View File

@ -62,6 +62,5 @@ func Format(src []byte) ([]byte, error) {
// Add trailing newline to result // Add trailing newline to result
buf.WriteString("\n") buf.WriteString("\n")
return buf.Bytes(), nil return buf.Bytes(), nil
} }

View File

@ -147,7 +147,7 @@ func (p *Parser) objectKey() ([]*ast.ObjectKey, error) {
// Done // Done
return keys, nil return keys, nil
case token.ILLEGAL: case token.ILLEGAL:
fmt.Println("illegal") return nil, errors.New("illegal")
default: default:
return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type) return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type)
} }

52
vendor/vendor.json vendored
View File

@ -2072,70 +2072,70 @@
"revisionTime": "2016-08-13T22:13:03Z" "revisionTime": "2016-08-13T22:13:03Z"
}, },
{ {
"checksumSHA1": "Ok3Csn6Voou7pQT6Dv2mkwpqFtw=", "checksumSHA1": "o3XZZdOnSnwQSpYw215QV75ZDeI=",
"path": "github.com/hashicorp/hcl", "path": "github.com/hashicorp/hcl",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=", "checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=",
"path": "github.com/hashicorp/hcl/hcl/ast", "path": "github.com/hashicorp/hcl/hcl/ast",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "DaQmLi48oUAwctWcX6A6DNN61UY=", "checksumSHA1": "DaQmLi48oUAwctWcX6A6DNN61UY=",
"path": "github.com/hashicorp/hcl/hcl/fmtcmd", "path": "github.com/hashicorp/hcl/hcl/fmtcmd",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "MGYzZActhzSs9AnCx3wrEYVbKFg=", "checksumSHA1": "teokXoyRXEJ0vZHOWBD11l5YFNI=",
"path": "github.com/hashicorp/hcl/hcl/parser", "path": "github.com/hashicorp/hcl/hcl/parser",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "gKCHLG3j2CNs2iADkvSKSNkni+8=", "checksumSHA1": "WR1BjzDKgv6uE+3ShcDTYz0Gl6A=",
"path": "github.com/hashicorp/hcl/hcl/printer", "path": "github.com/hashicorp/hcl/hcl/printer",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "z6wdP4mRw4GVjShkNHDaOWkbxS0=", "checksumSHA1": "z6wdP4mRw4GVjShkNHDaOWkbxS0=",
"path": "github.com/hashicorp/hcl/hcl/scanner", "path": "github.com/hashicorp/hcl/hcl/scanner",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "oS3SCN9Wd6D8/LG0Yx1fu84a7gI=", "checksumSHA1": "oS3SCN9Wd6D8/LG0Yx1fu84a7gI=",
"path": "github.com/hashicorp/hcl/hcl/strconv", "path": "github.com/hashicorp/hcl/hcl/strconv",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=", "checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
"path": "github.com/hashicorp/hcl/hcl/token", "path": "github.com/hashicorp/hcl/hcl/token",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=", "checksumSHA1": "PwlfXt7mFS8UYzWxOK5DOq0yxS0=",
"path": "github.com/hashicorp/hcl/json/parser", "path": "github.com/hashicorp/hcl/json/parser",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=", "checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=",
"path": "github.com/hashicorp/hcl/json/scanner", "path": "github.com/hashicorp/hcl/json/scanner",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=", "checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
"path": "github.com/hashicorp/hcl/json/token", "path": "github.com/hashicorp/hcl/json/token",
"revision": "630949a3c5fa3c613328e1b8256052cbc2327c9b", "revision": "a4b07c25de5ff55ad3b8936cea69a79a3d95a855",
"revisionTime": "2017-02-17T16:47:38Z" "revisionTime": "2017-05-04T19:02:34Z"
}, },
{ {
"checksumSHA1": "2Nrl/YKrmowkRgCDLhA6UTFgYEY=", "checksumSHA1": "2Nrl/YKrmowkRgCDLhA6UTFgYEY=",