Skip to content

Lower implicit priority for syntaxes involving regular expressions#8536

Merged
UnderscoreTud merged 2 commits intoSkriptLang:dev/patchfrom
bluelhf:fix/regexful-implicit-priority
Apr 15, 2026
Merged

Lower implicit priority for syntaxes involving regular expressions#8536
UnderscoreTud merged 2 commits intoSkriptLang:dev/patchfrom
bluelhf:fix/regexful-implicit-priority

Conversation

@bluelhf
Copy link
Copy Markdown
Contributor

@bluelhf bluelhf commented Apr 13, 2026

Problem

As documented by @TheLimeGlass in issue #8534, Skript prefers EffDoIf(ExprDefaultValue) over ExprTernary in situations where do-if should have lower priority. This is because EffDoIf does not declare its priority as PATTERN_MATCHES_EVERYTHING despite involving the regular expression <.+> in its pattern. The current implementation for calculating the implicit priority of a syntax does not take regular expressions into account, even though it could; PATTERN_MATCHES_EVERYTHING is intended precisely for syntaxes that have these kinds of regular expressions.

Solution

A general solution is given. This PR adjusts the implicit priority calculation to automatically apply a priority of PATTERN_MATCHES_EVERYTHING to syntaxes that use regular expressions (have an angle bracket in one or more of their patterns). An additional conditional case is added to estimatePriority in SyntaxInfoImpl.

Testing Completed

I verified that this change solves the issue documented in #8534, and does not break our tests (using quickTest). I've also used skUnity Docs to identify all syntaxes that have a pattern that includes a regular expression, and did not immediately see any patterns that could reasonably break because of these changes. A tab-separated list of all syntaxes documented on skUnity containing &lt; in their pattern (as retrieved from the skUnity Docs API) is given.1

Supporting Information

All skUnity syntaxes can be retrieved using an API key from the URL https://api.skunity.com/v1/API_KEY_HERE/docs/getAllSyntax. I used my own personal API key, which I found on the skUnity Dashboard.


Completes: #8534
Related: Discussion on the SkriptLang Discord
AI assistance: For creating the JQ pattern that exported syntax patterns containing &lt; from the skUnity getAllSyntax JSON

Footnotes

  1. regexful.csv on GitHub Gist

@bluelhf bluelhf requested review from a team and APickledWalrus as code owners April 13, 2026 17:39
@bluelhf bluelhf requested review from Burbulinis and removed request for a team April 13, 2026 17:39
Copy link
Copy Markdown
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

I think this is fine as a default assumption. Nice solution

@bluelhf bluelhf force-pushed the fix/regexful-implicit-priority branch from 2281210 to 3b651aa Compare April 13, 2026 17:42
@sovdeeth sovdeeth added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label Apr 13, 2026
@github-project-automation github-project-automation bot moved this to Awaiting Merge in 2.15 Releases Apr 13, 2026
@UnderscoreTud UnderscoreTud merged commit aab376c into SkriptLang:dev/patch Apr 15, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from Awaiting Merge to Done - Awaiting Release in 2.15 Releases Apr 15, 2026
@bluelhf bluelhf deleted the fix/regexful-implicit-priority branch April 15, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue that needs to be fixed. Alternatively, a PR fixing an issue.

Projects

Status: Done - Awaiting Release

Development

Successfully merging this pull request may close these issues.

4 participants