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

Pattern Keyword Enhancements #6550

Merged

Conversation

APickledWalrus
Copy link
Member

Description

This PR implements some enhancements to the keyword system to further reduce parse times (notably on servers with a larger number of scripts).

Essentially, support is added for starting and ending keywords (keywords that appear at the start/end of a pattern). This allows usage of String#startsWith/String#endsWith over String#contains.

Support is also added for keywords from choice elements. That is, (one|two) may now be represented by a keyword that searches for either one or two in the string. If neither are present, it fails. This supports the starting/ending behavior described above.

As a breaking change, SkriptPattern#getKeywords was removed. I do not believe this method is used by any addons (it is only used in one place in Skript).


Target Minecraft Versions: any
Requirements: none
Related Issues: none

@APickledWalrus APickledWalrus added enhancement Feature request, an issue about something that could be improved, or a PR improving something. breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) labels Apr 11, 2024
@@ -68,24 +67,6 @@ public String toString() {
return first.toFullString();
}

public static String[] getKeywords(PatternElement first) {
Copy link
Member

Choose a reason for hiding this comment

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

We could keep this method with a deprecation notice just in case somebody is still using it.

@Moderocky Moderocky merged commit 32e5ff6 into SkriptLang:dev/feature Apr 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes Pull or feature requests that contain breaking changes (API, syntax, etc.) enhancement Feature request, an issue about something that could be improved, or a PR improving something.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants