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

Improvement/pattern parser #141

Merged
merged 8 commits into from
Oct 31, 2023
Merged

Improvement/pattern parser #141

merged 8 commits into from
Oct 31, 2023

Conversation

Mwexim
Copy link
Owner

@Mwexim Mwexim commented Sep 14, 2023

This pull request contains general improvements to the pattern parsing system.

  • Tidied up the pattern parsing logging system.
  • Added a warning when using a pattern such as the one described in issue Parse mark with groups doesn't work. #140 to notify the user of unwanted behavior.
  • Made it so that when a faulty pattern was created, it actually shows the error. Pull request SkriptLogger logs were never finalized for register method #139 didn't actually solve the error at all. Due to the fact that the logger was closed after the registration of the default values, the new errors weren't added correctly.
  • The above also showed an oversight in the PatternInfos class, which was promptly fixed.

Closes #140.

.map(s -> PatternParser.parsePattern(s, logger).orElse(null))
.map(s -> {
var result = PatternParser.parsePattern(s, logger).orElse(null);
logger.finalizeLogs();
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this logger be outside the stream? After all the patterns in the map have parsed, then finalize the logs?

Copy link
Owner Author

Choose a reason for hiding this comment

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

If I recall correctly, finalizing the logs should be done after each parsing attempt, so if it is a pattern or a line of code. The naming could be a bit confusing, but honestly the whole SkriptLogger class lacks propper documentation and it took me a while to figure out as well.

I'll take a look just to be sure.

@Mwexim Mwexim merged commit f2f6ced into master Oct 31, 2023
1 check passed
@Mwexim Mwexim deleted the improvement/pattern-parser branch October 31, 2023 13:13
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.

Parse mark with groups doesn't work.
3 participants