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

Support for parsing input that forms a valid prefix #2053

Merged
merged 10 commits into from
Oct 15, 2024

Conversation

PieterOlivier
Copy link
Contributor

@PieterOlivier PieterOlivier commented Oct 14, 2024

Previously, if an input string was a valid prefix parsing would fail. This was often the case after error recovery, especially in Rascal files.
This PR adds support for recovering from such a parse error. When this situation is encountered, an error node is generated that skips zero characters at the end of the file.

This PR also adds support in the Rascal error recovery api to access multiple error nodes after disambiguation.

It also refactores and extends the test code.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 39.62264% with 32 lines in your changes missing coverage. Please review.

Project coverage is 49%. Comparing base (bdee4f4) to head (10ce970).
Report is 11 commits behind head on feat/error-recovery.

Files with missing lines Patch % Lines
...rg/rascalmpl/parser/util/ParseStateVisualizer.java 0% 27 Missing ⚠️
src/org/rascalmpl/parser/util/DebugUtil.java 0% 4 Missing ⚠️
src/org/rascalmpl/parser/gtd/SGTDBF.java 93% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##             feat/error-recovery   #2053   +/-   ##
=====================================================
  Coverage                     49%     49%           
- Complexity                  6581    6582    +1     
=====================================================
  Files                        685     685           
  Lines                      61102   61127   +25     
  Branches                    8835    8840    +5     
=====================================================
+ Hits                       30174   30197   +23     
- Misses                     28715   28723    +8     
+ Partials                    2213    2207    -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@DavyLandman DavyLandman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PieterOlivier PieterOlivier merged commit a445203 into feat/error-recovery Oct 15, 2024
6 of 7 checks passed
@DavyLandman DavyLandman mentioned this pull request Oct 15, 2024
toinehartman pushed a commit that referenced this pull request Oct 16, 2024
Support for parsing input that forms a valid prefix
toinehartman pushed a commit that referenced this pull request Oct 21, 2024
Support for parsing input that forms a valid prefix
toinehartman pushed a commit that referenced this pull request Oct 21, 2024
Support for parsing input that forms a valid prefix
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.

3 participants