Loading ...
Sorry, an error occurred while loading the content.

44759Re: Syntax matching. extend inside normal inside keepend

Expand Messages
  • Yakov Lerner
    Sep 3, 2006
    • 0 Attachment
      On 9/3/06, Ilya <ilya@...> wrote:
      > Yakov Lerner wrote:
      > > On 9/2/06, Ilya <ilya@...> 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 contains=@Top
      > >> :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.

      Yakov
    • Show all 12 messages in this topic