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

24264Re: Regex problem in syntax description

Expand Messages
  • Preben Guldberg
    Sep 3, 2001
    • 0 Attachment
      Thus wrote Corinna Vinschen (vinschen@...) on [010901]:

      > 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.

      It does appear that way...

      Actually, the "match" statements must be within one line (":help
      syn-define"). So changelogFiles matches the first line, and in the
      second example changeLogFuncs matches each of the following line
      (three matches).

      If you want multilines, why not go for something like

      syn region changelogFiles start='^\s\+[+*]' end=':' contains=changeLogFuncs
      syn region changeLogFuncs contained start='(' end=')'
      syn region changeLogFuncs contained start='[' end=']'

      or, if parens are not allow to nest or span lines

      syn region changelogFiles start='^\s\+[+*]' end=':' contains=changeLogFuncs
      syn match changeLogFuncs '[[(].\{-}[)\]]'

      There is probably an issue with filenames that contain one of "[()]".

      Peppe
      --
      "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