-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Minify all regexes using the new oniguruma-parser
optimizer
#125
Comments
That's awesome, thank you! Would you like to send the PR to swap the current minifier with yours? |
No rush, but I'd prefer for you to submit the initial PR / integration. After it's in place, I can submit PRs that might be needed for any future releases. 😊 |
Heads up that I now have this working locally and discovered that it causes changes to highlighting for 6 grammars. Your existing testing in place for this was great! I thought it would be kind of risky to integrate a new system like this, but since this library already compares Oniguruma results for all samples before and after minification, that allows changing this with a lot more confidence!! 😊 I'll investigate the problem with the 6 grammars, fix, and send a PR to integrate the optimizer when that's done. |
I've recently split
oniguruma-to-es
's parser/tokenizer/traverser into the new dedicated libraryoniguruma-parser
. It includes lots of improvements, including a new Oniguruma optimizer that I think is a perfect fit for this library (in fact I built it primarily for Shiki). 😊As of now, the optimizer includes 18 optimization transforms, but many more can be added in the future.
tm-grammars
will get continually-improving regex minification when bumping dependencies.Here's how you'd want to call it in this library:
Some notes:
oniguruma-parser
supports a few more Oniguruma features thanoniguruma-to-es
, there are still a handful of features it doesn't yet support. So ifoptimize
throws an error, you should probably ignore it and leave the original pattern unaltered. As of now, I think this will only happen for one regex in the Swift grammar.optimize
. It will take care of existing minification like removing comments and free-spacing with flagx
.The text was updated successfully, but these errors were encountered: