DIP 1026---Deprecate Context-Sensitive String Literals---Community Review Round 1

Adam D. Ruppe destructionator at gmail.com
Tue Dec 3 15:05:30 UTC 2019


On Tuesday, 3 December 2019 at 14:45:31 UTC, Dennis wrote:
> I'm pretty sure most of them are not powerful enough to express 
> identifier-delimited strings.

The identifier ones are trivial, they are a simple regex. Heck, 
my vim syntax highlight file not only supports them, but uses the 
opening as a hint as to what language is embedded:

q"html
    <!-- highlights this as html! -->
";


that said though, I don't love them because they must end on a 
new line, without indentation. But still, it was easy to 
implement.

syn region dHTML keepend matchgroup=string start="q\"html$" 
end="^html\"" contains=@html


And the generic fallback for other identifiers of course is just

syn region dDelimString start=+q"\z(.\)+ end=+\z1"+ 
contains=@Spell
syn region dHereString  start=+q"\z(\I\i*\)\n+ end=+^\z1"+ 
contains=@Spell

vim manages to do it all pretty well....


More information about the Digitalmars-d mailing list