Skip to content

TOML parser error when date is followed by comment #47713

@veddox

Description

@veddox

If a TOML file includes a date, a trailing comment causes the parser to break. This was previously described here: https://discourse.julialang.org/t/toml-parsefile-error-on-reading-date-formatted-variable/59681

Minimum Working Example:

# mwe.toml
	
[core]
# these lines are fine
name = "mwe.toml" # here, comments are no problem
version = 1

[extension]
# the next line is fine as long as it has no trailing comment
startdate = 2020-01-01
enddate = 2020-01-05 # <<< this line causes an error
mode = "generic"
julia> using TOML

julia> TOML.parsefile("mwe.toml")
ERROR: TOML Parser error:
/home/xo30xoqa/Documents/Promotion/Persephone/src/mwe.toml:11:22 error: expected newline after key value pair
  enddate = 2020-01-05 # this line causes an error
                       ^                           
Stacktrace:
 [1] parse
   @ ./toml_parser.jl:441 [inlined]
 [2] parsefile(f::String)
   @ TOML /usr/local/lib/julia/share/julia/stdlib/v1.8/TOML/src/TOML.jl:43
 [3] top-level scope
   @ REPL[11]:1

Version info:

Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores

(installed via download from official site)

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions