Allow numbers in keys parsing

This commit is contained in:
Thomas Pelletier
2015-07-14 19:56:28 -07:00
parent 9f36448571
commit 16a681db2a
6 changed files with 41 additions and 16 deletions
+10 -4
View File
@@ -124,10 +124,7 @@ func TestKeyWithSharpAndEqual(t *testing.T) {
func TestKeyWithSymbolsAndEqual(t *testing.T) {
testFlow(t, "~!@$^&*()_+-`1234567890[]\\|/?><.,;:' = 5", []token{
token{Position{1, 1}, tokenKey, "~!@$^&*()_+-`1234567890[]\\|/?><.,;:'"},
token{Position{1, 38}, tokenEqual, "="},
token{Position{1, 40}, tokenInteger, "5"},
token{Position{1, 41}, tokenEOF, ""},
token{Position{1, 1}, tokenError, "keys cannot contain ~ character"},
})
}
@@ -549,3 +546,12 @@ func TestKeyGroupArray(t *testing.T) {
token{Position{1, 8}, tokenEOF, ""},
})
}
func TestQuotedKey(t *testing.T) {
testFlow(t, "\"a b\" = 42", []token{
token{Position{1, 1}, tokenKey, "\"a b\""},
token{Position{1, 7}, tokenEqual, "="},
token{Position{1, 9}, tokenInteger, "42"},
token{Position{1, 11}, tokenEOF, ""},
})
}