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

Rework errors in compiler/parser #5128

Merged
merged 1 commit into from
May 31, 2024
Merged

Rework errors in compiler/parser #5128

merged 1 commit into from
May 31, 2024

Conversation

nwt
Copy link
Member

@nwt nwt commented May 31, 2024

This is based on #5122, from which compiler/parser/source.go and the parser.Error.Error implementation are copied.


  • Add ErrorList, a list of Errors, and SourceSet, a struct containing Zed program text and source file offsets. In the future, compiler/semantic will use these types to return multiple errors that point into the program.

  • Remove ImproveError and NewError.

  • Change ParseZed to return an ErrorList when Parse fails.

  • Change ParseZed and ConcatSource to return a SourceSet.

  • In api.Error, replace the Info interface{} field with ComplationErrors parser.ErrorList.

* Add ErrorList, a list of Errors, and SourceSet, a struct containing
  Zed program text and source file offsets.  In the future,
  compiler/semantic will use these types to return multiple errors that
  point into the program.

* Remove ImproveError and NewError.

* Change ParseZed to return an ErrorList when Parse fails.

* Change ParseZed and ConcatSource to return a SourceSet.

* In api.Error, replace the `Info interface{}` field with
  `ComplationErrors parser.ErrorList`.

Co-authored-by: Matthew Nibecker <hello@mattnibecker.com>
@nwt nwt requested a review from a team May 31, 2024 16:02
@mattnibs mattnibs mentioned this pull request May 31, 2024
@nwt nwt merged commit 4365d5c into main May 31, 2024
4 checks passed
@nwt nwt deleted the parser.ErrorList branch May 31, 2024 19:51
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.

2 participants