-
Notifications
You must be signed in to change notification settings - Fork 90
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Since the parser now recovers from all errors, it always returns a value, perhaps with warnings.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 generateError _
.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 inmaster
as needed.