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

feat(#3742): Split ParsingErrors on Two Separate Classes #3751

Merged
merged 11 commits into from
Dec 25, 2024

Conversation

volodya-lombrozo
Copy link
Member

In this PR I:

  1. Createad a separate package errors for all error handlers and realted classes.
  2. Split ParsingErrors on EoParserErrors and ParsingErrors
  3. Added supplementary classes like Lines and ErrorDirectives to share common logic across all the new classes.

When this PR seems having a lot of lines, it just moves some parts of the code across the codebase.

Closes: #3742.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Could you review these changes, please?

Copy link
Member

@yegor256 yegor256 left a comment

Choose a reason for hiding this comment

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

@volodya-lombrozo looks interesting, a few comment above

@volodya-lombrozo
Copy link
Member Author

@yegor256 Could you have a look one more time, please?

@yegor256
Copy link
Member

@volodya-lombrozo the naming of classes is rather confusing here: they look almost the same. Why don't you use the names suggested in the puzzle: ParserErrors and LexerErrors?

@volodya-lombrozo
Copy link
Member Author

@volodya-lombrozo the naming of classes is rather confusing here: they look almost the same. Why don't you use the names suggested in the puzzle: ParserErrors and LexerErrors?

@yegor256 I agree that the naming here is confusing. Let me try to explain. Before that PR, we had only one error listener: ParsingErrors, and that's all. I thought it would be fine to split it into two separate parts—LexerErrors and ParserErrors. When I started implementing this PR, I noticed that you were using the same ParsingErrors for both EoSyntax and PhiSyntax, which works fine until we implement language-specific error messages. So, instead of LexerErrors and ParserErrors, I would have to create EoLexerErrors, EoParserErrors, PhiLexerErrors, and PhiParserErrors. That would result in too many classes (and I wouldn't be able to sell that idea to you! 😊). As a result, I decided to leave ParsingErrors as it is and simply add one more class: DrEoParserErrors, specifically for EO errors. Please feel free to ask questions if anything is unclear.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Recent changes:

  1. Renamed ParsingErrors -> GeneralErrors (?)
  2. Removed package
  3. GeneralErrors and EoParserErrors don't implement Iterable<Directive> anymore. They create directives through the directive() method instead.

Copy link
Member

@yegor256 yegor256 left a comment

Choose a reason for hiding this comment

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

@volodya-lombrozo it's much better now! please, see my comments above

@volodya-lombrozo
Copy link
Member Author

@yegor256 Please review these changes: fbbaa29. I can accommodate your suggestions in this manner (it's the only way). If you don't like the solution, we can revert them.

@yegor256
Copy link
Member

yegor256 commented Dec 25, 2024

@volodya-lombrozo can't you simply calculate the size of Iterable with the help of LengthOf from Cactoos? This Errors class looks redundant here. It only complicates the design adding no value: the user already knows what is "iterable", making him learn a new paradigm "errors" is a burden for him.

@volodya-lombrozo
Copy link
Member Author

@yegor256 Sure, please, check this one: d4764a6
I've done it. However, I don't prefer such a solution because we hide an abstraction, that we actually have. Although, I should admit, that we have less code now.

Copy link
Member

@yegor256 yegor256 left a comment

Choose a reason for hiding this comment

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

LGTM

@yegor256 yegor256 added this pull request to the merge queue Dec 25, 2024
Merged via the queue into objectionary:master with commit 71e3409 Dec 25, 2024
20 checks passed
@yegor256
Copy link
Member

@volodya-lombrozo thanks!

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.

ParsingErrors.java:49-52: Split {@link ParsingErrors}...
2 participants