Hi,
Recently we discovered problem with editing dtrace files. To reproduce
it is simple:
A=fsinfo:::a*
A="$A,$A,$A,$A,$A,$A"
printf "$A,$A,$A\nEND {\n" > test.d
vim test.d
It takes very long time to open the file if you have syntax highlighting
enabled. We fixed the problem by the attached patch. I sent the patch to
dtrace.vim author but got no reply.
The problem itself seems to be that the syntax definition does not
know where 'probe' ends.
-exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s\%({\|\/[^*]\|\%$\)"'
+exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s*\%({\|\/[^*]\|\_s*\S\|\%$\)"'
a) it requires to have space to terminate the probe
b) even if you have space and some letters it does not terminate there
as it should
I believe that the fix we used
+exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s*\%({\|\/[^*]\|\_s*\S\|\%$\)"'
could be simplified to
+exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s*\%({\|\/[^*]\|\S\|\%$\)"'
but I would be glad for any advice.
The second part of the patch is just enhancement.
-let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*'
+let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S*\)\_s*'
That means that last part of probe does not need to be as few characters
as possible. The difference can be seen when you are entering the probe,
but you didn't enter '{' or '/' yet. During this time the probe was
highlighted incorrectly, while now it's correctly colored all the time.
Once we agree on the way how to fix this, would it be possible to include
the fix into vim distribution?
Thank you
--
Vlad
--
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
+--- runtime/syntax/dtrace.vim Thu Sep 13 09:27:02 2012
++++ runtime/syntax/dtrace.vim Thu Sep 13 09:27:15 2012
+@@ -40,8 +40,8 @@
+ " XXX: This allows a probe description to end with ',', even if it's not
+ " followed by another probe.
+ " XXX: This doesn't work if followed by a comment.
+-let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*'
+-exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s\%({\|\/[^*]\|\%$\)"'
++let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S*\)\_s*'
++exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s*\%({\|\/[^*]\|\_s*\S\|\%$\)"'
+
+ " Note: We have to be careful to not make this match /* */ comments.
+ " Also be careful not to eat `c = a / b; b = a / 2;`. We use the same