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.
$ ./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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ctags-5.5.4-ruby-classes.patch
Logged In: YES
user_id=1127237
Originator: NO
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.