-
Notifications
You must be signed in to change notification settings - Fork 35
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
Syntax Definition Push and Immediately Pop (both non-consuming patterns) Bug #1190
Comments
Just to clarify, empty match patterns Interestingly, this slightly modified variant of the sublime-syntax shows that the pushed context refuses to be popped until a character is consumed (either by a match pattern or just skipping the character):
and while parsing the
|
It makes sense to force a character to be consumed when pushing a single context onto the stack, so that infinite push/pop recursion doesn't occur, but this logic doesn't hold true when pushing multiple contexts. Maybe it could be changed to move the check onto the first pushed context (remembering that it is first-in-last-out) instead of the top most / last pushed context? |
The syntax highlighter already has a check for infinite loops (or at least until a certain threshold), which displays an error message upon triggering and should indicate a bad syntax definition since such a thing should not be possible, so I believe that the safeguard would not be necessary even for single context pushes. |
I also ran into this today. Very annoying because it limits some of the theoretically achievable functionality. There is a workaround for my use case, but is quite ugly and I'd rather not use it (I would need it three times, even). |
... and use it to match function calls less explicitly and more magically. Usually you would think this is bad, but it's not because it's not really less explicit. It just avoids repetition when scoping the last (non-special) part of a qualified name with a name other than "meta.generic-name". This change triggers the bug described in sublimehq/sublime_text#1190, where the most-inner context in a multi-push operation *must* match at least one character before it can be popped. Due this, the tests are currently *not* passing.
This was addressed in build 3127 |
Function declaration matching was failing on 3126 due to sublimehq/sublime_text#1190
... and use it to match function calls less explicitly and more magically. Usually you would think this is bad, but it's not because it's not really less explicit. It just avoids repetition when scoping the last (non-special) part of a qualified name with a name other than "meta.generic-name". This change triggers the bug described in sublimehq/sublime_text#1190, where the most-inner context in a multi-push operation *must* match at least one character before it can be popped. Due this, the tests are currently *not* passing.
Summary
There is a bug with syntax definitions that push two or more contexts onto the stack without consuming any characters, and then immediately pop the top one back off again also without consuming any characters. It causes ST3 to skip a character.
Expected behavior
The 2nd context should be processed at the same character at the point the multiple contexts were pushed.
Actual behavior
The 2nd context's match patterns are processed after one character has been skipped.
Steps to reproduce
Create a sublime-syntax file that includes contexts and patterns as per the summary, something like:
Create a new tab, assign it this newly created syntax
Type text that will meet the requirements, something like:
Notice that one character is skipped for pattern matching - in this case, the
h
- despite having the correct meta scopeEnvironment
Windows 7 x64, Ubuntu 16.04 x64
Untested on a Mac
ST3 build 3111
The text was updated successfully, but these errors were encountered: