Allow spaces when using dotted keys in assignment (#402)

Fixes #401
This commit is contained in:
x-hgg-x
2020-05-07 14:11:29 +02:00
committed by GitHub
parent 96ff402934
commit 9ba7363552
2 changed files with 34 additions and 6 deletions
+20 -1
View File
@@ -330,7 +330,26 @@ func (l *tomlLexer) lexKey() tomlLexStateFn {
} else if r == '\n' {
return l.errorf("keys cannot contain new lines")
} else if isSpace(r) {
break
str := " "
// skip trailing whitespace
l.next()
for r = l.peek(); isSpace(r); r = l.peek() {
str += string(r)
l.next()
}
// break loop if not a dot
if r != '.' {
break
}
str += "."
// skip trailing whitespace after dot
l.next()
for r = l.peek(); isSpace(r); r = l.peek() {
str += string(r)
l.next()
}
growingString += str
continue
} else if r == '.' {
// skip
} else if !isValidBareChar(r) {