-
Notifications
You must be signed in to change notification settings - Fork 594
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
[Perl] Refactor whole syntax definition to drop Oniguruma #1564
Conversation
Fixes sublimehq#541, sublimehq#1029, sublimehq#1325, sublimehq#1326, sublimehq#1495 Supersedes sublimehq#1556 According to sublimehq#481 this commit provides an Oniguruma free Perl syntax definition written from scratch. OUTLINE 1. fixes all currently open issues 2. much more feature complete 3. completely compatible with new regex engine 4. uses embed to include custom syntaxes within POD and HEREDOCS (CSS,JS,JSON,HTML,SQL,XML) 5. provides a syntax test file 6. uses as much atomic rules from Perl.sublime-syntax and ModernPerl package as possible (with some fixes/modifications) 7. follows the doc http://perldoc.perl.org as close as possible 8. add some snippets with some files renamed to match naming style REMARKS 1. The benchmark tests on a 100k file with all kinds of statements output about 360ms for evaluation on a Windows box. 2. The main focus is to create a robust base for syntax highlighting rather than scoping each language entity/construct in detail. a) Not all meta scoping RFCs are implemented in detail due to some limitations caused by HEREDOC. Especially pushing in/out of `meta.block` or `meta.braces` breaks some HEREDOC constructs. b) Scope names were changed to follow the scope naming guidelines as close as possible and try to use as general names as possible. -> Maybe needs some refines? 3. At the current point the implementation is a work in progress and needs testing by perl power users to a) check for highlighting to work in all situations b) constants/variables/functions are scoped correctly 4. This commit adds some snippets but does not include any completions in favor of https://packagecontrol.io/packages/Perl%20Completions
Forgive my noobness: How can I use this? Do I have to compile all of sublime or are there some config files I can update? Thank you, I could really use the perl fixes. s/n// and s/n/m/gr are driving me CRAZY. |
What I do to look into single packages is:
The location of your ST's Packages depends on OS and setup. You could also clone https://github.com/deathaxe/Packages and checkout the pr/perl branch. This way I can modify the package and test syntaxes while keeping in sync with the repo. Maybe easiest wayIf you just want to checkout the Perl.sublime-syntax, all you need to do is to copy the RAW content of current snapshot and put the content into Packages/Perl/Perl.sublime-syntax |
This might be overkill for @glenntanner3, but I maintain an "octopus" branch that contains all the fixes (local or remote) that I want to use before they are merged. Then I set up a git alias that says
Then, if something interesting happens to 1 Merge conflicts between branches are not handled gracefully. I usually pick the one I'd rather have. |
Thanks for the recommendations. I'm brand new to sublime so still learning how it works. I will give these a try upon return from vacation. PS: Linux |
This sounds great. I did not go through it in detail, but I know @deathaxe has quite a bit of experience with the default syntaxes, and we can gather user feedback through the next dev cycle. |
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 have a small suggestion to ensure reliability/compatibility behavior is maintained
@@ -11,1092 +10,1046 @@ file_extensions: | |||
- PL | |||
first_line_match: ^#!.*\bperl\b | |||
scope: source.perl | |||
|
|||
variables: | |||
break: (?!\w| *::) |
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.
presumably this space should be enclosed in a char class, else it could break as soon as this variable is used in expressions with extended mode enabled
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.
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.
... but there is another reason, why a change might be useful. The current solution doesn't respect tabs.
Fixes #541, #1029, #1325, #1326, #1495
Supersedes #1556
According to #481 this PR provides an Oniguruma free Perl syntax definition written from scratch.
OUTLINE
ModernPerl package as possible (with some fixes/modifications)
REMARKS
The benchmark tests on a 100k file with all kinds of statements output about 360ms for evaluation on a Windows box.
The main focus is to create a robust base for syntax highlighting rather than scoping each language entity/construct in detail.
a) Not all meta scoping RFCs are implemented in detail due to some limitations caused by HEREDOC. Especially pushing in/out of
meta.block
ormeta.braces
breaks some HEREDOC constructs.b) Scope names were changed to follow the scope naming guidelines as close as possible and try to use as general names as possible.
-> Maybe needs some refines?
At the current point the implementation is a work in progress and needs testing by perl power users to
a) check for highlighting to work in all situations
b) constants/variables/functions are scoped correctly
This commit adds some snippets but does not include any completions in favor of https://packagecontrol.io/packages/Perl%20Completions