On Tue, 14 Dec 2010, crypticmetaphor wrote:
vim and gvim crash in windows if these lines are in the file and the
extension of the file ends with .d I've tried it with other
extensions, but I don't get errors, and I dont get errors if I comment
it out with /* and */
part of the code, if I include this in a file whose extension ends
with d, I get a crash, if anyone knows a workaround, please post it
here, I don't like having to change the name of my file.
'a':":ooo:o:::ooooooo:::oo:::o"
, 'b':"oooo:o:::ooooo:o:::ooooo:"
, 'c':":ooooo::::o::::o:::::oooo"
With only the first three lines, the bug is still triggered.
Since '.d' is the file extension for both code files written in the 'D'
programming language and scripts written for DTrace, Vim loads both
syntax files. The bug is in the inefficient regular expression
constructed on line 44 in syntax/dtrace.vim. Cc:'ing maintainer here.
[[ A workaround for the bug is to comment out that line in
syntax\dtrace.vim under your Vim installation by prepending a
double-quote: " ]]
If you're not writing DTrace files, you can probably stop reading now.
:-)
With just lines 2 and 3 of the original file ('b' and 'c'), under a slow
Linux machine, it's clear that it's not "crashing", per se. Just taking
a very long time to match.
I don't know enough about DTrace to know what this is trying to
highlight, but the fact that it has the long sequences of repeated
'\S\{-}:', all of which are then made optional/repeatable is what makes
it slow.
original lines:
let s:oneProbe = '\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*'
exec 'syn match dtraceProbe
"'.s:oneProbe.'\%(,\_s*'.s:oneProbe.'\)*\ze\_s\%({\|\/[^*]\|\%$\)"'
what gets executed:
syn match dtraceProbe
"\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*\%(,\_s*\%(BEGIN\|END\|ERROR\|\S\{-}:\S\{-}:\S\{-}:\S\{-}\)\_s*\)*\ze\_s\%({\|\/[^*]\|\%$\)"
After looking up more info[1]:
"""
When writing out the full human-readable name of a probe, write all four
parts of the name separated by colons like this:
provider:module:function:name
"""
It looks like provider, module, and even function are often blank... so
I'm not sure how much they could be constrained.
Maybe it would be more efficient to use a match group where only a
single probe is matched, and then the ,\_s* portion separating the next
probe somehow signals the next match group? (I'm thinking of something
like the way syntax/css.vim uses cssMediaComma )
--
Best,
Ben
[1] http://wikis.sun.com/display/DTrace/Introduction
--
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