Talk:Code Completion Design
Should be added to the article page soon
Parsethread
Three important functions should be introduced before we started .
- SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.
- SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.
- SkipAngleBraces This function is used to skip the context between < and >.
the m_Str is used to stored the token can not be decided .
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser. In the function DoParse,it analyze the tokens it meet as follow:
clear m_Str
just clear the m_strbecause the parser believe the token has been recognized correctly . e.g. int a;
delete . ->
skip the tokens until it meet ; or } e.g. delete p; e.g. MyClass .fun(); e.g. MyClass->fun();
deal with {
skip the context between { and } if the usebuffer or the bufferskipblock is true in the option. e.g. int main() {cout <<endl;}
deal with }
clear the scope and relation it belong to .
:
set the scope .
while if do else for switch
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.
typedef
call HandleTypedef to deal with it if the option handletypedef is true. otherwise,it will skip the context until it meet ;or }
return :
skip the context until it meet the ; or }
const
just clear th e m_str
extern
call DoParse if the next token is "c",otherwise,skip the context until it meet ;
__asm
skip the context until it meet ;
static virtual inline
do nothing
#
handle include if the next token is include handle define if the next token is define otherwise handle the preprocessor block
using
skip the context until it meet ;or }
namespace
skip context between < and > if the next token is <
class
handle class if the option handleclass is true.otherwise skip it
struct
the same to class
enum
the same to class
untion
skip the context until it meet }or; call DoParse to analyze the context in the untion.
operator
eg. MyClass operator () (size_t param);
MyClass operator += (MyClass param);
others
It means that the current token is not any one above . According to the next token ,it can be divided into several situation as followed . 1) the next one's fisrt char is (. eg. Macro(a, b) fun(int a , int b); eg. vector<int> fun(int a , int b); 2): and the current is not public /protected /private . eg. int x:1,y:1,z:1; 3), e.g. int x , y, z; 4)< e.g. someclass<void>::memberfunc; e.g. std::map<int, int> somevar; 5):: e.g. std::string e.g. MyClass MyClass ::fun() {} 6) ;