On 9/2/06, Ilya <[EMAIL PROTECTED]> wrote:
Hello.

I have a question regarding syntax matching.  I have some kind of syntax
and I have some solution to highlight it, but it does not work the way I
expect it to.

What I want:  match syntax that consists of blocks (enclosed in {}),
strings (enclosed in "") and identifiers (starts with ${ and ends with
}).  Block end should also end any string that starts inside this block.

My solution:

:syn cluster Top contains=Block,String,Identifier
:syn region Block start=+{+ end=+}+ keepend extend [EMAIL PROTECTED]
:syn region String start=+"+ end=+"+ contains=Identifier
:syn region Identifier start=+\${+ end=+}+ extend

Here is a sample that shows that this solution does not work:

{
  "string ${var} string"
}

For some reason an Identifier region ends a String region and a second
word 'string' is not highlighted as a string (and Vim says that it has
Block match there).

Question: why the String region is not restored after the Identifier
region ends?

When I removed both 'keepend' and 'extend', it
started to work as expected.

With ''kepend extend', it
apparently takes identifier-closing brace for a
block-closing brace. I don't know why.

You might also try another solution: the 'syn match'
for identifier  instead of region.

Yakov

Reply via email to