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
+7 -2
View File
@@ -253,9 +253,14 @@ func (l *tomlLexer) lexComma() tomlLexStateFn {
func (l *tomlLexer) lexKey() tomlLexStateFn {
l.ignore()
inQuotes := false
for r := l.next(); isKeyChar(r); r = l.next() {
if r == '#' {
return l.errorf("keys cannot contain # character")
if r == '"' {
inQuotes = !inQuotes
} else if isSpace(r) && !inQuotes {
break
} else if !isValidBareChar(r) && !inQuotes {
return l.errorf("keys cannot contain %c character", r)
}
}
l.backup()