nix-community / rnix-parser

A Nix parser written in Rust [maintainer=@oberblastmeister]
MIT License
364 stars 44 forks source link

More helpful error messages #56

Open aaronjanse opened 2 years ago

aaronjanse commented 2 years ago

It would be great if rnix-parser has errors more descriptive than "unexpected X," perhaps prompting the user how to fix the code if we can guess what's missing (e.g. a semicolon for the last value in an attr set)?

Existing error messages at the time of writing:

https://github.com/nix-community/rnix-parser/blob/fa6dddecb848f813e7973be3d82ad8666e98eb8e/src/parser.rs#L22-L37

Ma27 commented 2 years ago

Seems reasonable. Will be out of scope for 0.10. though, hope that's OK :)

Ma27 commented 2 years ago

In case someone wants to take over, feel free.... Otherwise I'll look into it as soon as we're working on 1.0.

elikoga commented 1 year ago

Just to be clear, this is about improving the Display impl for ParseError? As in expanding on the strings

See https://github.com/nix-community/rnix-parser/blob/01e65829a56b772ad37881ab51680ff8fcd45de3/src/parser.rs#L43-L79