6 #ifndef NATIVEPARSERBASE_H     7 #define NATIVEPARSERBASE_H     9 #if wxCHECK_VERSION(3, 0, 0)   114                          std::queue<ParserComponent> components,
   116                          int                         parentTokenIdx = -1,
   117                          bool                        isPrefix = 
false,
   118                          bool                        caseSensitive = 
false,
   119                          bool                        use_inheritance = 
true,
   120                          short int                   kindMask = 0xFFFF,
   230                             unsigned int&   startAt,
   247                              std::queue<ParserComponent>& components);
   304                              std::queue<ParserComponent> components,
   307                              bool                        caseSense = 
true,
   308                              bool                        isPrefix = 
false);
   369                              bool            caseSens = 
true,
   370                              bool            isPrefix = 
false,
   371                              short int       kindMask = 0xFFFF);
   383                              bool               caseSens = 
true,
   384                              bool               isPrefix = 
false,
   385                              short int          kindMask = 0xFFFF);
   477             else if (c == 
',' && nest == 1)
   491         return (   (startAt >= 0)
   492                 && ((
size_t)startAt < line.
Len())
   494                     || (line.
GetChar(startAt) == 
'_') ) );
   506         while (   (startAt >= 0)
   507                && ((
size_t)startAt < line.
Len())
   509                    || (line.
GetChar(startAt) == 
'_') ) )
   516             && ((
size_t)startAt < line.
Len() + 1)
   518                 || (line.
GetChar(startAt - 1) == 
'_') ) )
   533         return (   (startAt > 0)
   534                 && ((
size_t)startAt < line.
Len())
   535                 && (   (   (line.
GetChar(startAt) == 
'>')
   536                         && (line.
GetChar(startAt - 1) == 
'-') )
   537                     || (   (line.
GetChar(startAt) == 
':')
   538                         && (line.
GetChar(startAt - 1) == 
':') ) ) );
   542         return (   (startAt > 0)
   543             && ((
size_t)startAt < line.
Len())
   544             && (   (   (line.
GetChar(startAt) == 
'>')
   545                     && (line.
GetChar(startAt - 1) == 
'-') )));
   552         return (   (startAt >= 0)
   553                 && ((
size_t)startAt < line.
Len())
   554                 && (   (   (line.
GetChar(startAt ) == 
'-')
   555                         && (line.
GetChar(startAt + 1) == 
'>') )
   556                     || (   (line.
GetChar(startAt) == 
':')
   557                         && (line.
GetChar(startAt + 1) == 
':') ) ) );
   563         return (   (startAt >= 0)
   564                 && ((
size_t)startAt < line.
Len())
   565                 && (line.
GetChar(startAt) == 
'.') );
   581         while (   (startAt >= 0)
   582                && ((
size_t)startAt < line.
Len())
   583                && (   (line.
GetChar(startAt) == 
' ')
   584                    || (line.
GetChar(startAt) == 
'\t') ) )
   602         while (   ((
size_t)startAt < line.
Len())
   603                && (   (line.
GetChar(startAt) == 
' ')
   604                    || (line.
GetChar(startAt) == 
'\t') ) )
   615         return (   ((
size_t)startAt < line.
Len())
   616                 && (   (line.
GetChar(startAt) == 
'(')
   617                     || (line.
GetChar(startAt) == 
'[') ) );
   623         return (   (startAt >= 0)
   624                 && (   (line.
GetChar(startAt) == 
')')
   625                     || (line.
GetChar(startAt) == 
']') ) );
   649             for (TokenIdxSet::const_iterator it = parent->
m_Children.begin();
   652                 Token* tokenChild = tree->
at(*it);
   674             for (TokenIdxSet::const_iterator it = parent->
m_Children.begin();
   677                 Token* tokenChild = tree->
at(*it);
   697         if (targetIdx == parentIdx)
   702         Token* parent = tree->
at(parentIdx);
   706             for (TokenIdxSet::const_iterator it = parent->
m_Children.begin();
   732         if (isPrefix && target.
IsEmpty())
   735             return text.CompareTo(target.
wx_str(), caseSens ? wxString::exact : wxString::ignoreCase) == 0;
   745         return kind & kindMask;
   753 #endif // NATIVEPARSERBASE_H void ResolveTemplateMap(TokenTree *tree, const wxString &searchStr, const TokenIdxSet &actualTypeScope, TokenIdxSet &initialScope)
resolve template map [formal parameter] to [actual parameter] 
size_t GenerateResultSet(TokenTree *tree, const wxString &target, int parentIdx, TokenIdxSet &result, bool caseSens=true, bool isPrefix=false, short int kindMask=0xFFFF)
Generate the matching results under the Parent Token index set. 
static bool IsOperatorPointer(int startAt, const wxString &line)
static bool IsOperatorDot(int startAt, const wxString &line)
check whether line[startAt] is a dot character 
size_t ResolveExpression(TokenTree *tree, std::queue< ParserComponent > components, const TokenIdxSet &searchScope, TokenIdxSet &result, bool caseSense=true, bool isPrefix=false)
A statement(expression) is expressed by a ParserComponent queue We do a match from the left of the qu...
virtual ~NativeParserBase()
Destructor. 
ParserComponent m_LastComponent
bool m_IsAnonymous
Is anonymous token? (e.g. 
bool AddChildrenOfEnum(TokenTree *tree, const Token *parent, TokenIdxSet &result)
wxString GetNextCCToken(const wxString &line, unsigned int &startAt, OperatorType &tokenOperatorType)
helper function to read the next CCToken, begin from the startAt, this point to a non-space character...
static bool IsOperatorBegin(int startAt, const wxString &line)
check if startAt point to "->" or "::" operator 
void CleanupSearchScope(TokenTree *tree, TokenIdxSet *searchScope)
remove all the container tokens in the token index set. 
bool MatchText(const wxString &text, const wxString &target, bool caseSens, bool isPrefix)
void FindCurrentFunctionScope(TokenTree *tree, const TokenIdxSet &procResult, TokenIdxSet &scopeResult)
if the expression return the container tokens, which are the parent of the expression. 
size_t BreakUpComponents(const wxString &actual, std::queue< ParserComponent > &components)
break a statement to several ParserComponents, and store them in a queue. 
OperatorType tokenOperatorType
type 
a container class to hold all the Tokens getting from parsing stage 
TokenIdxSet m_Children
if it is a class kind token, then it contains all the member tokens 
static bool IsOpeningBracket(int startAt, const wxString &line)
Test whether the current character is a '(' or '['. 
size_t FindAIMatches(TokenTree *tree, std::queue< ParserComponent > components, TokenIdxSet &result, int parentTokenIdx=-1, bool isPrefix=false, bool caseSensitive=false, bool use_inheritance=true, short int kindMask=0xFFFF, TokenIdxSet *search_scope=0)
Artificial Intelligence Matching. 
bool s_DebugSmartSense
debug only variable, used to print the AI match related log message 
bool MatchType(TokenKind kind, short int kindMask)
int FindFunctionOpenParenthesis(const wxString &calltip)
Finds the position of the opening parenthesis marking the beginning of the params. 
TokenScope m_Scope
public? private? protected? 
bool AddChildrenOfUnnamed(TokenTree *tree, const Token *parent, TokenIdxSet &result)
collect child tokens of the specified token, the specified token must be unnamed. ...
int GetTokenFromCurrentLine(TokenTree *tree, const TokenIdxSet &tokens, size_t curLine, const wxString &file)
used to get the correct token index in current line, e.g. 
void Reset()
Init cc search member variables. 
ParserComponent()
operator type 
wxUSE_UNICODE_dependent wxChar
void RemoveLastFunctionChildren(TokenTree *tree, int &lastFuncTokenIdx)
Remove the last function's children, when doing codecompletion in a function body, the function body up to the caret position was parsed, and the local variables defined in the function were recorded as the function's children. 
bool PrettyPrintToken(TokenTree *tree, const Token *token, wxString &result, bool isRoot=true)
For ComputeCallTip() No critical section needed in this recursive function! All functions that call t...
wxString GetCCToken(wxString &line, ParserTokenType &tokenType, OperatorType &tokenOperatorType)
helper function to split the statement 
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
std::set< int, std::less< int > > TokenIdxSet
size_t ResolveActualType(TokenTree *tree, wxString searchText, const TokenIdxSet &searchScope, TokenIdxSet &result)
Get the Type information of the searchText string. 
static int AfterWhitespace(int startAt, const wxString &line)
search from left to right, move the cursor to the first character after the space ...
static bool IsClosingBracket(int startAt, const wxString &line)
check the current char (line[startAt]) is either ')' or ']' 
std::map< wxString, wxString > m_TemplateMap
ParserTokenType tokenType
name 
OperatorType
the delimiter separating two Parser Component, See ParserComponent struct for more details ...
const wxStringCharType * wx_str() const
static int CountCommas(const wxString &lineText, int start)
bool DependsOnAllocator(TokenTree *tree, const int &id)
Test if token with this id depends on allocator class. 
void ComputeCallTip(TokenTree *tree, const TokenIdxSet &tokens, wxArrayString &items)
call tips are tips when you are entering some functions, such as you have a class definition ...
static bool IsOperatorEnd(int startAt, const wxString &line)
check startAt is at some character like: 
bool wxIsalnum(const wxUniChar &c)
static int BeginOfToken(int startAt, const wxString &line)
go to the first character of the identifier, e.g 
static int BeforeToken(int startAt, const wxString &line)
TokenKind m_TokenKind
See TokenKind class. 
static bool InsideToken(int startAt, const wxString &line)
check whether the line[startAt] point to the identifier 
unsigned int FindCCTokenStart(const wxString &line)
helper function to split the statement 
ParserTokenType
divide a statement to several pieces(parser component), each component has a type member ...
a long statement can be divided to a ParserComponent chain. 
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
static int BeforeWhitespace(int startAt, const wxString &line)
move to the char before whitespace and tabs, e.g. 
void AddConstructors(TokenTree *tree, const TokenIdxSet &source, TokenIdxSet &dest)
loop on the input Token index set (source), add all its public constructors to output Token index set...
void GetCallTipHighlight(const wxString &calltip, int *start, int *end, int typedCommas)
Returns the start and end of the call-tip highlight region. 
wxUniChar GetChar(size_t n) const
void AddTemplateAlias(TokenTree *tree, const int &id, const TokenIdxSet &actualTypeScope, TokenIdxSet &initialScope)
add template parameter, get the actual parameter from the formal parameter list 
bool IsAllocator(TokenTree *tree, const int &id)
Test if token with this id is allocator class. 
bool IsChildOfUnnamedOrEnum(TokenTree *tree, const int targetIdx, const int parentIdx)
check to see if the token is an unnamed class or enum under the parent token 
void ResolveOperator(TokenTree *tree, const OperatorType &tokenOperatorType, const TokenIdxSet &tokens, const TokenIdxSet &searchScope, TokenIdxSet &result)
used to solve the overloaded operator functions return type 
void CollectSearchScopes(const TokenIdxSet &searchScope, TokenIdxSet &actualTypeScope, TokenTree *tree)
Collect search scopes, add the searchScopes's parent scope. 
NativeParserBase()
Constructor.