toml-rs / toml

Rust TOML Parser
https://docs.rs/toml
Apache License 2.0
725 stars 107 forks source link

Error messages for `value=[zzz]` are not helpful #293

Open epage opened 2 years ago

epage commented 2 years ago

While value=zzz provides a nice error message (unexpected z, expected quoted string), but not value=[zzz] (Expected 'newline' or '#') because of challenges with parsing optional trailing commas

stewartli commented 1 year ago

hi, the document says that I can do the following. However, the toml result has a issue of trailing comma. Does it relate to this github issue? Thanks. For instance,
doc["a"]["b"]["c"]["d1"] = value("hello1"); { d1 = "hello1" } doc["a"]["b"]["c"]["d2"] = value("hello2"); { d1 = "hello1" , d2 = "hello2" } image

epage commented 1 year ago

This issue is only about the quality of an error message in a case that is suppose to error. I would recommend creating a dedicated issue or discussion and include a full minimal reproduction case with actual output and expected so we can know how to help you.