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
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:
Ideally the error context stops at the
}
. At the moment the compared error string appears to be controlled by the longeststring
inbody
, which can be observed by removing theselectordinal
branch:When what I really want is: