Over some years I’ve been contributing to a sublime-syntax and ever since found it annoying that variables aren’t highlighted within quotes. I figured out how to change this, but I was wondering if there’s a way to re-use previously defined matches (I have a feeling there is!)
This works:
contexts:
main:
- match: '\$\w+'
scope: variable.nsis
- match: '"'
captures:
0: punctuation.definition.string.begin.nsis
# further down...
push:
- meta_scope: string.quoted.double.nsis
- match: '"'
captures:
0: punctuation.definition.string.end.nsis
pop: true
- match: \$\\.
scope: constant.character.escape.nsis
- match: '\$\w+'
scope: variable.nsis
This is stupid. I don’t want to define variable.nsis
twice (or more often for different types of quotes). There has to be a way of “importing” the match at a later point.