I'm trying to make a VS Code extension to highlight Pollen Markup files. Those are plain text files with embedded variables and Racket code. Variables have syntax like this (and get later spliced into the text by a preprocessor):
Some text ◊variable-name text continued
And the Racket functions can be embedded using similar syntax:
One plus two is ◊(number->string (+ 1 2)).
I have a tmLanguage file which supports the Racket syntax, and I have a tmlLanguage file which supports the Pollen syntax (text + variables + embedded functions with source.racket in them). I'd like it to correctly highlight this code as well, but couldn't think of a clean solution:
◊n plus ◊m is ◊(number->string (+ ◊n ◊m)).
In other words, Pollen syntax in Racket syntax in Pollen syntax. Is it possible to implement syntax highlighting like this only on the Pollen-side of things, without making a special source.racket file which will support embedded Pollen code?
Something like first highlighting the Racket and then going through the text again, highlighting (and overwriting current color, if present) with the Pollen rules?