When working on improvements in syntax definition for Inno Setup, I noticed some peculiar behavior. Let’s start with a minimal syntax I managed to reduce the issue to:
%YAML 1.2 --- name: 'Test' scope: base-scope contexts: main: - match: ' *(?=#)' push: - clear_scopes: true with_prototype: - match: '(?= *$)' pop: true - match: '^ *a *$' - match: '^b$' - match: '^c' - match: 'd$'
And a simple test file (contains no whitespace apart from the line breaks):
a b c d e
Inspecting scopes reveals that the “base-scope” gets removed from a, b, c and d lines.
Now to the peculiarities:
- Adding any meta_scope to context with clear_scopes fixes the issue (“base-scope” is present on all lines).
- Adding any scope when a, b, c or d is matched fixes the issue on that line.
- Adding “-match: e” fixes the issue.
- Changing space to other character in ’ *(?=#)’ fixes the issue.
- Changing # to other character fixes the issue
- If spaces are added to lines where they would be matched, their scope is cleared as well.
- Using capturing groups fixes syntax only for parts with scope assigned in the “captures:”.
If I write “#” into the test file, scopes for it behave as one would expect, but issue for other lines is still there. Check it out yourself
Do anyone have any clue what is going on? Is this behavior on purpose and I just don’t get something or maybe it is a bug?
I’m on Sublime Text 3.2.2 Build 3211.