Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): embed errors into the ast from the parser (#635)
This change embeds errors into the AST when it is produced by the parser. Ideally, we want to have the parser generate the best AST it can and the current parser doesn't do that. But, making that parser will take too long at the current moment and we still need to record when we see an invalid token. This change modifies `expect()` to record that it saw the wrong token and then continue doing what it was already doing. When a node is materialized, these aggregated errors are attached to the node. Expect this functionality to change in the future while the mechanisms for accessing errors will stay the same. This method does not give very informative error messages and also does not retain the ability to recreate the source code from the AST, but it does tell you if there's a valid or invalid input that was consumed by the parser.
- Loading branch information