Answer the question
In order to leave comments, you need to log in
How to correctly implement recursive syntax highlighting in Sublime Text3?
I write syntax highlighting for the QSP language (qsp.su) and for some time, despite the difficulties, I managed to find solutions to various points. However, I've recently run into difficulties that stem from my lack of understanding of how recursive highlighting works.
I have some contexts defined: for comments, tags, lines, etc. They all work great and everything lights up great. It is possible to embed subexpressions in strings, for example:
*pl "Текст <<subex+435>>"
In these nested expressions, I decided to highlight the code like everything else, i. with existing contexts, with some exceptions. Here's how I did it:
strings:
- match: '"'
push:
- meta_scope: string.qsp
- match: '""'
scope: string.qsp
- match: '"'
pop: true
- include: subexpression
- match: "'"
push:
- meta_scope: string.qsp
- match: "''"
scope: string.qsp
- match: "'"
pop: true
- include: subexpression
subexpression:
- match: '<<'
scope: entity.name.function entity.name avs.markup
push:
- match: '>>'
scope: entity.name.function entity.name avs.markup
pop: true
- include: subex
subex:
- include: operacion
- include: sysvar
- include: functions
- include: strings
- include: numeric
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question