Merge pull request #7582 from hashicorp/f-vendor-latest-hcl
vendor: Update to lastest hashicorp/hcl
This commit is contained in:
commit
dc313de5b4
|
@ -81,9 +81,20 @@ FOO
|
||||||
* Boolean values: `true`, `false`
|
* Boolean values: `true`, `false`
|
||||||
|
|
||||||
* Arrays can be made by wrapping it in `[]`. Example:
|
* Arrays can be made by wrapping it in `[]`. Example:
|
||||||
`["foo", "bar", 42]`. Arrays can contain primitives
|
`["foo", "bar", 42]`. Arrays can contain primitives,
|
||||||
and other arrays, but cannot contain objects. Objects must
|
other arrays, and objects. As an alternative, lists
|
||||||
use the block syntax shown below.
|
of objects can be created with repeated blocks, using
|
||||||
|
this structure:
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
service {
|
||||||
|
key = "value"
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
key = "value"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Objects and nested objects are created using the structure shown below:
|
Objects and nested objects are created using the structure shown below:
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,13 @@ func (p *Parser) objectList() (*ast.ObjectList, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
node.Add(n)
|
node.Add(n)
|
||||||
|
|
||||||
|
// object lists can be optionally comma-delimited e.g. when a list of maps
|
||||||
|
// is being expressed, so a comma is allowed here - it's simply consumed
|
||||||
|
tok := p.scan()
|
||||||
|
if tok.Type != token.COMMA {
|
||||||
|
p.unscan()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return node, nil
|
return node, nil
|
||||||
}
|
}
|
||||||
|
@ -311,15 +318,20 @@ func (p *Parser) listType() (*ast.ListType, error) {
|
||||||
needComma := false
|
needComma := false
|
||||||
for {
|
for {
|
||||||
tok := p.scan()
|
tok := p.scan()
|
||||||
switch tok.Type {
|
if needComma {
|
||||||
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
|
switch tok.Type {
|
||||||
if needComma {
|
case token.COMMA, token.RBRACK:
|
||||||
|
default:
|
||||||
return nil, &PosError{
|
return nil, &PosError{
|
||||||
Pos: tok.Pos,
|
Pos: tok.Pos,
|
||||||
Err: fmt.Errorf("unexpected token: %s. Expecting %s", tok.Type, token.COMMA),
|
Err: fmt.Errorf(
|
||||||
|
"error parsing list, expected comma or list end, got: %s",
|
||||||
|
tok.Type),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
switch tok.Type {
|
||||||
|
case token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC:
|
||||||
node, err := p.literalType()
|
node, err := p.literalType()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -343,6 +355,18 @@ func (p *Parser) listType() (*ast.ListType, error) {
|
||||||
|
|
||||||
needComma = false
|
needComma = false
|
||||||
continue
|
continue
|
||||||
|
case token.LBRACE:
|
||||||
|
// Looks like a nested object, so parse it out
|
||||||
|
node, err := p.objectType()
|
||||||
|
if err != nil {
|
||||||
|
return nil, &PosError{
|
||||||
|
Pos: tok.Pos,
|
||||||
|
Err: fmt.Errorf(
|
||||||
|
"error while trying to parse object within list: %s", err),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
l.Add(node)
|
||||||
|
needComma = true
|
||||||
case token.BOOL:
|
case token.BOOL:
|
||||||
// TODO(arslan) should we support? not supported by HCL yet
|
// TODO(arslan) should we support? not supported by HCL yet
|
||||||
case token.LBRACK:
|
case token.LBRACK:
|
||||||
|
|
|
@ -525,16 +525,27 @@ func (s *Scanner) scanEscape() rune {
|
||||||
// scanDigits scans a rune with the given base for n times. For example an
|
// scanDigits scans a rune with the given base for n times. For example an
|
||||||
// octal notation \184 would yield in scanDigits(ch, 8, 3)
|
// octal notation \184 would yield in scanDigits(ch, 8, 3)
|
||||||
func (s *Scanner) scanDigits(ch rune, base, n int) rune {
|
func (s *Scanner) scanDigits(ch rune, base, n int) rune {
|
||||||
|
start := n
|
||||||
for n > 0 && digitVal(ch) < base {
|
for n > 0 && digitVal(ch) < base {
|
||||||
ch = s.next()
|
ch = s.next()
|
||||||
|
if ch == eof {
|
||||||
|
// If we see an EOF, we halt any more scanning of digits
|
||||||
|
// immediately.
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
n--
|
n--
|
||||||
}
|
}
|
||||||
if n > 0 {
|
if n > 0 {
|
||||||
s.err("illegal char escape")
|
s.err("illegal char escape")
|
||||||
}
|
}
|
||||||
|
|
||||||
// we scanned all digits, put the last non digit char back
|
if n != start {
|
||||||
s.unread()
|
// we scanned all digits, put the last non digit char back,
|
||||||
|
// only if we read anything at all
|
||||||
|
s.unread()
|
||||||
|
}
|
||||||
|
|
||||||
return ch
|
return ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,70 +826,70 @@
|
||||||
"revision": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
"revision": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "SJIgBfV02h1fsqCAe5DHj/JbHoM=",
|
"checksumSHA1": "ydHBPi04mEh+Tir+2JkpSIMckcw=",
|
||||||
"path": "github.com/hashicorp/hcl",
|
"path": "github.com/hashicorp/hcl",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "IxyvRpCFeoJBGl2obLKJV7RCGjg=",
|
"checksumSHA1": "IxyvRpCFeoJBGl2obLKJV7RCGjg=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/ast",
|
"path": "github.com/hashicorp/hcl/hcl/ast",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
|
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/fmtcmd",
|
"path": "github.com/hashicorp/hcl/hcl/fmtcmd",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "cO89nXP9rKQCcm0zKGbtBCWK2ok=",
|
"checksumSHA1": "l2oQxBsZRwn6eZjf+whXr8c9+8c=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/parser",
|
"path": "github.com/hashicorp/hcl/hcl/parser",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "CSmwxPOTz7GSpnWPF9aGkbVeR64=",
|
"checksumSHA1": "CSmwxPOTz7GSpnWPF9aGkbVeR64=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/printer",
|
"path": "github.com/hashicorp/hcl/hcl/printer",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "WZM0q7Sya8PcGj607x1npgcEPa4=",
|
"checksumSHA1": "FHZ1IXjWHUyuMjy/wQChE4pSoPg=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/scanner",
|
"path": "github.com/hashicorp/hcl/hcl/scanner",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "riN5acfVDm4j6LhWXauqiWH5n84=",
|
"checksumSHA1": "riN5acfVDm4j6LhWXauqiWH5n84=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/strconv",
|
"path": "github.com/hashicorp/hcl/hcl/strconv",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
|
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
|
||||||
"path": "github.com/hashicorp/hcl/hcl/token",
|
"path": "github.com/hashicorp/hcl/hcl/token",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "jQ45CCc1ed/nlV7bbSnx6z72q1M=",
|
"checksumSHA1": "jQ45CCc1ed/nlV7bbSnx6z72q1M=",
|
||||||
"path": "github.com/hashicorp/hcl/json/parser",
|
"path": "github.com/hashicorp/hcl/json/parser",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "S1e0F9ZKSnqgOLfjDTYazRL28tA=",
|
"checksumSHA1": "S1e0F9ZKSnqgOLfjDTYazRL28tA=",
|
||||||
"path": "github.com/hashicorp/hcl/json/scanner",
|
"path": "github.com/hashicorp/hcl/json/scanner",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
|
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
|
||||||
"path": "github.com/hashicorp/hcl/json/token",
|
"path": "github.com/hashicorp/hcl/json/token",
|
||||||
"revision": "61f5143284c041681f76a5b63efcb232aaa94737",
|
"revision": "364df430845abef160a0bfb3a59979f746bf4956",
|
||||||
"revisionTime": "2016-06-24T12:12:30Z"
|
"revisionTime": "2016-07-08T14:13:38Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "vWW3HXm7OTOMISuZPcCSJODRYkU=",
|
"checksumSHA1": "vWW3HXm7OTOMISuZPcCSJODRYkU=",
|
||||||
|
|
Loading…
Reference in New Issue