Skip to content

Conversation

@mschae23
Copy link
Contributor

@mschae23 mschae23 commented Sep 23, 2025

Add or operator to advanced skip options, as well as not (which is syntactic sugar).

The new parser uses conventional precedence (not binds more tightly than and, which binds more tightly than or) and supports parentheses to override it. When converting the config back to text, parentheses will always be added when multiple operators are used, for clarity.

These changes do mean the advanced skip options language is now context-free instead of regular, so no more parsing with regex :)

I have not measured the performance changes in any way though, so I unfortunately couldn't tell you whether this is faster or slower than before.

Because I unfortunately do not know how to add a migration for it, previously saved skip options will fail to load on this version. For testing, you can run browser.storage.local.set({"skipRules": []}); (back up your config before doing this!) in the about:debugging console for SponsorBlock. However, there should definitely be some kind of automatic fix before this can be used in production.

I have now written a migration for the storage format, which should hopefully™ be working.

The wiki page also requires changes to document the new features. For that, see https://wiki.sponsor.ajay.app/w/Advanced_skip_options/Draft.


I agree to license my contribution under GPLv3 (or any later version) and agree to allow distribution on app stores as outlined in LICENSE-APPSTORE

To test this branch, follow the instructions on the GitHub wiki that haven't been migrated to the real wiki yet for some reason

@ajayyy ajayyy marked this pull request as draft September 23, 2025 20:55
- Keywords and operators were previously matching too eagerly. For example, `ifcategory` would be matched as two tokens `if` `category` and result in a valid file. This is now a single error token.
- Strings previously allowed line breaks in them. This has been fixed, strings only consume up to the end of the line now.
- the error message for error tokens has been improved by using JSON escape.
and revert skip action being changed to sentence case 😭
@mschae23 mschae23 marked this pull request as ready for review September 27, 2025 19:32
@ajayyy ajayyy merged commit bd0be90 into ajayyy:master Oct 20, 2025
2 checks passed
@mschae23 mschae23 deleted the rules-parser branch October 20, 2025 14:42
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.

2 participants