-
-
Notifications
You must be signed in to change notification settings - Fork 407
Improve default syntax ordering #8076
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
Improve default syntax ordering #8076
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can go further with the complexity eval but this is a fine start.
src/main/java/org/skriptlang/skript/registration/SyntaxRegister.java
Outdated
Show resolved
Hide resolved
We may also consider improving this in the future by storing compiled patterns on every SyntaxInfo and instead iteratoring over the pattern elements. That requires a more complex rework, so this should suffice for a patch. |
Problem
#7879 changed syntax ordering so that it was no longer dependent on when the syntax was registered. However, most syntax is not using Priority yet, meaning more complex syntax (i.e. harder to parse) such as EffVisualEffect is being attempted early on in some cases (when it should instead be saved for last).
Solution
While these more complex syntaxes should have a higher priority, I have created a simple metric for determining the "complexity" of a syntax. Currently, the metric simply considers how many percent signs a pattern contains (they have not yet been compiled and i didn't think it was worth doing that). The idea is that
percent signs = expressions
andmore expressions = more complex
(harder to parse) which is generally trueTesting Completed
n/a
Supporting Information
Completes: none
Related: none