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

24230Regex problem in syntax description

Expand Messages
  • Corinna Vinschen
    Aug 31, 2001
      Hi,

      this is using vim60at.

      I'm trying to optimize the syntax file `changelog.vim' and I
      stumbled over a problem. The highlighting of an expression is
      not what I expect from my regular expression.

      Typical ChangeLog entry looks like

      * file: description.
      * file (function): description.
      * file (class::method): description.

      or followup lines w/o a star:

      (function): description.
      (class::method): description.

      The highlighting should highlight the part up to the colon right
      before the descriptive text. Sometimes a `+' is used instead of
      `*' or brackets instead of parens.

      Now consider the following two entries from the GDB ChangeLog file:

      * config/xm-lynx.h, config/xm-nbsd.h, config/xm-sysv4.h,
      config/i386/xm-i386aix.h, config/m68k/xm-dpx2.h: Remove redundant
      inclusion of <limits.h>.

      * utils.c (get_field, floatformat_to_doublest, put_field)
      (ldfrexp, floatformat_from_doublest, floatformat_is_negative)
      (floatformat_is_nan, floatformat_mantissa)
      (FLOATFORMAT_CHAR_BIT): Move from here.

      The first example represents a `file' entry while the second
      example represents a `file (function)' entry. Now, these entries
      are multiline entries where the highlighting should still go from
      the `*' up to the colon in line 2 resp. line 4.

      This isn't handled by the current version of the changelog.vim file
      so I tried to fix the corresponding regular expression but... it
      doesn't work.

      The expressions I'm using to describe entries are the following:

      Standard entries:

      syn match changelogFiles "^\s\+[+*]\s\+\_.\{-}:\s"

      Followup lines:

      syn match changeLogFuncs contained "^\s\+[([]\_.\{-}:\s"

      Surprise, the first example is only highlighted in the first line,
      while the second example is highlighted correctly up to the colon
      in line 4.

      Does somebody have a clue why that happens? Is my regex wrong to
      reflect the first example? I can't find the error :-(

      Corinna

      --
      Corinna Vinschen
      Cygwin Developer
      Red Hat, Inc.
      mailto:vinschen@...
    • Show all 6 messages in this topic