I have a language which uses statement like
WHILE ... DO .. END_WHILE
I can do the following in the corresponding synthax file
syn keyword LangKeys WHILE DO END_WHILE syn region LangBlock start="WHILE" end="END_WHILE" fold transparent
which allows me to highlight correctly the different keywords as well as defining a given region.
But now, I would like to be sure that the DO is only highlighted in the context of the loop. But I don't want to affect anything else. I tried
syn keyword LangKeys WHILE END_WHILE syn keyword InsideKeys DO contained syn region LangBlock start="WHILE" end="END_WHILE" fold transparent contained=InsideKeys
also without the
transparent option. I tried a few variations of that. But it does not produce the expected result.
How can I get the highlight to be applied only when the keywords are within a given context?
Alternatively, is there a better way to handle that?