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

129352Re: creating syntax file - syn match problem

Expand Messages
  • Ben Fritz
    Mar 2, 2012
      On Mar 2, 8:56 am, Tarlika Elisabeth Schmitz
      <v...@...> wrote:
      > Ben, this works a treat for the examples I posted last night - many
      > thanks.

      Good to know, glad it helped.

      > However, I just realized the code blocks are a little more complex than
      > I thought:
      > a) one-line/inline  code blocks are delimited by a set of 3 curly
      > braces.

      Good, you have this already.

      > b) multi-line blocks
      >  - are delimited by any number of braces (min 3)

      For this, I think you'll need to compromise and select some maximum
      number of braces to allow highlighting for. You could even make this
      configurable if you use a loop to build a bunch of similar rules
      starting at 4 braces (you get 3 from your existing definition for

      >  - the code may contain sets of curly braces (they don't need to match)

      I'm not sure what you mean by this. Are you saying {{{ does not always
      start a code block? If so, you'll need to figure out the "real" start
      of a code block and somehow key off of that, possibly using nextgroup.

      >  - the block is closed by the first set of braces that contains the same
      >    number of braces as the opening set

      This makes sense. But can blocks with the same number of braces nest?
      Can groups overlap, e.g. is this valid?

      begin block1 {{{
      begin block2 {{{{
      end block1 }}}
      end block2 }}}}

      If so, I don't think Vim can highlight it. At least, not easily.

      >  - the first code line must be on a new line (not on the same line as
      > the opening braces)

      That should be easy enough with a negative look-ahead assertion (using
      the \@! zero-width match). Just make sure there's nothing but
      whitespace until the end of the line in the start pattern of your
      syntax region.

      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 9 messages in this topic