Skip to content

Commit 8180240

Browse files
authored
Allow tab after key name in TOML.parse (#51622)
Fixes JuliaLang/TOML.jl#52
1 parent 72779b5 commit 8180240

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

base/toml_parser.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ function _parse_key(l::Parser)
611611
else
612612
set_marker!(l)
613613
if accept_batch(l, isvalid_barekey_char)
614-
if !(peek(l) == '.' || peek(l) == ' ' || peek(l) == ']' || peek(l) == '=')
614+
if !(peek(l) == '.' || iswhitespace(peek(l)) || peek(l) == ']' || peek(l) == '=')
615615
c = eat_char(l)
616616
return ParserError(ErrInvalidBareKeyCharacter, c)
617617
end

stdlib/TOML/test/parse.jl

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ using TOML: ParserError
1414
TOML.parse(IOBuffer(str)) ==
1515
TOML.parse(p, str) == TOML.parse(p, SubString(str)) ==
1616
TOML.parse(p, IOBuffer(str)) == dict
17+
@test TOML.parse("a\t=1") == dict
1718
@test_throws ParserError TOML.parse(invalid_str)
1819
@test_throws ParserError TOML.parse(SubString(invalid_str))
1920
@test_throws ParserError TOML.parse(IOBuffer(invalid_str))

0 commit comments

Comments
 (0)