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

24280Re: Regex problem in syntax description [patch]

Expand Messages
  • Preben Guldberg
    Sep 3, 2001
    • 0 Attachment
      Thus wrote Bram Moolenaar (Bram@...) on [010903]:

      > Please try this patch. It does work for the example above, but this
      > code is very complicated, it's hard to predict if there now is another
      > situation where it fails.

      For existing text it seems to work just fine.

      However, when entering new text, the highlighting is only updated if
      a potentially multiline pattern is matched in a single line.

      Try these few lines:

      :syn clear
      :syn match Todo "^\s\+[+*]\s\+\zs\_.\{-}\ze:\s" contains=Error
      :syn match Error contained "(\_.\{-})"

      Test case:

      * 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 highlighting is fine, but try and insert a snippet like

      * utils.c (foo)
      (bar): testing

      [syn-sync-minlines does not remedy this, more below]

      Also, if you edit the existing text (eg. "Ax<ESC>") on a line other
      than the first in the multiline, the highlighting disappears from that
      line onwards. If one at this point escapes, go to the first line and
      inserts some text, the currently highlighted lines plus one will be
      highlighted (not all, just one more).

      Using "syn sync minlines=X", the first (2*X + 1) lines of an existing
      multiline match will be highlighted correctly at all times (or so it
      seems in a few tests).

      Not sure if I have hit some internal limits wrt. syn-sync or multiline
      patterns, though.

      "Before you criticize someone, walk
      Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
      c928400@... (o o) he gets angry, he'll be a mile away
      ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
    • Show all 6 messages in this topic