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

parser recovery at item level #4964

Merged
merged 7 commits into from
Aug 18, 2023
Merged

parser recovery at item level #4964

merged 7 commits into from
Aug 18, 2023

Conversation

xunilrj
Copy link
Contributor

@xunilrj xunilrj commented Aug 16, 2023

Description

Closes #4910.
Closes #4909.
Closes #4908

The trait Parse now contains a do-nothing error function that returns the error variant for that item, if it has one. This allows generic parsing functions like Vec, Annotated etc... to be able to recover and continue if desired.

Now the parser continues even if strange things at the item level.

image

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@xunilrj xunilrj self-assigned this Aug 16, 2023
@xunilrj xunilrj changed the title Xunilrj/recovery item parser recovery at item level Aug 16, 2023
@xunilrj xunilrj marked this pull request as ready for review August 17, 2023 11:52
@xunilrj xunilrj requested a review from a team August 17, 2023 11:52
@JoshuaBatty JoshuaBatty added the compiler: parser Everything to do with the parser label Aug 18, 2023
JoshuaBatty
JoshuaBatty previously approved these changes Aug 18, 2023
Copy link
Member

@JoshuaBatty JoshuaBatty left a comment

Choose a reason for hiding this comment

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

Looks good.

@JoshuaBatty JoshuaBatty requested a review from a team August 18, 2023 00:06
ironcev
ironcev previously approved these changes Aug 18, 2023
Copy link
Member

@ironcev ironcev left a comment

Choose a reason for hiding this comment

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

My comments are in files, but nothing worth postponing the merge.

sway-parse/src/parser.rs Show resolved Hide resolved
sway-parse/src/parser.rs Show resolved Hide resolved
sway-parse/src/parse.rs Show resolved Hide resolved
@xunilrj
Copy link
Contributor Author

xunilrj commented Aug 18, 2023

@JoshuaBatty @ironcev I had to rebase and fix a conflict. Can I get a "re-review" here? The rest is the same.

@JoshuaBatty JoshuaBatty requested a review from a team August 18, 2023 09:11
@tritao tritao merged commit 771865c into master Aug 18, 2023
30 checks passed
@tritao tritao deleted the xunilrj/recovery-item branch August 18, 2023 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: parser Everything to do with the parser
Projects
None yet
4 participants