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

44757Re: Syntax matching. extend inside normal inside keepend

Expand Messages
  • Ilya
    Sep 3, 2006
    • 0 Attachment
      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" }
      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'.
      > Yakov
    • Show all 12 messages in this topic