Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions base/toml_parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,6 @@ function parse_number_or_date_start(l::Parser)
ate && return parse_int(l, contains_underscore)
elseif accept(l, isdigit)
return parse_local_time(l)
elseif peek(l) !== '.'
return ParserError(ErrLeadingZeroNotAllowedInteger)
end
end

Expand Down
13 changes: 11 additions & 2 deletions stdlib/TOML/docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ format.
```jldoctest
julia> using TOML

julia> fname = tempname();

julia> data = Dict(
"names" => ["Julia", "Julio"],
"age" => [10, 20],
Expand All @@ -75,6 +73,17 @@ julia> data = Dict(
julia> TOML.print(data)
names = ["Julia", "Julio"]
age = [10, 20]

julia> fname = tempname();

julia> open(fname, "w") do io
TOML.print(io, data)
end

julia> TOML.parsefile(fname)
Dict{String, Any} with 2 entries:
"names" => ["Julia", "Julio"]
"age" => [10, 20]
```

Keys can be sorted according to some value
Expand Down
5 changes: 3 additions & 2 deletions stdlib/TOML/test/values.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ end
@test testval("1.0e0" , 1.0)
@test testval("1.0e+0" , 1.0)
@test testval("1.0e-0" , 1.0)
@test testval("0e-3" , 0.0)
@test testval("1.001e-0" , 1.001)
@test testval("2e10" , 2e10)
@test testval("2e+10" , 2e10)
Expand All @@ -53,8 +54,8 @@ end
@test testval("+1_000" , 1000 |> Int64)
@test testval("-1_000" , -1000 |> Int64)

@test failval("0_" , Internals.ErrLeadingZeroNotAllowedInteger)
@test failval("0__0" , Internals.ErrLeadingZeroNotAllowedInteger)
@test failval("0_" , Internals.ErrUnderscoreNotSurroundedByDigits)
@test failval("0__0" , Internals.ErrUnderscoreNotSurroundedByDigits)
@test failval("__0" , Internals.ErrUnexpectedStartOfValue)
@test failval("1_0_" , Internals.ErrTrailingUnderscoreNumber)
@test failval("1_0__0" , Internals.ErrUnderscoreNotSurroundedByDigits)
Expand Down