Open czerwinskilukasz1 opened 4 years ago
Currently parser errors are neither short nor easy to read. First of all, the location should be much much shorter. Ideally, the message should be more friendly too.
A standard error looks like this:
SyntaxError: Expected " ", "(", ".", "//", ":", "[", "\n", "\r", "\t", [/], or [\-<>+*\^%=&|] but "'" found. Location: { "start": { "offset": 5, "line": 1, "column": 6 }, "end": { "offset": 6, "line": 1, "column": 7 } }
An error when user forgot a closing brace looks like this: Program:
ask { a
Error:
SyntaxError: Expected " ", "(", ".", "//", ":", ";", "=", "[", "\n", "\r", "\t", "}", [/], [\-<>+*\^%=&|], or [_$a-zA-Z0-9] but end of input found. Location: { "start": { "offset": 11, "line": 2, "column": 6 }, "end": { "offset": 11, "line": 2, "column": 6 } }
Some food for thought at https://github.com/pegjs/pegjs/issues/607#issuecomment-479127423 and following comments.
Currently parser errors are neither short nor easy to read. First of all, the location should be much much shorter. Ideally, the message should be more friendly too.
A standard error looks like this:
An error when user forgot a closing brace looks like this: Program:
Error: