Hi all, I'm writing a syntax plugin for multimarkdown which is expected to 
support folding with foldmethod=syntax. In (multi)markdown there is the notion 
of a multiparagraph list item that has a pretty simple grammar: starting a new 
paragraph with a first line that is at least 1-tab or 4-space indented 
continues the previous item. So I defined a region to capture this:

syn region mkdMultiParagraph start=/./ end=/\n\s*\n\ze \{,3}\S/ contains=TOP 
contained

Out of curiosity I tried to do the same with a (somewhat imperfect) match:

syn match mkdMultiParagraph /\(\s*\S.*\n\)\+\(\(\s*\n\)\+\( 
\{4}\|\t\)\(\s*\S.*\n\)\+\)*/ contains=TOP contained

I tried a number of simpler match variants also, but the point is that 
performance degrades awfully with every one of them, while things speed up a 
lot with the region. This is particularly noticeable when I set 
foldmethod=syntax. Then vim freezes for some seconds "thinking" about the 
folding. Once the folds are created performance becomes acceptable again.

I could give you the details to reproduce this, which are pretty convolved (for 
example, this only happens when the html syntax plugin in sourced inside mine). 
But first I would like to ask if there are good a priori reasons to avoid this 
kind of multiline matches in favor of regions. I was not able to find any 
advice regarding this in the vim documentation.

Also I'm curious about the internals of vim syntax highlighting and the syntax 
engine in general. Any description would be very much appreciated. A more solid 
understanding of the inner workings of the engine would help me to decide in 
matters like the above.

Best regards
--
Carlos

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui