Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on July 22, 2011, 08:47:59 am

Title: Add some comments to CC's code
Post by: ollydbg on July 22, 2011, 08:47:59 am
Patch On codecompletion.h attached, hopefully I can create more later.
Title: Re: Add some comments to CC's code
Post by: Loaden on August 02, 2011, 11:53:37 am
Done! Thanks!!
Title: Re: Add some comments to CC's code
Post by: ollydbg on August 10, 2011, 09:55:25 am
Another one(but still some functions and timers I do not fully know), it sounds like there are too many delay timers in CC :(.

Title: Re: Add some comments to CC's code
Post by: ollydbg on August 11, 2011, 07:11:31 am
Reviewing the CC's source, I found that these definition should be put in nativeparser.h (not parser.h)

Code
#define PARSER_IMG_NONE                -2
#define PARSER_IMG_CLASS_FOLDER         0
#define PARSER_IMG_CLASS                1
#define PARSER_IMG_CLASS_PRIVATE        2
#define PARSER_IMG_CLASS_PROTECTED      3
#define PARSER_IMG_CLASS_PUBLIC         4
#define PARSER_IMG_CTOR_PRIVATE         5
#define PARSER_IMG_CTOR_PROTECTED       6
#define PARSER_IMG_CTOR_PUBLIC          7
#define PARSER_IMG_DTOR_PRIVATE         8
#define PARSER_IMG_DTOR_PROTECTED       9
#define PARSER_IMG_DTOR_PUBLIC          10
#define PARSER_IMG_FUNC_PRIVATE         11
#define PARSER_IMG_FUNC_PROTECTED       12
#define PARSER_IMG_FUNC_PUBLIC          13
#define PARSER_IMG_VAR_PRIVATE          14
#define PARSER_IMG_VAR_PROTECTED        15
#define PARSER_IMG_VAR_PUBLIC           16
#define PARSER_IMG_PREPROCESSOR         17
#define PARSER_IMG_ENUM                 18
#define PARSER_IMG_ENUM_PRIVATE         19
#define PARSER_IMG_ENUM_PROTECTED       20
#define PARSER_IMG_ENUM_PUBLIC          21
#define PARSER_IMG_ENUMERATOR           22
#define PARSER_IMG_NAMESPACE            23
#define PARSER_IMG_TYPEDEF              24
#define PARSER_IMG_TYPEDEF_PRIVATE      25
#define PARSER_IMG_TYPEDEF_PROTECTED    26
#define PARSER_IMG_TYPEDEF_PUBLIC       27
#define PARSER_IMG_SYMBOLS_FOLDER       28
#define PARSER_IMG_VARS_FOLDER          29
#define PARSER_IMG_FUNCS_FOLDER         30
#define PARSER_IMG_ENUMS_FOLDER         31
#define PARSER_IMG_PREPROC_FOLDER       32
#define PARSER_IMG_OTHERS_FOLDER        33
#define PARSER_IMG_TYPEDEF_FOLDER       34
#define PARSER_IMG_MACRO                35
#define PARSER_IMG_MACRO_PRIVATE        36
#define PARSER_IMG_MACRO_PROTECTED      37
#define PARSER_IMG_MACRO_PUBLIC         38
#define PARSER_IMG_MACRO_FOLDER         39

#define PARSER_IMG_MIN PARSER_IMG_CLASS_FOLDER
#define PARSER_IMG_MAX PARSER_IMG_MACRO_FOLDER

also:
Code
class ClassTreeData : public wxTreeItemData
{
public:
    ClassTreeData(Token* token) { m_Token = token; }
    Token* GetToken() { return m_Token; }
    void SetToken(Token* token) { m_Token = token; }
private:
    Token* m_Token;
};

Parser class should not do such GUI things.
What's your opinion?


Title: Re: Add some comments to CC's code
Post by: MortenMacFly on August 11, 2011, 07:24:59 am
Reviewing the CC's source, I found that these definition should be put in nativeparser.h (not parser.h)
Code
#define PARSER_IMG_NONE                -2
#define PARSER_IMG_CLASS_FOLDER         0
#define PARSER_IMG_CLASS                1
#define PARSER_IMG_CLASS_PRIVATE        2
#define PARSER_IMG_CLASS_PROTECTED      3
#define PARSER_IMG_CLASS_PUBLIC         4
What's your opinion?
Originally, the concept was that "nativeparser" does know nothing about the language (i.e. C++), so that's why this part is in the language-specific parser. nativepasrer was supposed to just offer the interface / overlay to C::B. As is cannot know what items how to mark, partially the UI elements are also in the parser.

However, this is surely debatable, and in fact this concept is broken anyways IMHO.
Title: Re: Add some comments to CC's code
Post by: ollydbg on August 11, 2011, 07:36:17 am
If I remember, the Image related code was located in parser class. somehow, Loaden move that code to nativeparser. (right?)

Quote
Originally, the concept was that "nativeparser" does know nothing about the language (i.e. C++), so that's why this part is in the language-specific parser. nativepasrer was supposed to just offer the interface / overlay to C::B. As is cannot know what items how to mark, partially the UI elements are also in the parser.

However, this is surely debatable, and in fact this concept is broken anyways IMHO.
agree. I strongly suggest we still need a clean class design, I'm not satisfied with the current one. There are two many things mixing.

Especially the "one parser for whole workplace" option make the nativeparser/parser class hard to comprehend.

I would think:
Code
                
               ParserBase
               |             \
              |                \
ParserForSingleProject  ParserForMultiplyProjects

Nativeparser should know nothing about the lower level Parser.
Title: Re: Add some comments to CC's code
Post by: ollydbg on August 11, 2011, 07:44:16 am
Nativeparser class do much things which should not belong to.
such as "generate code suggesting list", this is also language specific, should lower to some other class like "c++ parser class".

I think the nativeparser should only manage different parser classes.

Also, CodeCompletion class has a lot of code doing the "ToolBar GUI control"(such as jump from function bodies...) but It shouldn't be there, either the toolbar related code can be grouped out to make a new class, or it should be lowered to a language specific class.

Title: Re: Add some comments to CC's code
Post by: ollydbg on August 17, 2011, 04:15:55 pm
Patch to fix typos in CC's source code. Many thanks to the spell checker plugin!!!