Merge pull request #7048 from hashicorp/b-update-hcl

Update HCL to latest version
This commit is contained in:
Paul Hinze
2016-06-07 14:36:55 -05:00
4 changed files with 40 additions and 27 deletions

View File

@@ -1,9 +0,0 @@
y.output
# ignore intellij files
.idea
*.iml
*.ipr
*.iws
*.test

View File

@@ -1,3 +0,0 @@
sudo: false
language: go
go: 1.5

View File

@@ -49,7 +49,8 @@ func Unquote(s string) (t string, err error) {
for len(s) > 0 {
// If we're starting a '${}' then let it through un-unquoted.
// Specifically: we don't unquote any characters within the `${}`
// section, except for escaped quotes, which we handle specifically.
// section, except for escaped quotes and escaped backslashes, which we
// handle specifically.
if s[0] == '$' && len(s) > 1 && s[1] == '{' {
buf = append(buf, '$', '{')
s = s[2:]
@@ -64,10 +65,12 @@ func Unquote(s string) (t string, err error) {
s = s[size:]
// We special case escaped double quotes in interpolations, converting
// them to straight double quotes.
// We special case escaped double quotes and escaped backslashes in
// interpolations, converting them to their unescaped equivalents.
if r == '\\' {
if q, _ := utf8.DecodeRuneInString(s); q == '"' {
q, _ := utf8.DecodeRuneInString(s)
switch q {
case '"', '\\':
continue
}
}