пятница, 3 августа 2012 г., 9:05:09 UTC+4 пользователь ZyX написал:
> пятница, 3 августа 2012 г., 5:42:30 UTC+4 пользователь Shougo написал:
> 
> > > Why don't fix the problem by explicitely using "[=!][~=][#?]" everywhere? 
> > > I just always use "#" and "?" for string comparison, no matter whether it 
> > > is "=~", "is" or their opposites (yes, and I never use "=="/"!=" for 
> > > string comparison). All the problems should be fixed by running
> 
> > 
> 
> > > 
> 
> > 
> 
> > 
> 
> > 
> 
> > Because, indent/vim.vim(and I think other plugins too) uses match(). This 
> > functions also uses 'ignorecase' option.
> 
> > 
> 
> > I can't fix it easily. So I used try finally block and changed ignorecase 
> > option.
> 
> 
> 
> Bad. I now must go and change all match(), matchstr(), matchlist() and 
> matchend() calls at least in all of my plugins. Thanks for pointing this out.
> 
> 
> 
> It is still not impossible to do with a perl (ir)regular expression, but if 
> you do grep there you will see that there are not many such calls that need 
> to be fixed. This patch (http://bpaste.net/show/38266/) was produced by 
> 
>     perl -p -i -e 
> 's#(match(?:str|list|end)?\((?:[^([,]+|\(([^(\[]+|\((?2)*\)|\[(?2)*\])|\[(?2)*\])+,\s*(?:\[(?:\\.|[^\]])+\]|('')(?=(?:(?:(?!\\[cC])[^''])+?|'''')*?(?<!\\)(?<!\\[_z])[a-zA-Z](?![^\[\]]*\]))|(")(?=(?:(?:(?!\\\\[cC])[^"])+?|\\")*?[a-zA-Z](?![^\[\]]*\]))))#"$1".(($1
>  =~ /"$/)?("\\\\c"):("\\c"))#ge and print STDERR "$.:$_"' *.vim~sdl.vim
> 
> 
> 
> (http://bpaste.net/show/38268/ in case it gets spoiled) and it is much 
> smaller. There are some missed things where variables are used in the 
> pattern. I should have used vimgrep, it would be faster then constructing the 
> above monster.

Missed one thing here: it should be "("\\\\C"):("\\C")", not "("\\\\c"):("\\c")"

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

Raspunde prin e-mail lui