Christian Brabandt <[email protected]> wrote:

> Hi Dominique!
>
> On Do, 15 Jan 2015, Dominique Pellé wrote:
>
>> Is there a 3000 characters limit in the regexp engine or in syntax
>> highlighting engine? I could not find any such limit in the source code.
>
> Could that be the synmaxcol setting?
>
>
> Best,
> Christian

Yes that was it.  Valgrind with c++ can often have lines longer than
3000 char (default 'synmaxcol' value).  I wonder whether it's acceptable
to do setlocal synmaxcol=... inside the valgrind.vim syntax file.
Anyway, this is what I did in this latest attached patch with some
additional regexp optimizations.

Syntax highlighting of C++ functions is also fixed with the patch and
it is now is also much faster:

$ vim -u NONE -c 'set re=1' -c 'syntax on' -c 'setfiletype valgrind'
valgrind2.log

$ vim -u NONE -c 'set re=2' -c 'syntax on' -c 'setfiletype valgrind'
valgrind2.log

Prior to patch, rendering took > 20 sec with the new regexp engine and
about 2 sec with the old engine. After patch, it feels instantaneous with
both regexp engines.

Regards
Dominique

-- 
-- 
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/d/optout.
diff -r 2bf1d3dc0467 runtime/syntax/valgrind.vim
--- a/runtime/syntax/valgrind.vim	Wed Jan 14 21:22:01 2015 +0100
+++ b/runtime/syntax/valgrind.vim	Fri Jan 16 09:31:57 2015 +0100
@@ -15,6 +15,9 @@
 let s:keepcpo= &cpo
 set cpo&vim
 
+" Lines can be long with demangled c++ functions.
+setlocal synmaxcol=8000
+
 syn case match
 syn sync minlines=50
 
@@ -29,8 +32,8 @@
 	\ contains=valgrindPidChunk,valgrindLine
 
 syn region valgrindPidChunk
-	\ start=+\(^==\)\@<=+
-	\ end=+\(==\)\@=+
+	\ start=+^==\zs+
+	\ end=+\ze==+
 	\ contained
 	\ contains=valgrindPid0,valgrindPid1,valgrindPid2,valgrindPid3,valgrindPid4,valgrindPid5,valgrindPid6,valgrindPid7,valgrindPid8,valgrindPid9
 	\ keepend
@@ -64,10 +67,11 @@
 syn match valgrindLoc "\s\+\(by\|at\|Address\).*$" contained
 	\ contains=valgrindAt,valgrindAddr,valgrindFunc,valgrindBin,valgrindSrc
 syn match valgrindAt "at\s\@=" contained
-syn match valgrindAddr "\(\W\)\@<=0x\x\+" contained
-syn match valgrindFunc "\(: \)\@<=\w\+" contained
-syn match valgrindBin "\((\(with\|\)in \)\@<=\S\+\()\)\@=" contained
-syn match valgrindSrc "\((\)\@<=[^)]*:\d\+\()\)\@=" contained
+syn match valgrindAddr "\W\zs0x\x\+" contained
+
+syn match valgrindFunc ": \zs\h[a-zA-Z0-9_:\[\]()<>&*+\-,=%!|^ ]*\ze([^)]*)$" contained
+syn match valgrindBin "(\(with\)\=in \zs\S\+)\@=" contained
+syn match valgrindSrc "(\zs[^)]*:\d\+)\@=" contained
 
 " Define the default highlighting
 

Raspunde prin e-mail lui