I wrote a .lang file for coffeescript. Coffeescript is transpiled into javascript, similarly to typescript. coffee.lang nests two other .lang files, which handle the two types of regex we see in coffeescript. (The simpler one, js_regex.lang , might be used for js.lang as well?) I thought I'd be able to do something similarly fancy for string interpolation (i.e. nesting coffeescript in coffeescript strings), but I couldn't get that to work. Thanks!
Thanks a lot for this elaborate solution. I have never thought of defining the regex parts as nested language, will test this for Perl and other languages. I will check the coffeescript nesting issue, maybe this is prohibited.
It's not so much that it's prohibited, but it's just that the rest of the string that isn't interpolation needs to be treated as a string rather than as a nesting delimiter. That is, "#{" only starts string interpolation when it's inside a string.
I updated the regex file to add character classes. The nested section code needs some more tweaks to be more flexible, for example allow other states as delimiters. Best solution would be to parse the delimiters in the old syntax, especially in HTML.
Release 3.33 contains Coffeescript. js_regex was not enabled for JS because of problems with terms like 1/2.