Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Track position in file after parsing in TOML AST to produce better error messages #303

Open
chshersh opened this issue May 18, 2020 · 0 comments
Labels
ast Type of TOML parser Everything related to `Text -> Toml`

Comments

@chshersh
Copy link
Contributor

We have two stages for converting TOML to Haskell types:

  1. Parsing
  2. Decoding

Decoding works with a generic TOML representation. But this representation doesn't record the source positions of TOML entries from file. If we can come up with a way to track positions of TOML entries in files, we can improve the quality of error messages and instead of:

tomland decode error:  Type for key name doesn't match.
  Expected: Text
  Actual:   Integer

we can output something like this

tomland decode error:  Type for key name doesn't match.
  Expected: Text
  Actual:   Integer

example.toml
  3 |
  4 | name = 42
  5 | ^^^^^^^^^
@chshersh chshersh added ast Type of TOML parser Everything related to `Text -> Toml` labels May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Type of TOML parser Everything related to `Text -> Toml`
Projects
None yet
Development

No branches or pull requests

1 participant