Is there a plan to impove the ctags parser?

Discussion about CodeLite development process and patches
fanhe0513
CodeLite Enthusiast
Posts: 39
Joined: Sat Aug 21, 2010 7:32 pm
Genuine User: Yes
IDE Question: c++
Contact:

Is there a plan to impove the ctags parser?

Post by fanhe0513 »

Hi eranif, thanks to your work, the ctags within codelite has supported basic function return value and class template.

But, I have a function return value problem.
Check the following test c++ code.

Code: Select all

class B {
public:
    int b3;
};

namespace NS01
{
    class A {
    public:
        int a1;
    };
    
    class B {
    public:
        A m_a;
        int b1;
    };
    
    namespace NS02
    {
        class A {
        public:
            int aa;
        };
        
        class B {
        public:
            int bb;
            class BB {
            public:
                int bb2;
            };
        };
    }
    
    template<typename T1, typename T2>
    T1 * 
    Func()
    {
        return new T1;
    }
    
    B * 
    Func2()
    {
        return new B;
    }
}

namespace NS02
{
    class A {
    public:
        int a2;
    };
    
    class B {
    public:
        int b2;
    };
    
    class C {
    public:
        int c2;
    };
}

//using namespace NS01;

int main(int argc, char **argv)
{
    using namespace NS01::NS02;
    using NS02::C;
    namespace NS002 = NS01;
    namespace NS003 = NS002::NS02;
    using NS003::B;
    using NS01::Func;
    using NS01::Func2;
//    using namespace NS02;
//    namespace B = NS01::NS02;
//    using NS01::NS02::B;
//    B::BB bb;

    A a1;
    NS01::B b1;
    B b2;
    NS002::B b3;
    NS003::B b4;
    C c1;
    
    a1; // -> aa
    b1; // -> b1
    b2; // -> bb
    b3; // -> b1
    b4; // -> bb
    c1; // -> c2
    b1.m_a.a1;

    Func<B, short>()->bb; // -> bb
    Func2()->b1;

    return 0;
}
The Func2 symbol stored in codelite database is
screenshot1.png
Obviously, it miss some information like template parameter and add some useless symbol.
So I think, we can add a extra field which I call qualifiers to store the class template info and function return info.
For the above Func2 symbol, it's qualifiers field is "template<typename T1, typename T2> T1 *"
I think storing the original text(after -I replacement) is the first idea.

For the above test code, I think I also report some bugs...

Currently, I migrate the codelite database to python and work with vim successfully. So I have the above questions.
screenshot2.png
I'm not familiar with the ctags.
Are you have a plan improve the ctags?

Best regards.
fanhe
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Is there a plan to impove the ctags parser?

Post by eranif »

fanhe0513 wrote:Hi eranif, thanks to your work, the ctags within codelite has supported basic function return value and class template.
It has more than that. However, most of the template logic parsing is done inside codelite's parser which is *not* the ctags parser.

The ctags output is just a basic stage in providing a rough lookup table. the logic of templates and context parsing is done using an internal parser built-in into codelite binary.

For your question: i have no plans to extend ctags parser atm.
Eran
Make sure you have read the HOW TO POST thread
fanhe0513
CodeLite Enthusiast
Posts: 39
Joined: Sat Aug 21, 2010 7:32 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: Is there a plan to impove the ctags parser?

Post by fanhe0513 »

For your question: i have no plans to extend ctags parser atm.
En, then I will try to deal with the return value.

In future, I think I use clang instead.
Currently, the clang do not support code-complete in .h file, and slow without pch.
If I generate a pch, the symbols in pch will all enter code-complete such as the .c file include all the headers.
If there is a method can control file about pch, the clang will be the better code-complete tool.

fanhe
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Is there a plan to impove the ctags parser?

Post by eranif »

fanhe0513 wrote:In future, I think I use clang instead.
have a look at codelite's source file named 'clang_code_completion.cpp' for an example for how I workaround completion in .h files

Eran
Make sure you have read the HOW TO POST thread
Post Reply