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

Scoped interpolation type parse errors #118

Open
samhh opened this issue May 5, 2022 · 0 comments
Open

Scoped interpolation type parse errors #118

samhh opened this issue May 5, 2022 · 0 comments

Comments

@samhh
Copy link
Contributor

samhh commented May 5, 2022

Not important but I'm trying to learn how to do this in megaparsec.

Here's what a bad type parse error might currently look like:

./file.json:3:21:
  |
3 |     "message": "{x, bad}"
  |                     ^^^^^^
unexpected "bad}"<newline>  }<newline>}<newline>"
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space

Ideally the error context stops at the }. At the moment the compared error string appears to be controlled by the longest string in body, which can be observed by removing the selectordinal branch:

./file.json:3:21:
  |
3 |     "message": "{x, bad}"
  |                     ^^^^^^
unexpected "bad}"<newline> "
expecting "boolean", "date", "number", "plural", "select", "time", or white space

When what I really want is:

./file.json:3:21:
  |
3 |     "message": "{x, bad}"
  |                     ^^^
unexpected "bad"
expecting "boolean", "date", "number", "plural", "select", "selectordinal", "time", or white space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant