Patch for nested brackets in strings
Ken Miller
ken.miller at gmail.com
Wed Mar 23 15:23:55 EST 2005
Hi,
Doing some metaprogramming, I noticed that nested brackets in
generalized string literals are not handled correctly. Here's the
code that triggered it:
(1..12).each do |index|
monthname = Date::MONTHNAMES[index]
class_eval %{
def test_#{monthname.downcase}
MONTHS.each_pair do |key, value|
assert_equal(value[#{index}], at days[key].select { |a| a.month ==
#{index} }.length,
"Wrong number of days in #{monthname.capitalize}, \#{key}")
end
end
}
end
Ruby detects and skips over nested delimiters, but the syntax code doesn't.
I approach vim syntax with some fear, but the attached patch appears
to fix the problem, and to the extent of my testing (vim 6.3 windows)
does not introduce any unwanted behavior. To apply the patch, cd to
syntax directory and run
patch ruby.vim nested-brackets.patch
Thanks for the existing work!
Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nested-brackets.patch
Type: application/octet-stream
Size: 1397 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/vim-ruby-devel/attachments/20050323/35727144/nested-brackets.obj
More information about the vim-ruby-devel
mailing list