diff --git a/base/toml_parser.jl b/base/toml_parser.jl index 6c4ff6e2a52c0..18166b03e23b3 100644 --- a/base/toml_parser.jl +++ b/base/toml_parser.jl @@ -611,7 +611,7 @@ function _parse_key(l::Parser) else set_marker!(l) if accept_batch(l, isvalid_barekey_char) - if !(peek(l) == '.' || peek(l) == ' ' || peek(l) == ']' || peek(l) == '=') + if !(peek(l) == '.' || iswhitespace(peek(l)) || peek(l) == ']' || peek(l) == '=') c = eat_char(l) return ParserError(ErrInvalidBareKeyCharacter, c) end diff --git a/stdlib/TOML/test/parse.jl b/stdlib/TOML/test/parse.jl index 12f68acbdb5bf..30400344f67cf 100644 --- a/stdlib/TOML/test/parse.jl +++ b/stdlib/TOML/test/parse.jl @@ -14,6 +14,7 @@ using TOML: ParserError TOML.parse(IOBuffer(str)) == TOML.parse(p, str) == TOML.parse(p, SubString(str)) == TOML.parse(p, IOBuffer(str)) == dict + @test TOML.parse("a\t=1") == dict @test_throws ParserError TOML.parse(invalid_str) @test_throws ParserError TOML.parse(SubString(invalid_str)) @test_throws ParserError TOML.parse(IOBuffer(invalid_str))