microparsec
microparsec copied to clipboard
Ensure expected items get nicely printed in error messages
In particular, we should review and test when expected items are zero (should assert that never happens), one, two, and three or more things long.
Those lists in errors should follow some rules:
- [ ] lines and column numbers start at 1
- [ ] when expecting a single
char1:2: | 1 | adc | ^ unexpected 'd' expecting 'b' - [ ] when expecting a single
string1:1: | 1 | bar | ^ unexpected "bar" expecting "foo" - [ ] when expecting a
charor a label1:3: | 1 | aabbb | ^ unexpected 'b' expecting 'a' or end of input - [ ] when expecting one of many
strings1:1: | 1 | <empty line> | ^ unexpected end of input expecting "data", "file", "ftp", "http", "https", "irc", or "mailto" - [ ] when the cursor is at the end of the input
1:4: | 1 | irc | ^ unexpected end of input expecting ':' - [ ] when the cursor is at an empty line
1:1: | 1 | <empty line> | ^ unexpected end of input expecting list item
Examples above are from Megaparsec (see them here).