31 #define CC_PARSERTHREAD_DEBUG_OUTPUT 0    33 #if defined(CC_GLOBAL_DEBUG_OUTPUT)    34     #if CC_GLOBAL_DEBUG_OUTPUT == 1    35         #undef CC_PARSERTHREAD_DEBUG_OUTPUT    36         #define CC_PARSERTHREAD_DEBUG_OUTPUT 1    37     #elif CC_GLOBAL_DEBUG_OUTPUT == 2    38         #undef CC_PARSERTHREAD_DEBUG_OUTPUT    39         #define CC_PARSERTHREAD_DEBUG_OUTPUT 2    44     #define ADDTOKEN(format, args...) \    45             CCLogger::Get()->AddToken(F(format, ##args))    46     #define TRACE(format, args...) \    47             CCLogger::Get()->DebugLog(F(format, ##args))    48     #define TRACE2(format, args...) \    49             CCLogger::Get()->DebugLog(F(format, ##args))    51     #if CC_PARSERTHREAD_DEBUG_OUTPUT == 1    52         #define ADDTOKEN(format, args...) \    53                 CCLogger::Get()->AddToken(F(format, ##args))    54         #define TRACE(format, args...) \    55             CCLogger::Get()->DebugLog(F(format, ##args))    56         #define TRACE2(format, args...)    57     #elif CC_PARSERTHREAD_DEBUG_OUTPUT == 2    58         #define ADDTOKEN(format, args...) \    59                 CCLogger::Get()->AddToken(F(format, ##args))    60         #define TRACE(format, args...)                                              \    63                 if (g_EnableDebugTrace)                                             \    64                     CCLogger::Get()->DebugLog(F(format, ##args));                   \    67         #define TRACE2(format, args...) \    68             CCLogger::Get()->DebugLog(F(format, ##args))    70         #define ADDTOKEN(format, args...)    71         #define TRACE(format, args...)    72         #define TRACE2(format, args...)    76 #define CC_PARSERTHREAD_TESTDESTROY 0    78 #if CC_PARSERTHREAD_TESTDESTROY    79 #define IS_ALIVE IsStillAlive(wxString(__PRETTY_FUNCTION__, wxConvUTF8))    81 #define IS_ALIVE !TestDestroy()   202     m_Tokenizer(tokenTree),
   204     m_TokenTree(tokenTree),
   210     m_Options(parserThreadOptions),
   211     m_ParsingTypedef(false),
   212     m_Buffer(bufferOrFilename),
   213     m_StructUnionUnnamedCount(0),
   214     m_EnumUnnamedCount(0)
   219         cbThrow(
_T(
"m_TokenTree is a nullptr?!"));
   247             if (singleCharToken && token.
length() > 1)
   365             for (
size_t i = 0; i < nsStack.Count(); ++i)
   366                 ns.
Name << nsStack[i];
   370             result.push_back(ns);
   374             NameSpaceVec::reverse_iterator it;
   375             for (it = result.rbegin(); it != result.rend(); ++it)
   488                     if (!ret) { 
TRACE(
_T(
"InitTokenizer() : Could not initialise tokenizer for file '%s'."), 
m_Filename.
wx_str()); }
   506     TRACE(
_T(
"InitTokenizer() : Buffer is empty."));
   572         bool switchHandled = 
true;
   579             switch (static_cast<wxChar>(token[0]))
   607                         switchHandled = 
false;
   711                 switchHandled = 
false;
   730                 switchHandled = 
false;
   747                 switchHandled = 
false;
   778                 switchHandled = 
false;
   833                         Token* foundNsToken = 
nullptr;
   837                             std::queue<wxString> nsQuqe;
   895                 switchHandled = 
false;
   960                 switchHandled = 
false;
   980                 switchHandled = 
false;
  1033                 switchHandled = 
false;
  1046                 switchHandled = 
false;
  1060                 switchHandled = 
false;
  1074                 switchHandled = 
false;
  1079                 switchHandled = 
false;
  1094         else if (!switchHandled)
  1136                             m_Str = token + arg;
  1423             TRACE(
_T(
"GetTokenBaseType() : Found '%s'"), typeCandidate.
wx_str());
  1424             return typeCandidate;
  1433                                         Token* parentIfCreated)
  1444     if (!result && parent == 0)
  1449     if (!result && createIfNotExist)
  1456         if (parentIfCreated)
  1459         TRACE(
_T(
"FindTokenFromQueue() : Created unknown class/namespace %s (%d) under %s (%d)"),
  1463               parent ? parent->
m_Index : -1);
  1486         TRACE(
_T(
"DoAddToken() : Token name is empty!"));
  1490     Token* newToken = 0;
  1507     Token* localParent = 0;
  1516             newToken = 
TokenExists(newname, baseArgs, localParent, kind);
  1518         {   
TRACE(
_T(
"DoAddToken() : Found token (ctor/dtor).")); }
  1526             newToken = 
TokenExists(newname, baseArgs, localParent, kind);
  1529             TRACE(
_T(
"DoAddToken() : Found token (member function)."));
  1533             if (isImpl && (kind & tkAnyFunction))
  1544             TRACE(
_T(
"DoAddToken() : Found token (parent)."));
  1546             if (isImpl && (kind & tkAnyFunction))
  1562         && (   kind & tkAnyFunction
  1563             || newToken->
m_Args == args
  1571         TRACE(
_T(
"DoAddToken() : Created token='%s', file_idx=%u, line=%d, ticket=%lu"), newname.
wx_str(),
  1600             m_PointerOrRef.
Clear();
  1615             TRACE(
_T(
"DoAddToken() : Prepending '%s'"), prepend.
wx_str());
  1616             tokenBaseType.
Prepend(prepend);
  1643     TRACE(
_T(
"DoAddToken() : Added/updated token '%s' (%d), kind '%s', type '%s', actual '%s'. Parent is %s (%d)"),
  1648     ADDTOKEN(
_T(
"Token: Index %7d Line %7d: Type: %s: -> '%s'"),
  1678             while (pos < token.
Length())
  1709         TRACE(
_T(
"HandleIncludes() : Found include file '%s'"), filename.
wx_str());
  1718                 TRACE(
_T(
"HandleIncludes() : File '%s' not requested to parse after checking options, skipping"), filename.
wx_str());
  1727                 TRACE(
_T(
"HandleIncludes() : File '%s' not found, skipping"), filename.
wx_str());
  1733                 TRACE(
_T(
"HandleIncludes() : File '%s' is already being parsed, skipping"), real_filename.
wx_str());
  1737             TRACE(
_T(
"HandleIncludes() : Adding include file '%s'"), real_filename.
wx_str());
  1782                     TRACE(
_T(
"HandleNamespace() : Unable to create/add new token: ") + ns);
  1901             TRACE(
_T(
"HandleClass() : Skip __attribute__ or __declspec"));
  1909         TRACE(
_T(
"HandleClass() : Found class '%s', next='%s'"), current.
wx_str(), next.
wx_str());
  1927             TRACE(
_T(
"HandleClass() : Class '%s' has ancestors"), current.
wx_str());
  1951                     TRACE(
_T(
"HandleClass() : Adding ancestor ") + tmp);
  1976             TRACE(
_T(
"HandleClass() : Ancestors: ") + ancestors);
  1984             unnamedTmp.
Printf(
_T(
"%s%s%u_%lu"),
  1985                               g_UnnamedSymbol.
wx_str(),
  1986                               (ct == 
ctClass ? 
_T(
"Class") : (ct == 
ctUnion ? _T(
"Union") : _T(
"Struct"))),
  1992                 TRACE(_T(
"HandleClass() : Unable to create/add new token: ") + unnamedTmp);
  2002 #ifdef CC_PARSER_TEST  2003             for (
size_t i = 0; i < formals.
GetCount(); ++i)
  2004                 TRACE(_T(
"The template formal arguments are '%s'."), formals[i].wx_str());
  2037                 TRACE(_T(
"HandleClass() : Unable to create/add new token: ") + current);
  2039                 {   
TRACE(_T(
"HandleClass() : ReadClsNames returned false [1].")); }
  2046                 {   
TRACE(_T(
"HandleClass() : ReadVarNames returned false [1].")); }
  2081                 TRACE(
_T(
"HandleClass() : Unable to create/add new token: ") + current);
  2105 #ifdef CC_PARSER_TEST  2106             for (
size_t i = 0; i < formals.
GetCount(); ++i)
  2107                 TRACE(
_T(
"The template formal arguments are '%s'."), formals[i].wx_str());
  2127                 {   
TRACE(
_T(
"HandleClass() : ReadClsNames returned false [2].")); }
  2134                 {   
TRACE(
_T(
"HandleClass() : ReadVarNames returned false [2].")); }
  2176                     TRACE(
_T(
"HandleClass() : Unable to create/add new token: ") + current);
  2189                     TRACE(
_T(
"HandleClass() : ReadClsNames returned false [2]."));
  2250         lastCurrent = current;
  2259     TRACE(
_T(
"HandleFunction() : Adding function '")+name+
_T(
"': m_Str='")+
m_Str+
_T(
"'"));
  2263     TRACE(
_T(
"HandleFunction() : name='")+name+
_T(
"', args='")+args+
_T(
"', peek='")+peek+
_T(
"'"));
  2288             TRACE(
_T(
"HandleFunction() : Add token name='")+name+
_T(
"', args='")+args+
_T(
"', return type='") + 
m_Str+ 
_T(
"'"));
  2299                 TRACE(
_T(
"HandleFunction() : Unable to create/add new token: ") + name);
  2310         Token* localParent = 0;
  2318             TRACE(
_T(
"HandleFunction() : Ctor/Dtor '%s', m_Str='%s', localParent='%s'"),
  2328             TRACE(
_T(
"HandleFunction() : !(Ctor/Dtor) '%s', m_Str='%s', localParent='%s'"),
  2337             isCtorOrDtor = localParent && name == localParent->
m_Name;
  2340             isCtorOrDtor = isCtor || isDtor;
  2342         TRACE(
_T(
"HandleFunction() : Adding function '%s', ': m_Str='%s', enc_ns='%s'."),
  2347         bool isImpl = 
false;
  2348         bool isConst = 
false;
  2349         bool isNoExcept = 
false;
  2417                 TRACE(
_T(
"HandleFunction() : Possible macro '%s' in function '%s' (file name='%s', line numer %d)."),
  2427         TRACE(
_T(
"HandleFunction() : Add token name='")+name+
_T(
"', args='")+args+
_T(
"', return type='") + 
m_Str+ 
_T(
"'"));
  2429         Token* newToken =  
DoAddToken(tokenKind, name, lineNr, lineStart, lineEnd, args, isOperator, isImpl);
  2440             TRACE(
_T(
"HandleFunction() : Unable to create/add new token: ") + name);
  2507                 {   
TRACE(
_T(
"HandleConditionalArguments() : Unable to create/add new token: ") + token); }
  2574         bool createNewToken = 
false;
  2575         bool finished = 
false;
  2597             createNewToken = 
true;
  2603             createNewToken = 
true;
  2632             {   
TRACE(
_T(
"HandleForLoopArguments() : Unable to create/add new token: ") + token); }
  2649     bool isUnnamed = 
false;
  2650     bool isEnumClass = 
false;
  2675     Token* newEnum = 0L;
  2676     unsigned int level = 0;
  2733     bool updateValue = 
true;
  2758             updateValue = 
false;
  2774                     args << enumValue++;
  2810         if (token == 
_T(
"\\"))
  2850             if (token.
ToLong(&value, 16))
  2900     bool is_function_pointer = 
false;
  2902     std::queue<wxString> components;
  2905     TRACE(
_T(
"HandleTypedef() : Typedef start"));
  2946             if (components.size() != 0)
  2949                 while (components.size() > 0)
  2951                     wxString tempToken = components.front();
  2956                     ancestor << tempToken;
  2960                     TRACE(
_T(
"HandleTypedef() : ReadClsNames returned false."));
  2984             is_function_pointer = 
true;
  2996                         << token.
Mid(1, pos)
  2998                     token.
Remove(0, pos + 1);
  3008                 TRACE(
_(
"HandleTypedef() : Pushing component='%s' (typedef args='%s')"), token.
Trim(
true).
Trim(
false).
wx_str(), args.
wx_str());
  3009                 components.push(token.
Trim(
true).
Trim(
false));
  3017                 TRACE(
_(
"HandleTypedef() : Typedef args='%s'"), args.
wx_str());
  3022         TRACE(
_(
"HandleTypedef() : Pushing component='%s', typedef args='%s'"), token.
Trim(
true).
Trim(
false).
wx_str(), args.
wx_str());
  3023         components.push(token.
Trim(
true).
Trim(
false));
  3034     TRACE(
_T(
"HandleTypedef() : Typedef done"));
  3037     if (components.empty())
  3040     if (!is_function_pointer && components.size() <= 1)
  3055     if (   (components.size() == 2)
  3062         alias = components.front();
  3064         ancestor = components.front();
  3068         while (components.size() > 1)
  3070             token = components.front();
  3082     TRACE(
_(
"HandleTypedef() : Adding typedef: name='%s', ancestor='%s', args='%s'"), components.front().wx_str(), ancestor.
wx_str(), args.
wx_str());
  3087         TRACE(
_(
"HandleTypedef() : Ancestor='%s', actual ancestor='%s'"), ancestor.
wx_str(), actualAncestor.
wx_str());
  3089         if (is_function_pointer)
  3091             tdef->m_FullType        = ancestor + typ; 
  3092             tdef->m_BaseType        = actualAncestor;
  3093             if (tdef->IsValidAncestor(ancestor))
  3094                 tdef->m_AncestorsString = ancestor;
  3098             tdef->m_FullType        = ancestor;
  3099             tdef->m_BaseType        = actualAncestor;
  3100             tdef->m_TemplateAlias   = alias;
  3101             TRACE(
_T(
"The typedef alias is %s."), tdef->m_TemplateAlias.wx_str());
  3103             if (tdef->IsValidAncestor(ancestor))
  3104                 tdef->m_AncestorsString = ancestor;
  3113     bool success = 
true; 
  3138             TRACE(
_T(
"ReadVarNames() : Adding variable '%s' as '%s' to '%s'"),
  3149                 TRACE(
_T(
"ReadVarNames() : Unable to create/add new token: ") + token);
  3155             TRACE(
F(
_T(
"ReadVarNames() : Unexpected token '%s' for '%s', file '%s', line %d."),
  3168     bool success = 
true; 
  3190             TRACE(
_T(
"ReadClsNames() : Adding variable '%s' as '%s' to '%s'"),
  3208                 TRACE(
_T(
"ReadClsNames() : Unable to create/add new token: ") + token);
  3216             TRACE(
F(
_T(
"ReadClsNames() : Unexpected token '%s' for '%s', file '%s', line %d."),
  3295                     lastStrippedArg = baseArgs.
Mid(1);
  3297                     lastStrippedArg = baseArgs.
Mid(lastArgComma);
  3385                 baseArgs = baseArgs.
Mid(0, baseArgs.
Len()-13);
  3455     if (one && baseArgs.
Len() > 2)
  3457         const wxChar ch = baseArgs[1];
  3458         if (   (ch <= 
_T(
'9') && ch >= 
_T(
'0'))             
  3465         if (baseArgs == 
_T(
"(void)"))
  3466             baseArgs = 
_T(
"()");
  3469     TRACE(
_T(
"GetBaseArgs() : baseArgs='%s'."), baseArgs.
wx_str());
  3523     for (
size_t i=0; i<actuals.
GetCount(); ++i)
  3524         TRACE(
_T(
"The template actual arguments are '%s'."), actuals[i].wx_str());
  3529     std::map<wxString, wxString> templateMap;
  3546     for (
size_t i = 0; i < args.
Len(); ++i)
  3552             container.
Add(word);
  3558             container.
Add(word);
  3560             container.
Add(args[i]);
  3567     if (add_last && !word.
IsEmpty())
  3568         container.
Add(word);
  3577     for (
size_t j = 0; j < n; ++j)
  3584                 formals.
Add(container[j+1]);
  3598     for (
size_t j = 0; j < n; ++j)
  3599         TRACE(
_T(
"The container elements are '%s'."), container[j].wx_str());
  3602     for (
size_t j = 0; j < n; ++j)
  3607             while (level > 0 && (j+1) < n)
  3621             actuals.
Add(container[j]);
  3627                                       std::map<wxString, wxString>& results)
  3637     if (matchesCount > 0)
  3639         for (TokenIdxSet::const_iterator it= fullTypeMatches.begin(); it!= fullTypeMatches.end(); ++it)
  3649                     tokenFullType = tokenFullType.
substr(tokenFullType.
Find(
_T(
"::"))+2);
  3655     wxString parentType = tokenFullType;
  3661     if (tokenCounts > 0)
  3663         for (TokenIdxSet::const_iterator it=parentResult.begin(); it!=parentResult.end(); ++it)
  3671                 for (
size_t i=0; i<formals.
GetCount(); ++i)
  3672                     TRACE(
_T(
"ResolveTemplateMap get the formal template arguments are '%s'."), formals[i].wx_str());
  3675                 for (
size_t i=0; i<n; ++i)
  3677                     results[formals[i]] = actuals[i];
  3678                     TRACE(
_T(
"In ResolveTemplateMap function the normal is '%s',the actual is '%s'."), formals[i].wx_str(), actuals[i].wx_str());
  3682         return (results.size()>0) ? 
true : 
false;
  3691     templateArgs.
clear();
  3694     for (
unsigned int i = 0; i < exp.
length(); i++)
  3724                 if (i > 0) last = exp[i - 1];
  3725                 if (i < exp.
length() - 1) next = exp[i + 1];
  3745         TRACE(
_T(
"IsStillAlive() : %s "), funcInfo.wx_str());
  3773     if (str != 
wxT(
"<"))
  3781         if (token == 
_T(
"<"))
  3786         else if (token == 
_T(
">"))
  3794         else if (token == 
_T(
"*") || token == 
_T(
"&") || token == 
_T(
","))
  3800             if (str.
Last() == 
_T(
'<')) 
  3803                 str << 
_T(
" ") << token;
 wxString m_LastUnnamedTokenName
TODO: describe me here. 
Token * TokenExists(const wxString &name, const Token *parent=0, short int kindMask=0xFFFF)
if parent is 0, then global namespace will be used, all tokens under parent scope are searched ...
wxString F(const wxChar *msg,...)
sprintf-like function 
const wxString kw_if(_T("if"))
std::map< wxString, wxString > m_TemplateMap
a string to string map from formal template argument to actual template argument 
destructor class member function 
int TokenExists(const wxString &name, int parent, short int kindMask)
query tokens by names 
bool Parse()
Do the main job (syntax analysis) here. 
size_t m_EnumUnnamedCount
const wxChar tab_chr(_T('\t'))
wxString fileOfBuffer
which file the buffer belongs to, this usually happens when we parse a piece of the cbEditor and the ...
void UngetToken()
Undo the GetToken. 
void SetTokenizerOption(bool wantPreprocessor, bool storeDocumentation)
Handle condition preprocessor and store documentation or not. 
const wxString kw_inline(_T("inline"))
std::queue< wxString > m_EncounteredNamespaces
for member funcs implementation or a function declaration below eg: int ClassA::FunctionB(); Encounte...
const wxChar underscore_chr(_T('_'))
const wxChar clarray_chr(_T(']'))
const wxString kw_class(_T("class"))
int m_ParentIndex
Parent Token index. 
const wxString kw_virtual(_T("virtual"))
constructor class member function 
void RenameToken(Token *token, const wxString &newName)
only the token's name need to be changed, thus update the index map of the TokenTree ...
size_t InsertFileOrGetIndex(const wxString &filename)
put the filename in the m_FilenameMap, and return the file index, if this file is already in the m_Fi...
const wxString empty(_T(""))
const wxString colon(_T(":"))
bool followLocalIncludes
parse the file in #include "file" directive 
void HandleTypedef()
handle typedef directive 
const wxString clarray(_T("]"))
const wxString & GetFilename() const
Return the opened files name. 
const wxChar dot_chr(_T('.'))
bool wxIsspace(const wxUniChar &c)
bool ResolveTemplateMap(const wxString &typeStr, const wxArrayString &actuals, std::map< wxString, wxString > &results)
associate formal argument with actual template argument 
void Delete(std::vector< T > &s)
read parentheses as token lists, so it return several tokens like '(' ... 
wxString m_BaseType
this is what the parser believes is the actual return value: e.g. 
bool ReadVarNames()
eg: class ClassA{...} varA, varB, varC This function will read the "varA, varB, varC" ...
bool m_IsAnonymous
Is anonymous token? (e.g. 
const wxString kw_delete(_T("delete"))
wxString m_PointerOrRef
a pointer indicator or a references 
const wxString tilde(_T("~"))
wxString m_Name
Token's name, it can be searched in the TokenTree. 
wxString substr(size_t nStart=0, size_t nLen=npos) const
void HandleClass(EClassType ct)
handle class declaration 
unsigned int m_ImplLine
function implementation line index 
#define ADDTOKEN(format, args...)
const wxString kw_declspec(_T("__declspec"))
wxFileOffset Length() const
bool isTemp
this value is passed to the generated Token's m_IsTemp property 
bool IsValidAncestor(const wxString &ancestor)
build in types are not valid ancestors for a type define token 
typedef, note typedefs are stored as classes inheriting from the typedef'd type, this takes advantage...
TokenScope m_LastScope
this member define the scope type of member variables, which is: public, private protected or undefin...
wxChar SkipToOneOfChars(const wxString &chars, bool supportNesting=false, bool singleCharToken=true)
Continuously eat the tokens until we meet one of the matching characters. 
void InsertTokenBelongToFile(size_t fileIdx, int tokenIdx)
const wxString plus(_T("+"))
TokenIdxSet m_UsedNamespacesIds
globally included namespaces by "using namespace" statement 
container like tokens, those tokens can have children tokens 
bool wxFileExists(const wxString &filename)
const wxString gt(_T(">"))
const wxChar hash_chr(_T('#'))
unsigned int GetNestingLevel() const
Return the brace "{}" level. 
const wxString kw_for(_T("for"))
const wxChar comma_chr(_T(','))
const wxString kw_namespace(_T("namespace"))
const wxString kw_friend(_T("friend"))
void SkipAngleBraces()
skip the template argument 
const wxString kw_private(_T("private"))
wxString m_BaseArgs
stripped arguments e.g. 
const wxChar opbrace_chr(_T('{'))
int Index(const wxString &sz, bool bCase=true, bool bFromEnd=false) const
const wxString kw_public(_T("public"))
void FlagFileAsParsed(const wxString &filename)
mark the file status as fpsDone, since parsing this file is done 
const wxChar space_chr(_T(' '))
const wxChar oparray_chr(_T('['))
const wxChar clbracket_chr(_T(')'))
virtual bool ParseFile(const wxString &filename, bool isGlobal, bool locked=false)
Token * DoAddToken(TokenKind kind, const wxString &name, int line, int implLineStart=0, int implLineEnd=0, const wxString &args=wxEmptyString, bool isOperator=false, bool isImpl=false)
add one token to the token tree 
unsigned int m_FileIdx
source file index on the "file map tree" 
a container class to hold all the Tokens getting from parsing stage 
unsigned int m_ImplLineStart
if token is impl, opening brace line 
const wxString kw_static(_T("static"))
const wxChar lt_chr(_T('<'))
const wxString semicolon(_T(";"))
const wxChar opbracket_chr(_T('('))
int parentIdxOfBuffer
when parsing a function body, all the tokens are the children of the function token ...
const wxString kw_switch(_T("switch"))
const wxString kw_volatile(_T("volatile"))
void SkipBlock()
skip blocks {} 
unsigned int m_Line
Line index where the token was met, which is 1 based. 
unsigned int GetLineNumber() const
Return the line number of the current token string. 
const wxString equals(_T("="))
int m_Index
current Token index in the tree, it is index of the std::vector<Token*>, so use the index...
bool wxIsdigit(const wxUniChar &c)
wxArrayString GetTemplateArgArray(const wxString &templateArgs, bool remove_gt_lt, bool add_last)
normally the template argument is all in a wxString, this function just split them to a wxArrayString...
const wxString kw_else(_T("else"))
const wxString kw__C_(_T("\\))
unsigned int m_ImplLineEnd
if token is impl, closing brace line 
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
const wxString dot(_T("."))
bool GetBaseArgs(const wxString &args, wxString &baseArgs)
Converts a full argument list (including variable names) to argument types only and strips spaces...
wxString & Remove(size_t pos)
bool m_IsNoExcept
the member method is noexcept (yes/no) 
const wxString semicolonopbrace(_T(";{"))
const wxString kw_template(_T("template"))
wxArrayString m_Aliases
used for namespace aliases 
bool TestDestroy() const
Be sure to call this function often. If it returns true, quit your task quickly. 
bool m_IsTemp
local (automatic) variable 
This is just a simple lexer class. 
TokenScope m_Scope
public? private? protected? 
wxArrayString m_TemplateType
for a class template, this is the formal template argument list, but for a variable Token...
bool m_IsOperator
is operator overload function? 
size_t find(const wxString &str, size_t nStart=0) const
bool m_IsLocal
if true, means we are parsing a file which belongs to a C::B project, otherwise, we are parsing a fil...
const wxString kw_extern(_T("extern"))
EFileType FileType(const wxString &filename, bool force_refresh=false)
return a file type, which can be either header files or implementation files or other files ...
void DebugLog(const wxString &msg)
bool ParseBufferForNamespaces(const wxString &buffer, NameSpaceVec &result)
Get the context "namespace XXX { ... }" directive. 
wxString m_Filename
the file name of the parsing source 
const wxString oparray(_T("["))
TokenTree * m_TokenTree
a pointer to the token tree, all the tokens will be added to that tree structure 
unsigned int m_FileSize
file size, actually the length of the wxString 
const wxString kw_typename(_T("typename"))
bool CalcEnumExpression(Token *tokenParent, long &result, wxString &peek)
calculate the value assigned to enumerator 
bool handleEnums
whether to parse "enum ..." like statement 
wxUSE_UNICODE_dependent wxChar
const wxString kw_protected(_T("protected"))
unsigned int m_FileIdx
File index in TokenTree. 
const wxString dash(_T("-"))
bool handleClasses
whether to parse "class ...." like statement 
ParserBase * m_Parent
a pointer to its parent Parser object, the Parserthread class has two place to communicate with Parse...
wxString m_TemplateArgument
holds current template argument(s) when a template occurs 
wxString BeforeFirst(wxUniChar ch, wxString *rest=NULL) const
std::vector< NameSpace > NameSpaceVec
void GetTemplateArgs()
Read the <xxxx=yyy, zzz> , and store the value in m_TemplateArgs. 
const wxString space(_T(" "))
bool Contains(const wxString &str) const
wxString GetTokenBaseType()
return the actual token's base type. 
const wxString kw_include(_T("include"))
const wxString kw_enum(_T("enum"))
const wxChar gt_chr(_T('>'))
const wxString semicolonclbrace(_T(";}"))
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
const wxString opbracket(_T("("))
wxString & RemoveLast(size_t n=1)
std::set< int, std::less< int > > TokenIdxSet
wxString PeekToken()
Do a "look ahead", and return the next token string. 
void HandleEnum()
handle enum declaration 
const wxChar clbrace_chr(_T('}'))
const wxString kw_const(_T("const"))
#define TRACE(format, args...)
const wxString kw_while(_T("while"))
const wxString gtsemicolon(_T(">;"))
bool m_ParsingTypedef
this makes a difference in unnamed class/struct/enum handling 
void DoParse()
actually run the syntax analysis 
const wxString kw_return(_T("return"))
const wxString opbrace(_T("{"))
const wxString commaclbrace(_T(",}"))
EClassType
specify which "class like type" we are handling: struct or class or union 
bool handleFunctions
whether to parse the functions 
void RemoveTemplateArgs(const wxString &expr, wxString &expNoArgs, wxString &templateArgs)
remove template arguments from an expression example: 'std::list<string>' will be separated into 'std...
bool handleVars
whether to parse the variable definition 
const wxString kw_union(_T("union"))
const wxString clbracket(_T(")"))
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
const wxChar dash_chr(_T('-'))
void SetState(TokenizerState state)
Set the Tokenizer skipping options. 
wxString m_LastToken
hold the previous token string 
const wxChar eol_chr(_T('\n'))
void HandleIncludes()
handle include <XXXX> or include "XXXX" directive. 
wxString ReadAngleBrackets()
read <> as a whole token 
bool m_IsConst
the member method is const (yes/no) 
const wxChar ref_chr(_T('&'))
void HandleConditionalArguments()
parse arguments like: if(int X = getNumber()) 
const wxString kw_operator(_T("operator"))
bool NotEOF() const
return true if it is Not the end of buffer 
const wxString ref(_T("&"))
Tokenizer m_Tokenizer
if we regard the parserThread class as a syntax analyzer, then the Tokenizer class is regard as the l...
void SplitTemplateActualParameters(const wxString &templateArgs, wxArrayString &actuals)
Split actual template argument list. 
const wxString kw_elif(_T("elif"))
const wxString g_UnnamedSymbol
bool wantPreprocessor
handle the #if like preprocessor directives, this value is passed to Tokenizer 
const wxStringCharType * wx_str() const
bool InitFromBuffer(const wxString &buffer, const wxString &fileOfBuffer=wxEmptyString, size_t initLineNumber=0)
Initialize the buffer by directly using a wxString's content. 
ParserThread(ParserBase *parent, const wxString &bufferOrFilename, bool isLocal, ParserThreadOptions &parserThreadOptions, TokenTree *tokenTree)
ParserThread constructor. 
const wxString & _(const wxString &string)
virtual ~ParserThread()
ParserThread destructor. 
wxString & Trim(bool fromRight=true)
void RefineAnonymousTypeToken(short int typeMask, wxString alise)
change an anonymous(unnamed) token's name to a human readable name, the m_Str is expect to store the ...
wxString m_Args
If it is a function Token, then this value is function arguments, e.g. 
const wxString clbrace(_T("}"))
bool storeDocumentation
should tokenizer detect and store doxygen documentation? 
std::queue< wxString > m_EncounteredTypeNamespaces
namespaces in function return types for a function declaration below: e.g. 
wxString m_Str
This is a very important member variables! It serves as a type stack, eg: parsing the statement: "uns...
const wxString opbracesemicolon(_T("{;"))
unsigned int m_ImplFileIdx
function implementation file index 
Token * FindTokenFromQueue(std::queue< wxString > &q, Token *parent=0, bool createIfNotExist=false, Token *parentIfCreated=0)
TODO comment here? 
const wxString kw_try(_T("try"))
bool wxIsalnum(const wxUniChar &c)
const wxString kw__CPP_(_T("\++\))
const wxChar semicolon_chr(_T(';'))
void SetLastTokenIdx(int tokenIdx)
a Token is added, associate doxygen style documents(comments before the variables) to the Token ...
const wxString spaced_colon(_T(" : "))
TokenizerState
Enum defines the skip state of the Tokenizer. 
wxString m_TemplateArgument
template argument list, comma separated list string 
bool ToLong(long *val, int base=10) const
bool HasMoreTokens() const
const wxString kw_typedef(_T("typedef"))
bool wxIsalpha(const wxUniChar &c)
const wxString kw_case(_T("case"))
const wxString kw_attribute(_T("__attribute__"))
bool IsStillAlive(const wxString &funcInfo)
Only for debug. 
const wxString kw_using(_T("using"))
void AddToInfixExpression(wxString token)
bool IsOK() const
If the buffer is correctly loaded, this function return true. 
const wxString commasemicolonopbrace(_T(",;{"))
bool useBuffer
useBuffer specifies that we're not parsing a file, but a temporary buffer. 
const wxChar colon_chr(_T(':'))
const wxChar ptr_chr(_T(' *'))
bool InitTokenizer()
initialize the m_Buffer, load from local file or use a buffer in memory 
TokenKind m_TokenKind
See TokenKind class. 
void ResolveTemplateArgs(Token *newToken)
this function just associate the formal template argument to actual argument For example, we have such code: 
read parentheses as a single token 
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
Token * m_LastParent
parent Token, for example, when you are parsing in the class member variables, m_LastParent holds a p...
bool ParseBufferForUsingNamespace(const wxString &buffer, wxArrayString &result)
Get the context "using namespace XXX" directive. 
wxString & Prepend(const wxString &str)
general function, not constructor nor destructor 
void HandleNamespace()
handle the statement: namespace XXX { 
const wxString kw___asm(_T("__asm"))
size_t Add(const wxString &str, size_t copies=1)
const wxChar question_chr(_T('?'))
void HandleFunction(wxString &name, bool isOperator=false, bool isPointer=false)
handle function declaration or definition 
const wxString kw_do(_T("do"))
const wxString ptr(_T("*"))
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
bool handleTypedefs
whether to parse "typedef ..." like statement 
const wxString quot(_T("\))
void HandleForLoopArguments()
parse for loop arguments: for(int X; ... 
const wxString kw_catch(_T("catch"))
bool SkipToEOL()
Skip from the current position to the end of line, use with care outside this class! ...
size_t FindMatches(const wxString &query, TokenIdxSet &result, bool caseSensitive, bool is_prefix, TokenKind kindMask=tkUndefined)
find a collection of matched tokens 
int Find(wxUniChar ch, bool fromEnd=false) const
wxUniChar GetChar(size_t n) const
bool followGlobalIncludes
parse the file in #include <file> directive 
size_t m_TokenTicketCount
bool ReadClsNames(wxString &ancestor)
handle class names, e.g., the code below 
const wxString hash(_T("#"))
const wxString kw_throw(_T("throw"))
size_t ReserveFileForParsing(const wxString &filename, bool preliminary=false)
mark a file to be parsed. 
const wxString kw___at(_T("__at"))
void RemoveAt(size_t nIndex, size_t count=1)
int initLineOfBuffer
since we are not parsing start from the first line of the file, this is the first line number of the ...
int insert(Token *newToken)
add a new Token instance to the TokenTree 
int Printf(const wxString &pszFormat,...)
const wxString dcolon(_T("::"))
bool IsFileParsed(const wxString &filename)
is the file name is in the tokentree, and it's status is either assigned or beingparsed or done also...
wxString m_FullType
this is the full return value (if any): e.g. 
bool Init(const wxString &filename=wxEmptyString, LoaderBase *loader=0)
Initialize the buffer by opening a file through a loader, this function copy the contents from the lo...
void ConvertInfixToPostfix()
const wxChar equals_chr(_T('='))
wxString GetTokenKindString() const
the token kind string, e.g. 
bool bufferSkipBlocks
do we parse inside the {...} body 
bool m_IsLocal
if true, means the token belong to a C::B project, it exists in the project's source/header files...
const wxString kw_struct(_T("struct"))
const wxString kw_noexcept(_T("noexcept"))
static wxString Format(const wxString &format,...)
wxString Mid(size_t first, size_t nCount=wxString::npos) const
const wxChar null(_T('\0'))
size_t m_StructUnionUnnamedCount
const wxString comma(_T(","))
wxString GetToken()
Consume and return the current token string. 
const wxString lt(_T("<"))
TokenizerState GetState()
Return the token reading options value,. 
wxString GetFullFileName(const wxString &src, const wxString &tgt, bool isGlobal)
const wxChar plus_chr(_T('+'))
ParserThreadOptions m_Options
parser options, see the ParserThreadOptions structure 
bool AddChild(int childIdx)
add a child token 
wxString m_Buffer
a wxString holding the parsing buffer, if it is a file in the hard disk, then this stands for the fil...