Yakov Lerner wrote:
On 9/3/06, Ilya <[EMAIL PROTECTED]> wrote:
Yakov Lerner wrote:
> 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
>
> Your 'keepend' option clearly causes '}' which is end of
> identifier to terminate the enclosing block, in full accordance
> with :help syn-keepend.
No, it does not because of an extend option. Here is a picture (I've
already included it in my previous mail):
{ "string ${var} string" }
BBBBBBBBBBBBBBBBBBBBBBBBBB
SSSSSSSSSSSSSS SS
IIIIII
B - Block region
S - String region
I - Identifier region
I got this information using synID function.
> If I read ':help syn-keepend' right, then 'keepend' does not
> allow a region on which it is used to have proper subregions.
Except for 'extend' regions. That is why Block is 'keepend' and
'extend'.
What if 'extend' can override only the 'keepend' of only
immediately enclosing region ? The example in :help syn-extend
only has examlpe of overriding 'keepend' of immediately containing
region. Does not say whether 'extend' acts all the way up
the stack of enclosing regions.
That is nearly my question (look at the topic). But, if you consider
the way Vim currently takes an extend region that is inside a normal
region that is inside a keeped you can see (as I've pictured) that
external keepend region is not ended but middle normal region is. And
this is strange to me. I was expecting someone to comment on this
matter. Is there any sense in this approach or it is kind of a bug?
Yakov