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

Re: syntax. Contained items should not contribute to highlight outside of a containing keepend item highlighting area

Expand Messages
  • Bram Moolenaar
    ... Makes sense. Like the previous patch this needs to be tested for a while. -- ARTHUR: The swallow may fly south with the sun, or the house martin or the
    Message 1 of 2 , Sep 26, 2006
    • 0 Attachment
      Ilya Bobir wrote:

      > I'm continuing my investigation on Vim's syntax highlight for the
      > following syntax rules:
      >
      > :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
      >
      > and I've found that this code
      >
      > { block "string } extra
      >
      > is highlighted not exactly as I want it to be. Highlight is as follows:
      >
      > { block "string } extra
      > SSSSSSSSS
      >
      > The problem is that closing brace '}' is highlighted as a String because
      > Block does not have any kind of highlight and contained String region is
      > forcefully terminated at the same character as enclosing Block is.
      >
      > So, I thought, that it would be logical that if I would limit Block
      > highlight to be completely inside braces then String would not highlight
      > brace character itself. It appears to be not the case. Here is a new
      > matching rule for Block:
      >
      > :syn region Block start=+{+hs=e end=+}+he=s-1 keepend extend contains=@Top
      >
      > Problem is that when a region is terminated because an enclosing keepend
      > region is terminated, then the contained region highlight end is at the
      > same point as the keepend region match end is, while, from my point of
      > view, it should be where the keepend region highlight end is.
      >
      > Here is a patch that makes Vim do as I want. Version 1 is for an
      > original syntax.c as it is in CVS now. Version 2 is for syntax.c that
      > was modified by my previous patch from "extend inside normal inside
      > keepend" e-mail.

      Makes sense. Like the previous patch this needs to be tested for a
      while.

      --
      ARTHUR: The swallow may fly south with the sun, or the house martin or the
      plover seek warmer hot lands in winter, yet these are not strangers to
      our land.
      SOLDIER: Are you suggesting coconuts migrate?
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ download, build and distribute -- http://www.A-A-P.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.