Open
Description
Syntax errors look like this right now:
$ eslc <<< "("
/home/an/code/eslisp/node_modules/sexpr-plus/index.js:1054
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
^
SyntaxError: Expected ")", comment or whitespace but end of input found.
The SyntaxError
-object sexpr-plus returns has line
and column
properties. We should perhaps use them.
Invalid AST errors look like this:
$ eslc <<< "(+ x %)"
{ [InvalidAstError: Identifier `name` member must be a valid IdentifierName]
node: { type: 'Identifier', name: '%' },
message: 'Identifier `name` member must be a valid IdentifierName' }
x + %;
That's already getting there, but it would still be best if exact positions in code were passed on to AST nodes, so the error reporter could point out the exact in-source position that an error happened.