Fix key parsing in line tables (#311)

A bug was reported that indicated that inline tables did not fully support bare keys:
$ echo 'foo = { -bar => "buz"}' | ./tomljson
(1, 9): unexpected token type in inline table: Error

$ echo 'foo = { "whatever" = "buz"}' | ./tomljson
(1, 10): unexpected token type in inline table: String

echo 'foo = { _no = "buz"}' | ./tomljson
(1, 9): unexpected token type in inline table: Error

This change makes a couple of tweaks to to allow for all key variants in inline tables

Fixes: #282
This commit is contained in:
Jonathan Lloyd
2019-10-21 01:36:14 +01:00
committed by Thomas Pelletier
parent e87c92d4f4
commit bef0f57967
4 changed files with 97 additions and 8 deletions
+2 -2
View File
@@ -247,13 +247,13 @@ func (l *tomlLexer) lexRvalue() tomlLexStateFn {
func (l *tomlLexer) lexLeftCurlyBrace() tomlLexStateFn {
l.next()
l.emit(tokenLeftCurlyBrace)
return l.lexRvalue
return l.lexVoid
}
func (l *tomlLexer) lexRightCurlyBrace() tomlLexStateFn {
l.next()
l.emit(tokenRightCurlyBrace)
return l.lexRvalue
return l.lexVoid
}
func (l *tomlLexer) lexDate() tomlLexStateFn {