<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Blueshake</id>
	<title>Code::Blocks - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Blueshake"/>
	<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php/Special:Contributions/Blueshake"/>
	<updated>2026-05-02T15:17:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.0</generator>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6025</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6025"/>
		<updated>2009-08-01T02:38:57Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* others */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&lt;br /&gt;
#else &lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if handleclass in the option is true.Otherwise skip context until the parser meet } or ;&lt;br /&gt;
 &lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) : and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6024</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6024"/>
		<updated>2009-08-01T02:38:00Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* others */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&lt;br /&gt;
#else &lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if handleclass in the option is true.Otherwise skip context until the parser meet } or ;&lt;br /&gt;
 &lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2) : and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6023</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6023"/>
		<updated>2009-08-01T02:36:20Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&lt;br /&gt;
#else &lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if handleclass in the option is true.Otherwise skip context until the parser meet } or ;&lt;br /&gt;
 &lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6022</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6022"/>
		<updated>2009-08-01T02:34:23Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with using */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&lt;br /&gt;
#else &lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ; e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6021</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6021"/>
		<updated>2009-08-01T02:34:01Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with  # */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&lt;br /&gt;
#else &lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ; e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6020</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6020"/>
		<updated>2009-08-01T02:33:01Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with  const */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear the m_str.It means that maybe a new variable or function is going to be defined.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int a = 3;&lt;br /&gt;
&lt;br /&gt;
const int getVal(int a);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ; e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6019</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6019"/>
		<updated>2009-08-01T02:26:14Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* Parsethread */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet a char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to store the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;delete p;&lt;br /&gt;
&lt;br /&gt;
MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
MyClass-&amp;gt;fun();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.eg.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is. And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class MyClass &lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here. e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
#if&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&amp;lt;pre&amp;gt; &lt;br /&gt;
using namespace std;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ; e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Myclass&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Macro(a, b) fun(int a , int b);&lt;br /&gt;
vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  &lt;br /&gt;
&amp;lt;pre&amp;gt;int x:1,y:1,z:1;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&amp;lt;pre&amp;gt;int  x , y, z;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
5)::&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
std::string&lt;br /&gt;
&lt;br /&gt;
MyClass MyClass ::fun() {}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6016</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6016"/>
		<updated>2009-07-31T04:19:38Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* operator */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
==deal with operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6015</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6015"/>
		<updated>2009-07-31T04:17:52Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* untion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6014</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6014"/>
		<updated>2009-07-31T04:17:39Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* enum */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
==deal with enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6013</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6013"/>
		<updated>2009-07-31T04:17:23Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* struct */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
==deal with struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6012</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6012"/>
		<updated>2009-07-31T04:17:09Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
==deal with class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6011</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6011"/>
		<updated>2009-07-31T04:16:57Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* namespace */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
==deal with namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6010</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6010"/>
		<updated>2009-07-31T04:16:43Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* using */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
==deal with using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6009</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6009"/>
		<updated>2009-07-31T04:16:28Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* # */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
==deal with  # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6008</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6008"/>
		<updated>2009-07-31T04:16:11Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* static virtual inline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6007</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6007"/>
		<updated>2009-07-31T04:15:57Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* __asm */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
==deal with  __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6006</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6006"/>
		<updated>2009-07-31T04:15:41Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* extern */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
==deal with  extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6005</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6005"/>
		<updated>2009-07-31T04:15:26Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* const */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
==deal with  const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6004</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6004"/>
		<updated>2009-07-31T04:14:56Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* return : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
==deal with  return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6003</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6003"/>
		<updated>2009-07-31T04:14:24Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* typedef */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
==deal with  typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6002</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6002"/>
		<updated>2009-07-31T04:14:06Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* while if  do else for switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
==deal with  while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6001</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6001"/>
		<updated>2009-07-31T04:13:46Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* delete  .  -&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==deal with delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6000</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=6000"/>
		<updated>2009-07-31T04:13:08Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* Parsethread */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# '''SkipToOneOfChars''' This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# '''SkipBlock''' This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# '''SkipAngleBraces''' This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5999</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5999"/>
		<updated>2009-07-31T04:02:04Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* Parsethread */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The '''m_Str''' is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
&lt;br /&gt;
In the function DoParse,it analyze the tokens it meets as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5998</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5998"/>
		<updated>2009-07-31T04:00:35Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* while if  do else for switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5997</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5997"/>
		<updated>2009-07-31T03:59:56Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* operator */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  &lt;br /&gt;
&lt;br /&gt;
       MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5996</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5996"/>
		<updated>2009-07-31T03:59:15Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* others */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above.So the next token should be judged.&lt;br /&gt;
&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) the next one's fisrt char is (&lt;br /&gt;
&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
&lt;br /&gt;
2): and the current is not public /protected /private &lt;br /&gt;
&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
&lt;br /&gt;
3),&lt;br /&gt;
&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
&lt;br /&gt;
5)::&lt;br /&gt;
&lt;br /&gt;
e.g. std::string&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5995</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5995"/>
		<updated>2009-07-31T03:56:04Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip context until the &lt;br /&gt;
parser meet } or ;&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5994</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5994"/>
		<updated>2009-07-31T03:54:29Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* class */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class Myclass&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    int x; &lt;br /&gt;
    int y;&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5993</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5993"/>
		<updated>2009-07-31T03:53:04Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* using */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
e.g. &lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5992</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5992"/>
		<updated>2009-07-31T03:52:02Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* while if  do else for switch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. if (a &amp;gt; b)&lt;br /&gt;
&lt;br /&gt;
         c = a;&lt;br /&gt;
&lt;br /&gt;
     else&lt;br /&gt;
&lt;br /&gt;
         c = b;&lt;br /&gt;
&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5991</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5991"/>
		<updated>2009-07-31T03:51:10Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* typedef */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
typedef int INT;&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5990</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5990"/>
		<updated>2009-07-31T03:50:09Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* return : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
e.g. int add(int a, int b)&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    return a+b;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5989</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5989"/>
		<updated>2009-07-31T03:48:22Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* # */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
e.g. #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. #define MAXNUM 10&lt;br /&gt;
&lt;br /&gt;
e.g. #if&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5988</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5988"/>
		<updated>2009-07-31T03:46:26Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* # */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
Handle include if the next token is include.&lt;br /&gt;
&lt;br /&gt;
Handle define if the next token is define.&lt;br /&gt;
&lt;br /&gt;
otherwise handle the preprocessor block.&lt;br /&gt;
&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5987</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5987"/>
		<updated>2009-07-31T03:43:22Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* return : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5986</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5986"/>
		<updated>2009-07-31T03:43:03Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* return : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
The parser skips the context until it meet the ; or }&lt;br /&gt;
Because the parser believe that there is no chance for variab definition here.&lt;br /&gt;
&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5985</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5985"/>
		<updated>2009-07-31T03:39:47Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* typedef */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
When parser meet this token ,it calls HandleTypedef function to deal with it if the option handletypedef is true.&lt;br /&gt;
Otherwise,it will skip the next context until it meet ;or }&lt;br /&gt;
&lt;br /&gt;
More Information, see below.&lt;br /&gt;
&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5984</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5984"/>
		<updated>2009-07-31T03:36:25Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with } */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
The parser clears the scope and domain.So it means it's a new begin.&lt;br /&gt;
By the way,it also clear m_Str.&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
call HandleTypedef to deal with it if the option handletypedef is true.&lt;br /&gt;
otherwise,it will skip the context until it meet ;or }&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5983</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5983"/>
		<updated>2009-07-31T03:31:10Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
clear the scope and relation it belong to .&lt;br /&gt;
&lt;br /&gt;
== deal with : ==&lt;br /&gt;
When parser meets this token.It will judge what the last token is.And set the related scope.&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&lt;br /&gt;
class MyClass &lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
 public :&lt;br /&gt;
    int x;&lt;br /&gt;
    int y;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
Here the scope is public.&lt;br /&gt;
&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
call HandleTypedef to deal with it if the option handletypedef is true.&lt;br /&gt;
otherwise,it will skip the context until it meet ;or }&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5982</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5982"/>
		<updated>2009-07-31T03:24:02Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* deal with { */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
The parser will skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
&lt;br /&gt;
==deal with }==&lt;br /&gt;
clear the scope and relation it belong to .&lt;br /&gt;
&lt;br /&gt;
== : ==&lt;br /&gt;
set the scope .&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
call HandleTypedef to deal with it if the option handletypedef is true.&lt;br /&gt;
otherwise,it will skip the context until it meet ;or }&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5981</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5981"/>
		<updated>2009-07-31T03:22:46Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* delete . -&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete  .  -&amp;gt;==&lt;br /&gt;
when parser meet these three tokens it will skip the next tokens until it meet token ; or }&lt;br /&gt;
&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass.fun();&lt;br /&gt;
&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
&lt;br /&gt;
==deal with { ==&lt;br /&gt;
skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
==deal with }==&lt;br /&gt;
clear the scope and relation it belong to .&lt;br /&gt;
&lt;br /&gt;
== : ==&lt;br /&gt;
set the scope .&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
call HandleTypedef to deal with it if the option handletypedef is true.&lt;br /&gt;
otherwise,it will skip the context until it meet ;or }&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
	<entry>
		<id>https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5980</id>
		<title>Talk:Code Completion Design</title>
		<link rel="alternate" type="text/html" href="https://wiki.codeblocks.org/index.php?title=Talk:Code_Completion_Design&amp;diff=5980"/>
		<updated>2009-07-31T03:18:26Z</updated>

		<summary type="html">&lt;p&gt;Blueshake: /* clear m_Str */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Should be added to the article page soon=&lt;br /&gt;
&lt;br /&gt;
=Parsethread=&lt;br /&gt;
Three important  functions should be introduced before we started .&lt;br /&gt;
# SkipToOneOfChars This function is used to skip any tokens until it meet any char in chars which is the parameter you pass.&lt;br /&gt;
# SkipBlock This function is used to skip block between two brances,for example ,{[()]}.If the block contain the proprocessor ,it will deal with it.&lt;br /&gt;
# SkipAngleBraces This function is used to skip the context between &amp;lt; and &amp;gt;.&lt;br /&gt;
the m_Str is used to stored the token can not be decided .&lt;br /&gt;
&lt;br /&gt;
The three functions above are used to skip tokens we wantn't to parse.It can acclerate the speed of parser.&lt;br /&gt;
In the function DoParse,it analyze the tokens it meet as follow:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==clear m_Str==&lt;br /&gt;
just clear the m_str,because the parser believe the token has been recognized correctly.&lt;br /&gt;
e.g. int a;&lt;br /&gt;
&lt;br /&gt;
==delete . -&amp;gt;==&lt;br /&gt;
skip the tokens until it meet ; or }&lt;br /&gt;
e.g. delete p;&lt;br /&gt;
e.g. MyClass .fun();&lt;br /&gt;
e.g. MyClass-&amp;gt;fun();&lt;br /&gt;
==deal with { ==&lt;br /&gt;
skip the context between { and } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
e.g. int main() {cout &amp;lt;&amp;lt;endl;}&lt;br /&gt;
==deal with }==&lt;br /&gt;
clear the scope and relation it belong to .&lt;br /&gt;
&lt;br /&gt;
== : ==&lt;br /&gt;
set the scope .&lt;br /&gt;
== while if  do else for switch==&lt;br /&gt;
skip the context until it meet ;or } if the usebuffer or the bufferskipblock is true in the option.&lt;br /&gt;
== typedef==&lt;br /&gt;
call HandleTypedef to deal with it if the option handletypedef is true.&lt;br /&gt;
otherwise,it will skip the context until it meet ;or }&lt;br /&gt;
== return :==&lt;br /&gt;
skip the context until it meet the ; or }&lt;br /&gt;
== const ==&lt;br /&gt;
just clear th e m_str&lt;br /&gt;
== extern ==&lt;br /&gt;
call DoParse if the next token is &amp;quot;c&amp;quot;,otherwise,skip the context until it meet ;&lt;br /&gt;
== __asm ==&lt;br /&gt;
skip the context until it meet ;&lt;br /&gt;
== static virtual inline ==&lt;br /&gt;
do nothing&lt;br /&gt;
== # ==&lt;br /&gt;
handle include if the next token is include&lt;br /&gt;
handle define if the next token is define&lt;br /&gt;
otherwise handle the preprocessor block&lt;br /&gt;
== using ==&lt;br /&gt;
skip the context until it meet ;or }&lt;br /&gt;
== namespace ==&lt;br /&gt;
skip context between &amp;lt; and &amp;gt; if the next token is &amp;lt;&lt;br /&gt;
== class ==&lt;br /&gt;
handle class if the option handleclass is true.otherwise skip it&lt;br /&gt;
== struct ==&lt;br /&gt;
the same to class&lt;br /&gt;
== enum ==&lt;br /&gt;
the same to class&lt;br /&gt;
== untion ==&lt;br /&gt;
skip the context until it meet }or;&lt;br /&gt;
call DoParse to analyze the context in the untion.&lt;br /&gt;
== operator ==&lt;br /&gt;
eg.  MyClass operator () (size_t param);&lt;br /&gt;
       MyClass operator += (MyClass param);&lt;br /&gt;
== others ==&lt;br /&gt;
It means that the current token is not any one above .&lt;br /&gt;
According to the next token ,it can be divided into several situation as followed .&lt;br /&gt;
1) the next one's fisrt char is (.&lt;br /&gt;
eg.  Macro(a, b) fun(int a , int b);&lt;br /&gt;
eg.  vector&amp;lt;int&amp;gt;  fun(int a , int b);&lt;br /&gt;
2): and the current is not public /protected /private .&lt;br /&gt;
eg.  int x:1,y:1,z:1;&lt;br /&gt;
3),&lt;br /&gt;
e.g. int  x , y, z;&lt;br /&gt;
4)&amp;lt;&lt;br /&gt;
e.g. someclass&amp;lt;void&amp;gt;::memberfunc;&lt;br /&gt;
e.g. std::map&amp;lt;int, int&amp;gt; somevar;&lt;br /&gt;
5)::&lt;br /&gt;
e.g. std::string&lt;br /&gt;
e.g. MyClass MyClass ::fun() {}&lt;br /&gt;
6) ;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Handling class example==&lt;br /&gt;
The main routing of handling class was in &lt;br /&gt;
ParserThread::HandleClass function&lt;br /&gt;
If the parserThread meet these statement&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} ;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It will surely add a Token of &amp;quot;AAA&amp;quot;, which has a type of &amp;quot;class&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
What about these statements&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} x,y,z;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The parserThread should firstly add a Token &amp;quot;AAA&amp;quot;, then it should regard &amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot; are three variables of type &amp;quot;AAA&amp;quot;. This was done by &amp;quot;ReadVarNames()&amp;quot; function, it will read every comma separated variables after a class declaration &lt;br /&gt;
&lt;br /&gt;
==Handling typedef==&lt;br /&gt;
&lt;br /&gt;
Sometimes, you can see these code:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef class AAA{&lt;br /&gt;
    int m_a;&lt;br /&gt;
    int m_b;&lt;br /&gt;
} BBB,CCC;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If the parser meet the keyword &amp;quot;typedef&amp;quot;, firstly it set the &amp;quot;m_ParsingTypedef = ture&amp;quot; to indicate that we are parsing a typedef statement.&lt;br /&gt;
&lt;br /&gt;
Next, it meets a keyword &amp;quot;class&amp;quot;, which also indicate it is a class declaration. So, the HandleClass function will do the task. A Token of &amp;quot;class AAA&amp;quot; will be added to the TokensTree. Wait a minute, how can we deal with &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot;, this is not the same case as previous code, we can't regard &amp;quot;BBB&amp;quot;,&amp;quot;CCC&amp;quot; as variables. In this case, another function &amp;quot;ReadClsName()&amp;quot; will be called. For simplicity of TokensTree, we just regard &amp;quot;BBB&amp;quot; and &amp;quot;CCC&amp;quot; as derived class of &amp;quot;AAA&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
How does the parser know between these two cases. Here is the code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                if (m_ParsingTypedef)&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    ReadClsNames(newToken-&amp;gt;m_Name);&lt;br /&gt;
                    // m_ParsingTypedef = false;&lt;br /&gt;
                    break;&lt;br /&gt;
&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    m_Str = newToken-&amp;gt;m_Name;&lt;br /&gt;
                    ReadVarNames();&lt;br /&gt;
                    m_Str.Clear();&lt;br /&gt;
                    break;&lt;br /&gt;
                }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That's the whole thing I would like to write about handling class and handling typedef.&lt;/div&gt;</summary>
		<author><name>Blueshake</name></author>
	</entry>
</feed>