Yet another vim/ruby question

I was somewhat confused as to who the current maintainer of the ruby
syntax file is, so I’m sending this to the whole list. I think this was
mentioned recently, but I just couldn’t seem to figure out who it is
from the archives; sorry about that.

I found a small bug in the syntax/folding that I’m not skilled enough
with syntax highlighting to fix. The following code highlights/folds
wrong for me (vim 6.1, tried a bunch of different versions of the
highlighting that I got from different places):

while (var)
fun() do
print "hello\n"
end
end

The problem seems to be that the ‘while’ is paired with the first ‘end’
and not the second as the end of that block. I figured out why this is
happening; the line in syntax/ruby.vim for rubyOptDoBlock has a
’contains’ that among other stuff has
"ALLBUT,rubyDoBlock,rubyCurlyBlock" in it. I guess this is so that the
optional ‘do’ for the while-type statements will not be matched as a
rubyDoBlock, but it prevents any ruby blocks directly inside the 'while’
from being matched correctly. If I insert an if statement or something
in between then everything is fine. If I use curly braces for the
block, the correct ‘end’ is matched for ‘while’ but the block inside is
still not detected (I can tell because there is no fold available there).

Again, apologies for not providing a solution but I just don’t know
enough about how the highlighting works to know the best way to do it.
Hopefully this isn’t fixed in some later version that I just haven’t
seen.

thanks,
-kyle

···


http://mas.cs.umass.edu/~rawlins

Let’s hear it for the vague blur!
(P.K.Dick)

I was somewhat confused as to who the current maintainer of the
ruby syntax file is, so I’m sending this to the whole list. I
think this was mentioned recently, but I just couldn’t seem to
figure out who it is from the archives; sorry about that.

I believe Doug Kearns mailto:djkea2@mugca.its.monash.edu.au took it
over; you can get the most recent (which still has the problem you
mention) at:
http://mugca.its.monash.edu.au/~djkea2/vim/syntax/ruby.vim

···

On Friday 02 August 2002 12:25 pm, Kyle Rawlins wrote:

I found a small bug in the syntax/folding that I’m not skilled
enough with syntax highlighting to fix. The following code
highlights/folds wrong for me (vim 6.1, tried a bunch of different
versions of the highlighting that I got from different places):

while (var)
fun() do
print "hello\n"
end
end


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

[…] The following code highlights/folds
wrong for me […]

while (var)
fun() do
print “hello\n"
end
end
[…]
happening; the line in syntax/ruby.vim for rubyOptDoBlock has a
’contains’ that among other stuff has
"ALLBUT,rubyDoBlock,rubyCurlyBlock” in it. I guess this is so that the
optional ‘do’ for the while-type statements will not be matched as a
rubyDoBlock, but it prevents any ruby blocks directly inside the 'while’
from being matched correctly. If I insert an if statement or something
[…]

I believe that my mods to the Ruby syntax file introduced folding.
Basically, all I did was add “fold” to the lines that seemed
appropriate, and when I did
set fdm=syntax
it worked. So I admit that I was “meddling in the affairs of
wizards”, but I got away with it that time! This post is to point
out that I did not look in great detail at the syntax highlighting,
and certainly not enough to correct this problem.

It might be worth asking on the vim list how this should be fixed.
Off the top of my head, I can’t think of any other langauges with
optional keywords in this sort of context, though I know I have
encountered this sort of thing before, because I never thought it
odd when I saw it in Ruby.

thanks,
-kyle

    Hugh
···

On Sat, 3 Aug 2002, Kyle Rawlins wrote:

I believe that my mods to the Ruby syntax file introduced folding.
Basically, all I did was add “fold” to the lines that seemed
appropriate, and when I did
set fdm=syntax
it worked. So I admit that I was “meddling in the affairs of
wizards”, but I got away with it that time! This post is to point
out that I did not look in great detail at the syntax highlighting,
and certainly not enough to correct this problem.

No, it looks like this problem has always been there, so unfortunately
we can’t blame you for introducing it :slight_smile:

It might be worth asking on the vim list how this should be fixed.
Off the top of my head, I can’t think of any other langauges with
optional keywords in this sort of context, though I know I have
encountered this sort of thing before, because I never thought it
odd when I saw it in Ruby.

Yes, this sort of thing makes it a lot of fun to write a syntax file
for Ruby … sigh

Regards,
Doug

···

On Mon, Aug 05, 2002 at 10:48:15PM +0900, Hugh Sasse Staff Elec Eng wrote: