Share

Exuberant Ctags

Tracker: Patches

5 Recognise Ruby Foo::Bar style class names - ID: 1213512
Last Update: Comment added ( elliotth )

Ruby classes can be declared like 'class Foo::Bar'.
Currently this gives a class name of 'Foo'. This patch
allows colons to be included in class and module names.


Ciaran McCreesh ( cmccreesh ) - 2005-06-02 13:54

5

Open

None

Elliott Hughes

None

None

Public


Comment ( 1 )

Date: 2007-05-27 23:13
Sender: elliotth


i think the submitter is only half correct. this example:

#!/usr/bin/ruby -w
class Foo::Bar
def initialize()
$stderr.puts("Foo:Bar")
end
end
Foo::Bar.new()

gives this error:

$ ./x.rb
./x.rb:2: uninitialized constant Foo (NameError)

and using a single ":" gives this error:

$ ./x.rb
./x.rb:2: syntax error, unexpected ':', expecting '<' or '\n' or ';'
class Foo:Bar
^

you can use :: as a C++-like scope resolution operator, including in
definitions:

#!/usr/bin/ruby -w
module Foo
end
class Foo::Bar
def initialize()
$stderr.puts("Foo:Bar")
end
end
Foo::Bar.new()

but the tag there isn't Foo::Bar, it's Bar in the scope of Foo. accepting
":" as part of an identifier would be wrong. we need to be more intelligent
when parsing definitions and correctly enter/exit the enforced scope
instead.


Attached File ( 1 )

Filename Description Download
ctags-5.5.4-ruby-classes.patch ctags-5.5.4-ruby-classes.patch Download

Changes ( 2 )

Field Old Value Date By
assigned_to nobody 2006-09-21 02:50 dhiebert
File Added 136961: ctags-5.5.4-ruby-classes.patch 2005-06-02 13:54 cmccreesh