Page 1 of 1

Have get_variables in the cxxpaser a bug ?

Posted: Fri Jan 16, 2009 6:33 am
by mmkider
I test testVarParser(buf);
But some function name will be parsing to var name.
Think you for your reply


input

Code: Select all

template <class T, class B> struct TagEntry 
{
	class TagEntry::SimpleClass {
	}
	virtual foo();
}

int a();
int b();
int c(int);
int c(int,int);
int dd;
extern int ddd;
output

Code: Select all

read: 181
===== Testing Variable parser ======
{m_name=b, m_defaultValue=, m_lineno=9, m_starAmp=, m_type=int, m_isConst=false, m_typeScope=, m_tem
plateDecl=, m_isPtr=false, m_isTemplate=false }
Pattern: /^;  int b $/
{m_name=c, m_defaultValue=, m_lineno=10, m_starAmp=, m_type=int, m_isConst=false, m_typeScope=, m_te
mplateDecl=, m_isPtr=false, m_isTemplate=false }
Pattern: /^;  int c $/
{m_name=c, m_defaultValue=, m_lineno=11, m_starAmp=, m_type=int, m_isConst=false, m_typeScope=, m_te
mplateDecl=, m_isPtr=false, m_isTemplate=false }
Pattern: /^;  int c $/
{m_name=dd, m_defaultValue=, m_lineno=12, m_starAmp=, m_type=int, m_isConst=false, m_typeScope=, m_t
emplateDecl=, m_isPtr=false, m_isTemplate=false }
Pattern: /^;  int dd $/
{m_name=ddd, m_defaultValue=, m_lineno=13, m_starAmp=, m_type=int, m_isConst=false, m_typeScope=, m_
templateDecl=, m_isPtr=false, m_isTemplate=false }
Pattern: /^  int ddd $/



Re: Have get_variables in the cxxpaser a bug ?

Posted: Fri Jan 16, 2009 10:07 am
by eranif
This project CxxParser is private. It does not do what you think :)

i.e. It is not meant to scan the entire file for variables. only small portions of it. for example:
(e.g. function signature)

You have to see the picture as a whole:
First ctags parses the entire workspace, then if needed, the variable parser is invoked to parse function signature or their return value (ctags does not do that for you), for example have a look at function

Code: Select all

wxString TagsManager::NormalizeFunctionSig(const wxString &sig, size_t flags, std::vector<std::pair<int, int> > *paramLen)
in ctags_manager.cpp file

There is also the scope parser which gives you the scope name at given position

None of the these parsers can function as a stand alone parser (and they were never meant to work like that) without the lookup table and the logic provided by libCodeLite.a (the library not the IDE :D))

Eran

Re: Have get_variables in the cxxpaser a bug ?

Posted: Fri Jan 16, 2009 10:53 am
by mmkider
eranif wrote:This project CxxParser is private. It does not do what you think :)

i.e. It is not meant to scan the entire file for variables. only small portions of it. for example:
(e.g. function signature)

You have to see the picture as a whole:
First ctags parses the entire workspace, then if needed, the variable parser is invoked to parse function signature or their return value (ctags does not do that for you), for example have a look at function

Code: Select all

wxString TagsManager::NormalizeFunctionSig(const wxString &sig, size_t flags, std::vector<std::pair<int, int> > *paramLen)
in ctags_manager.cpp file

There is also the scope parser which gives you the scope name at given position

None of the these parsers can function as a stand alone parser (and they were never meant to work like that) without the lookup table and the logic provided by libCodeLite.a (the library not the IDE :D))

Eran
finally I understand a little bit, thank you.
:o