rubyFunction, rubyClass, and rubyModule no longer highlighted
Doug Kearns
dougkearns at gmail.com
Sun Feb 18 20:48:36 EST 2007
On Mon, Feb 19, 2007 at 12:55:46AM +0100, Nikolai Weibull wrote:
> On 2/18/07, Tim Pope <vim-ruby-devel at tpope.info> wrote:
>
> > A much simpler pattern (and one that actually works) is
> >
> > syn region rubyFunction matchgroup=rubyControl start="\<def\>\s*" end="\ze\%(\s\|(\|;\|$\)" oneline
>
> Even simpler (and faster):
>
> syn region rubyFunction matchgroup=rubyDefine start="\<def\>\ze\s*"
> end="\ze\%([[:space:](;:#]\|$\)" oneline
Why have you included the semicolon in the end pattern? def Foo::bar; end
> When using a backtracking regex matcher (juck!), using [[:space:]]
> over \s and a branch in this instance is "a lot" faster.
I'll keep that in mind - thanks.
> But why aren't we doing this with something simpler like
Insufficiently refactored legacy 'code' I suspect. ;-)
> syn keyword rubyDefine def nextgroup=rubyFunction skipwhite skipnl
> syn match rubyFunction '\h\w*'
>
> ? That's as simple and fast as it gets, and it's more true to the
> Ruby syntax, because you can write things like
>
> def
> a
> puts 'Hi, I'm method a!'
> end
I reckon we have a winner in principle. Although that final pattern is
obviously an oversimplification eg. def foo.bar;end and def Foo::bar;end
Unfortunately, it doesn't work either due to all the def <-> end
matching malarkey. *sigh*
I'll take a look at it tonight.
Thanks,
Doug
More information about the vim-ruby-devel
mailing list