On Thu, Nov 18, 2010 at 07:17:47AM +0300, ZyX wrote: > Reply to message «», > sent 01:16:59 18 November 2010, Thursday > by [email protected]: > > > I guess i found a little bug in runtime/indent/perl.vim. perl.vim has some > > patterns for matching opening and closing brackets. But perl.vim escapes > > opening square brackets in square brackets. For example: "match(line, > > '[(){}\[\]]', bracepos + 1)". Using \[ in between [] makes vim searching > > for backslashes and opening square brackets. This causes lines following > > lines with backslashes to be indented wrong. > I thought it should not (though vim help does contain nothing about > possibility > of escaping `['). Maybe it is better to allow escaping of `[':
Why? The reason ']' needs escaping is so that it isn't recognized as the end of the character class. Although, I see that the different engines already treat it differently. PCRE treats '\[' as '['. POSIX (and extended) regex treat it like Vim does. Since Vim's regex is more like POSIX's, it makes sense to act similarly, IMO. > I see `\[' in the > collections in the following files inside /usr/share/vim/vim73: > [snip] > These results were obtained after processing > grep -P '(?<!\\)\[(\\\]|[^\]\n])*?\\\[' /usr/share/vim/vim73/**/*.vim > output (grep should have pcre support). There are some false positives, but > they > are not included in the above list. It looks like it is Vim who should be > fixed, > not perl syntax file. Since when is people not following documented behavior a reason to change the tool? I'd be more understanding if Vim didn't explicitly outline the escape sequences it does allow inside a collection. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
signature.asc
Description: Digital signature
