I have the test.toml file, containing the single line:
period = 2021-04-20 # should be formatted as YYYY-MM-DD
When I try to parse it via:
julia> using TOML
julia> TOML.parsefile("test.toml")
the following error arises:
ERROR: TOML Parser error:
/home/orca/Dropbox/work/study/computing/Julia/sandbox/test.toml:1:21 error: expected newline after key value pair
period = 2021-04-20 # should be of type Date
^
Stacktrace:
[1] parse
@ ./toml_parser.jl:441 [inlined]
[2] parsefile(f::String)
@ TOML /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/TOML/src/TOML.jl:43
[3] top-level scope
@ REPL[2]:1
If I delete the comment: # should be formatted as YYYY-MM-DD
in the original test.toml file, it is correctly parsed:
julia> TOML.parsefile("test.toml")
Dict{String, Any} with 1 entry:
"period" => Date("2021-04-20")
How can I use an end of line comment in the .toml file for a field formatted like period? In principle, I would like to keep the comment, in the same line, to help the user input correctly the value for the variable period
. Of course, there are two ways around this, which Iād rather not use:
(1) move the comment to a line by itself, right before the line declaring period
,
(2) not using any comment at all.
Cheers