diff --git a/decoder_test.go b/decoder_test.go index 116b400..9ff4243 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -43,6 +43,15 @@ func TestDecode_interface(t *testing.T) { }, }, }, + { + "tfvars.hcl", + false, + map[string]interface{}{ + "regularvar": "Should work", + "map.key1": "Value", + "map.key2": "Other value", + }, + }, { "escape.hcl", false, diff --git a/hcl/scanner/scanner.go b/hcl/scanner/scanner.go index 306c899..a46cfdc 100644 --- a/hcl/scanner/scanner.go +++ b/hcl/scanner/scanner.go @@ -516,7 +516,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune { func (s *Scanner) scanIdentifier() string { offs := s.srcPos.Offset - s.lastCharLen ch := s.next() - for isLetter(ch) || isDigit(ch) || ch == '-' { + for isLetter(ch) || isDigit(ch) || ch == '-' || ch == '.' { ch = s.next() } diff --git a/test-fixtures/tfvars.hcl b/test-fixtures/tfvars.hcl new file mode 100644 index 0000000..5f623e0 --- /dev/null +++ b/test-fixtures/tfvars.hcl @@ -0,0 +1,3 @@ +regularvar = "Should work" +map.key1 = "Value" +map.key2 = "Other value"