vendor: update HIL

This commit is contained in:
Mitchell Hashimoto 2016-12-09 12:40:34 -05:00
parent b5f1738e17
commit cd1cd1cb7d
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 30 additions and 30 deletions

View File

@ -2,7 +2,6 @@ package parser
import ( import (
"strconv" "strconv"
"strings"
"unicode/utf8" "unicode/utf8"
"github.com/hashicorp/hil/ast" "github.com/hashicorp/hil/ast"
@ -483,26 +482,8 @@ func (p *parser) ParseScopeInteraction() (ast.Node, error) {
}, nil }, nil
} }
varParts := []string{first.Content}
for p.peeker.Peek().Type == scanner.PERIOD {
p.peeker.Read() // eat period
// Read the next item, since variable access in HIL is composed
// of many things. For example: "var.0.bar" is the entire var access.
partTok := p.peeker.Read()
switch partTok.Type {
case scanner.IDENTIFIER:
case scanner.STAR:
case scanner.INTEGER:
default:
return nil, ExpectationError("identifier", partTok)
}
varParts = append(varParts, partTok.Content)
}
varName := strings.Join(varParts, ".")
varNode := &ast.VariableAccess{ varNode := &ast.VariableAccess{
Name: varName, Name: first.Content,
Posx: startPos, Posx: startPos,
} }

View File

@ -479,12 +479,31 @@ func scanIdentifier(s string) (string, int) {
nextRune, size := utf8.DecodeRuneInString(s[byteLen:]) nextRune, size := utf8.DecodeRuneInString(s[byteLen:])
if !(nextRune == '_' || if !(nextRune == '_' ||
nextRune == '-' || nextRune == '-' ||
nextRune == '.' ||
nextRune == '*' ||
unicode.IsNumber(nextRune) || unicode.IsNumber(nextRune) ||
unicode.IsLetter(nextRune) || unicode.IsLetter(nextRune) ||
unicode.IsMark(nextRune)) { unicode.IsMark(nextRune)) {
break break
} }
// If we reach a star, it must be between periods to be part
// of the same identifier.
if nextRune == '*' && s[byteLen-1] != '.' {
break
}
// If our previous character was a star, then the current must
// be period. Otherwise, undo that and exit.
if byteLen > 0 && s[byteLen-1] == '*' && nextRune != '.' {
byteLen--
if s[byteLen-1] == '.' {
byteLen--
}
break
}
byteLen = byteLen + size byteLen = byteLen + size
runeLen = runeLen + 1 runeLen = runeLen + 1
} }

20
vendor/vendor.json vendored
View File

@ -1588,26 +1588,26 @@
{ {
"checksumSHA1": "xONRNgLDc5OqCUmyDN3iBRKmKB0=", "checksumSHA1": "xONRNgLDc5OqCUmyDN3iBRKmKB0=",
"path": "github.com/hashicorp/hil", "path": "github.com/hashicorp/hil",
"revision": "bf046eec69cc383b7f32c47990336409601c8116", "revision": "60db937199ba6f67251aa038cec18ce36a951312",
"revisionTime": "2016-12-04T02:32:26Z" "revisionTime": "2016-12-09T17:20:46Z"
}, },
{ {
"checksumSHA1": "oZ2a2x9qyHqvqJdv/Du3LGeaFdA=", "checksumSHA1": "oZ2a2x9qyHqvqJdv/Du3LGeaFdA=",
"path": "github.com/hashicorp/hil/ast", "path": "github.com/hashicorp/hil/ast",
"revision": "bf046eec69cc383b7f32c47990336409601c8116", "revision": "60db937199ba6f67251aa038cec18ce36a951312",
"revisionTime": "2016-12-04T02:32:26Z" "revisionTime": "2016-12-09T17:20:46Z"
}, },
{ {
"checksumSHA1": "p/zZysJW/AaPXXPCI20nM2arPnw=", "checksumSHA1": "P5PZ3k7SmqWmxgJ8Q0gLzeNpGhE=",
"path": "github.com/hashicorp/hil/parser", "path": "github.com/hashicorp/hil/parser",
"revision": "bf046eec69cc383b7f32c47990336409601c8116", "revision": "60db937199ba6f67251aa038cec18ce36a951312",
"revisionTime": "2016-12-04T02:32:26Z" "revisionTime": "2016-12-09T17:20:46Z"
}, },
{ {
"checksumSHA1": "FlzgVCYqnODad4pKujXhSaGcrIo=", "checksumSHA1": "DC1k5kOua4oFqmo+JRt0YzfP44o=",
"path": "github.com/hashicorp/hil/scanner", "path": "github.com/hashicorp/hil/scanner",
"revision": "bf046eec69cc383b7f32c47990336409601c8116", "revision": "60db937199ba6f67251aa038cec18ce36a951312",
"revisionTime": "2016-12-04T02:32:26Z" "revisionTime": "2016-12-09T17:20:46Z"
}, },
{ {
"path": "github.com/hashicorp/logutils", "path": "github.com/hashicorp/logutils",