diff --git a/decoder_test.go b/decoder_test.go index 89712fd..36e85f6 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -25,8 +25,9 @@ func TestDecode_interface(t *testing.T) { "basic_squish.hcl", false, map[string]interface{}{ - "foo": "bar", - "bar": "${file(\"bing/bong.txt\")}", + "foo": "bar", + "bar": "${file(\"bing/bong.txt\")}", + "foo-bar": "baz", }, }, { diff --git a/hcl/lex.go b/hcl/lex.go index 674f509..8d710e6 100644 --- a/hcl/lex.go +++ b/hcl/lex.go @@ -170,7 +170,7 @@ func (x *hclLex) lexId(yylval *hclSymType) int { break } - if !unicode.IsDigit(c) && !unicode.IsLetter(c) && c != '_' { + if !unicode.IsDigit(c) && !unicode.IsLetter(c) && c != '_' && c != '-' { x.backup() break } diff --git a/test-fixtures/basic_squish.hcl b/test-fixtures/basic_squish.hcl index 9b1c9e4..363697b 100644 --- a/test-fixtures/basic_squish.hcl +++ b/test-fixtures/basic_squish.hcl @@ -1,2 +1,3 @@ foo="bar" bar="${file("bing/bong.txt")}" +foo-bar="baz"