diff --git a/decoder_test.go b/decoder_test.go index 10fb6df..89712fd 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -21,6 +21,14 @@ func TestDecode_interface(t *testing.T) { "bar": "${file(\"bing/bong.txt\")}", }, }, + { + "basic_squish.hcl", + false, + map[string]interface{}{ + "foo": "bar", + "bar": "${file(\"bing/bong.txt\")}", + }, + }, { "empty.hcl", false, diff --git a/hcl/lex.go b/hcl/lex.go index 43fade1..674f509 100644 --- a/hcl/lex.go +++ b/hcl/lex.go @@ -170,7 +170,7 @@ func (x *hclLex) lexId(yylval *hclSymType) int { break } - if unicode.IsSpace(c) { + if !unicode.IsDigit(c) && !unicode.IsLetter(c) && c != '_' { x.backup() break } diff --git a/test-fixtures/basic_squish.hcl b/test-fixtures/basic_squish.hcl new file mode 100644 index 0000000..9b1c9e4 --- /dev/null +++ b/test-fixtures/basic_squish.hcl @@ -0,0 +1,2 @@ +foo="bar" +bar="${file("bing/bong.txt")}"