One thing that isn’t clear here is how to nest regions. Adding another group to a group that has regions declared doesn’t seem to be allowed, but that isn’t obvious from this man page.
By staring at a bunch of the built in language highlighters, I was able to determine that at least one way is to create a group, add regexes to it, then create a new, unrelated group and some regions which then ref the first group. For example, in many templating languages (twig, mustache, etc), there are two kinds of tag regions, one for logical operations, the other for outputting variables. If you want to highlight a strings region within either of those regions, you need to define the two tag types as refs to the language grammar that includes string regions. This seems to be the resolution to the problem I stated here:
I’m sure there’s more tricks to be learned here. Looking at the JavaScript language kak script is bewildering. It uses recursion in a way I don’t have time to reverse engineer.