Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the parser recover from all errors and continue parsing #238

Merged
merged 51 commits into from
Nov 6, 2018

Conversation

aantron
Copy link
Contributor

@aantron aantron commented Nov 6, 2018

This PR turns all errors in the parser into warnings, after emitting each of which the parser recovers in some way, and continues parsing. The warnings are mostly the same as the errors that the parser used to emit (and stop), except for the reference parser, which has new detailed warnings replacing the generic exceptions it used to raise.

This is most of what is still needed for solving #108, "New docstrings parser too strict." I've been running the recovering parser on most of the repos in the janestreet organization with good results, but there is some other work to be done for #108 that is not as directly related to the parser, so I'll post in #108 when that is finished.

See the test cases for examples of recoveries. Most of them are straightforward (the parser can simply continue parsing). A few require new code that is not completely trivial. I think we will improve some of these latter over time, according to how often people actually need them.

The type of the parser has changed. The parser no longer returns a result, because it does not generate Error _.

cc @trefis, @lpw25

I don't think it's realistic to review the whole PR, though the main code changes (in src/) are not too bad. So, the cc is just FYI :) We can fix things before merge in this PR, and after merge in master as needed.

The new direct dependency on Rresult does not change the dependency cone
of odoc, as it already transitively depends on Rresult through Bos.
If a closing '}' can be found, the content is emitted as a code block.
Otherwise, the opening markup is emitted as a word. In either case, a
warning about bad markup is emitted.
@aantron aantron merged commit e8f7dcf into master Nov 6, 2018
@aantron
Copy link
Contributor Author

aantron commented Nov 6, 2018

Merged to avoid growing conflicts, since the changes, while not very complex, touch almost all parts of the parser a little bit, and touch every test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant