On 7 September 2012 04:58, Colomban Wendling <lists....@herbesfolles.org> wrote: > Hi guys, > > I saw that the ruby parser don't properly generate tags declarations like: > > class Foo::Bar > end > > which should generate a tag "Bar" with the scope "Foo"; but it > generates a tag "Foo" and simply ignores "Bar". This seems to apply to > modules, classes and methods at least -- almost everything. > > So I wanted to fix that. Unfortunately the scoping code in CTags don't > really support to easily put several scopes at the same "level", e.g. if > you want to push several scope you gotta handle the popping yourself. > And since there is one single block end, it's tricky to do. > > Since I was way too lazy (and didn't even found a good implementation) > to fix that, I just did it the dirty way: reading the whole "Foo::Bar"
This is of course what C++ does when the declarations are not visible eg a::b::f(){}; makes a function 'a::b::f' if the declarations of a and b are not visible (eg in a closed .hpp file), if they are visible it puts f inside the declaration of b. Compare the symbols pane entrys for the definitions of f() and g() in the attached. I'm not a rubyist but I assume that Foo doesn't need to be declared before Bar in the above example and thats the problem. From the C++ example what you would need to do is "autodeclare" Foo (as what?) so you had somewhere to put Bar. > as a single tag name ("Foo.Bar") and tuning the code registering the tag > to split this on the last ".", putting the left part (if any) in the > scope. Patch attached. This is quite dirty, but works fine unless a > legitimate tag may include a "." in its name, which doesn't seem the > case currently looking at the parser. > > Note that Ruby isn't the only language that allows such kind of scoping. > For example, Vala allows to prefix stuff with a namespace -- and there > is the same problem here. But it is statically declared so it should work like C++ should it not? Cheers Lex > > So, especially Nick, what do you guys think of this? Is this patch too > dirty? Do somebody have a better idea? Or is this too dirty and "we > don't care because nobody writes ruby anyway"? In one word: opinions? > > Thanks, > Colomban > > _______________________________________________ > Geany mailing list > Geany@uvena.de > https://lists.uvena.de/cgi-bin/mailman/listinfo/geany >
namespace x { class y { void f(); }; }; void x::y::f(){}; void a::b::g(){};
_______________________________________________ Geany mailing list Geany@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany