Merge pull request #65 from hashicorp/b-map-identifiers

Fix scanning of identifiers of the form 'map.key'
This commit is contained in:
James Nugent 2015-11-24 17:42:28 +02:00
commit 692d016087
3 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -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()
}

3
test-fixtures/tfvars.hcl Normal file
View File

@ -0,0 +1,3 @@
regularvar = "Should work"
map.key1 = "Value"
map.key2 = "Other value"