20 #define CC_NATIVEPARSERBASE_DEBUG_OUTPUT 0 22 #if defined(CC_GLOBAL_DEBUG_OUTPUT) 23 #if CC_GLOBAL_DEBUG_OUTPUT == 1 24 #undef CC_NATIVEPARSERBASE_DEBUG_OUTPUT 25 #define CC_NATIVEPARSERBASE_DEBUG_OUTPUT 1 26 #elif CC_GLOBAL_DEBUG_OUTPUT == 2 27 #undef CC_NATIVEPARSERBASE_DEBUG_OUTPUT 28 #define CC_NATIVEPARSERBASE_DEBUG_OUTPUT 2 33 #define ADDTOKEN(format, args...) \ 34 CCLogger::Get()->AddToken(F(format, ##args)) 35 #define TRACE(format, args...) \ 36 CCLogger::Get()->DebugLog(F(format, ##args)) 37 #define TRACE2(format, args...) \ 38 CCLogger::Get()->DebugLog(F(format, ##args)) 40 #if CC_NATIVEPARSERBASE_DEBUG_OUTPUT == 1 41 #define ADDTOKEN(format, args...) \ 42 CCLogger::Get()->AddToken(F(format, ##args)) 43 #define TRACE(format, args...) \ 44 CCLogger::Get()->DebugLog(F(format, ##args)) 45 #define TRACE2(format, args...) 46 #elif CC_NATIVEPARSERBASE_DEBUG_OUTPUT == 2 47 #define ADDTOKEN(format, args...) \ 48 CCLogger::Get()->AddToken(F(format, ##args)) 49 #define TRACE(format, args...) \ 52 if (g_EnableDebugTrace) \ 53 CCLogger::Get()->DebugLog(F(format, ##args)); \ 56 #define TRACE2(format, args...) \ 57 CCLogger::Get()->DebugLog(F(format, ##args)) 59 #define ADDTOKEN(format, args...) 60 #define TRACE(format, args...) 61 #define TRACE2(format, args...) 88 std::queue<ParserComponent> components,
97 if (components.empty())
103 TRACE(
_T(
"NativeParser::FindAIMatches()"));
110 if ((parentTokenIdx != -1) && (parser_component.
component ==
_T(
"this")))
116 return FindAIMatches(tree, components, result, parentTokenIdx,
117 isPrefix, caseSensitive, use_inheritance,
118 kindMask, search_scope);
122 bool isLastComponent = components.empty();
127 searchtext.
wx_str(), isLastComponent?1:0));
133 (caseSensitive || !isLastComponent),
134 (isLastComponent && !isPrefix), kindMask);
138 static_cast<unsigned long>(local_result.size())));
141 for (TokenIdxSet::const_iterator it = local_result.begin(); it != local_result.end(); it++)
144 const Token* token = tree->
at(
id);
165 for (TokenIdxSet::const_iterator tis_it = token->
m_Children.begin();
168 result.insert(*tis_it);
186 std::queue<ParserComponent> type_components;
198 static_cast<unsigned long>(type_components.size())));
203 temp_search_scope = *search_scope;
209 if (parentTokenIdx != -1)
211 const Token* parentToken = tree->
at(parentTokenIdx);
217 temp_search_scope.insert(parent->
m_Index);
224 TokenIdxSet::const_iterator itsearch;
225 itsearch = temp_search_scope.begin();
226 while (!search_scope || itsearch != temp_search_scope.end())
228 const Token* parent = tree->
at(*itsearch);
246 &temp_search_scope) != 0)
256 if (!type_result.empty())
259 id = *(type_result.begin());
260 if (type_result.size() > 1)
263 TokenIdxSet::const_iterator tis_it = type_result.begin();
265 while (tis_it != type_result.end())
267 std::queue<ParserComponent> lcomp = components;
270 caseSensitive, use_inheritance,
271 kindMask, search_scope);
279 if (type_result.size() > 1)
282 static_cast<unsigned long>(type_result.size())));
296 caseSensitive, use_inheritance, kindMask,
303 return result.size();
313 for (TokenIdxSet::const_iterator it = procResult.begin(); it != procResult.end(); ++it)
315 const Token* token = tree->
at(*it);
320 scopeResult.insert(*it);
324 scopeResult.insert(*it);
332 (parent ? parent->
m_Name :
_T(
"Global namespace")));
344 for (TokenIdxSet::const_iterator it = searchScope->begin(); it != searchScope->end();)
346 const Token* token = tree->
at(*it);
348 searchScope->erase(it++);
356 searchScope->insert(-1);
365 TRACE(
_T(
"NativeParserBase::GetCallTipHighlight()"));
368 int paramsCloseBracket = calltip.
length() - 1;
384 paramsCloseBracket = pos - 1;
386 else if (c ==
',' && nest == 1)
389 if (commas == typedCommas + 1)
398 *end = paramsCloseBracket;
404 for (
size_t i = calltip.
length(); i > 0; --i)
406 wxChar c = calltip[i - 1];
413 else if (c ==
wxT(
')'))
432 TRACE(
_T(
"GetCCToken() : FindCCTokenStart returned %u \"%s\""), startAt, line.
wx_str());
433 TRACE(
_T(
"GetCCToken() : GetNextCCToken returned %u \"%s\""), startAt, res.
wx_str());
436 if (startAt == line.
Len())
447 line.
Remove(0, startAt + 1);
460 if (line.
GetChar(startAt) ==
':')
464 line.
Remove(0, startAt + 1);
485 int startAt = line.
Len() - 1;
519 while ( (--startAt >= 0)
522 #if wxCHECK_VERSION(3, 0, 0) 529 case ')': ++nest; --startAt;
break;
532 case '(': --nest; --startAt;
break;
553 TRACE(
_T(
"FindCCTokenStart() : Starting at %u \"%s\""), startAt, line.
Mid(startAt).
wx_str());
559 unsigned int& startAt,
565 if ( (startAt < line.
Len())
566 && (line.
GetChar(startAt) ==
'(') )
568 while ( (startAt < line.
Len())
569 && ( (line.
GetChar(startAt) ==
'*')
570 || (line.
GetChar(startAt) ==
'&')
571 || (line.
GetChar(startAt) ==
'(') ) )
573 if (line.
GetChar(startAt) ==
'(')
581 TRACE(
_T(
"GetNextCCToken() : at %u (%c): res=%s"), startAt, line.
GetChar(startAt), res.
wx_str());
589 && (startAt < line.
Len()) )
592 if (line.
GetChar(startAt) ==
'(')
594 else if (line.
GetChar(startAt) ==
')')
599 TRACE(
_T(
"GetNextCCToken() : Done nest: at %u (%c): res=%s"), startAt, line.
GetChar(startAt), res.
wx_str());
606 else if (line.
GetChar(startAt) ==
_T(
'['))
609 while ( (startAt < line.
Len()-1)
613 #if wxCHECK_VERSION(3, 0, 0) 620 case ')': --nest; ++startAt;
break;
623 case '(': ++nest; ++startAt;
break;
646 TRACE(
_T(
"GetNextCCToken() : Return at %u (%c): res=%s"), startAt, line.
GetChar(startAt), res.
wx_str());
652 int& lastFuncTokenIdx)
656 Token* token = tree->
at(lastFuncTokenIdx);
659 lastFuncTokenIdx = -1;
682 std::queue<ParserComponent>& components)
690 TRACE(
_T(
"NativeParserBase::BreakUpComponents()"));
707 { tokenTypeString =
_T(
"Function");
break; }
709 { tokenTypeString =
_T(
"Class");
break; }
711 { tokenTypeString =
_T(
"Namespace");
break; }
713 { tokenTypeString =
_T(
"SearchText");
break; }
716 { tokenTypeString =
_T(
"Undefined"); }
741 std::queue<ParserComponent> components,
748 if (components.empty())
752 if (!searchScope.empty())
753 initialScope = searchScope;
755 initialScope.insert(-1);
757 while (!components.empty())
763 if (searchText ==
_T(
"this"))
765 initialScope.
erase(-1);
770 for (TokenIdxSet::const_iterator it = tempInitialScope.begin();
771 it != tempInitialScope.end(); ++it)
773 const Token* token = tree->
at(*it);
775 initialScope.erase(*it);
780 if (!initialScope.empty())
792 static_cast<unsigned long>(initialScope.size())));
793 for (TokenIdxSet::const_iterator tt = initialScope.begin(); tt != initialScope.end(); ++tt)
802 if (components.empty())
803 GenerateResultSet(tree, searchText, initialScope, initialResult, caseSense, isPrefix);
810 initialScope.clear();
816 static_cast<unsigned long>(initialResult.size())));
819 if (!initialResult.empty())
824 for (TokenIdxSet::const_iterator it = initialResult.begin(); it != initialResult.end(); ++it)
826 const size_t id = (*it);
828 int parentIndex = -1;
829 bool isFuncOrVar =
false;
836 const Token* token = tree->
at(
id);
852 static_cast<unsigned long>(id),
862 isFuncOrVar = !searchText.
IsEmpty()
878 if (searchScope.empty())
879 actualTypeScope.insert(-1);
888 const Token* currentTokenParent = tree->
at(parentIndex);
891 if (!currentTokenParent)
893 actualTypeScope.insert(currentTokenParent->
m_Index);
903 if (!actualTypeResult.empty())
905 for (TokenIdxSet::const_iterator it2 = actualTypeResult.begin();
906 it2 != actualTypeResult.end();
909 initialScope.insert(*it2);
913 const Token* typeToken = tree->
at(*it2);
929 initialScope.insert(
id);
937 initialScope.clear();
945 if (!operatorResult.empty())
946 initialScope = operatorResult;
953 if (!initialScope.empty())
963 return result.size();
968 for (TokenIdxSet::iterator It = source.begin(); It != source.end(); ++It)
970 const Token* token = tree->
at(*It);
979 for (TokenIdxSet::iterator chIt = token->
m_Children.begin();
983 const Token* tk = tree->
at(*chIt);
1001 if (!tree || searchScope.
empty())
1008 for (TokenIdxSet::const_iterator it=tokens.begin(); it!=tokens.end(); ++it)
1011 const Token* token = tree->
at(
id);
1013 opInitialScope.insert(
id);
1019 if (opInitialScope.empty())
1023 switch(tokenOperatorType)
1026 operatorStr =
_T(
"operator()");
break;
1028 operatorStr =
_T(
"operator[]");
break;
1030 operatorStr =
_T(
"operator->");
break;
1032 operatorStr =
_T(
"operator*");
break;
1052 if (opInitialResult.empty())
1055 for (TokenIdxSet::const_iterator it=opInitialResult.begin(); it!=opInitialResult.end(); ++it)
1060 const Token* token = tree->
at((*it));
1071 if (!typeResult.empty())
1073 for (TokenIdxSet::const_iterator pTypeResult = typeResult.begin();
1074 pTypeResult!=typeResult.end();
1077 result.insert(*pTypeResult);
1092 std::queue<ParserComponent> typeComponents;
1094 if (!typeComponents.empty())
1097 if (!searchScope.empty())
1098 initialScope = searchScope;
1100 initialScope.insert(-1);
1104 while (!typeComponents.empty())
1108 typeComponents.pop();
1112 GenerateResultSet(tree, actualTypeStr, initialScope, initialResult,
true,
false, 0xFFFF);
1114 if (!initialResult.empty())
1116 initialScope.clear();
1117 for (TokenIdxSet::const_iterator it = initialResult.begin(); it != initialResult.end(); ++it)
1119 initialScope.insert(*it);
1123 initialScope.clear();
1130 if (!initialScope.empty())
1131 result = initialScope;
1134 return result.size();
1142 if (actualTypeScope.empty())
1145 wxString actualTypeStr = searchStr;
1146 std::map<wxString, wxString>::const_iterator it =
m_TemplateMap.find(actualTypeStr);
1149 actualTypeStr = it->second;
1152 if (!actualTypeResult.empty())
1154 for (TokenIdxSet::const_iterator it2=actualTypeResult.begin(); it2!=actualTypeResult.end(); ++it2)
1155 initialScope.insert(*it2);
1165 if (!tree || actualTypeScope.
empty())
1173 const Token* typeToken = tree->
at(
id);
1180 std::map<wxString, wxString>::const_iterator it =
m_TemplateMap.find(actualTypeStr);
1183 actualTypeStr = it->second;
1185 if (actualTypeStr.
Last() ==
_T(
'&') || actualTypeStr.
Last() ==
_T(
'*'))
1190 if (!actualTypeResult.empty())
1192 for (TokenIdxSet::const_iterator it2 = actualTypeResult.begin(); it2 != actualTypeResult.end(); ++it2)
1193 initialScope.insert(*it2);
1229 TRACE(
_T(
"NativeParserBase::GenerateResultSet_1()"));
1231 Token* parent = tree->
at(parentIdx);
1244 for (TokenIdxSet::const_iterator it = parent->
m_Children.begin(); it != parent->
m_Children.end(); ++it)
1246 const Token* token = tree->
at(*it);
1253 for (
size_t i = 0; i < token->
m_Aliases.size(); ++i)
1269 for (TokenIdxSet::const_iterator it = parent->
m_Ancestors.begin(); it != parent->
m_Ancestors.end(); ++it)
1271 const Token* ancestor = tree->
at(*it);
1274 for (TokenIdxSet::const_iterator it2 = ancestor->
m_Children.begin(); it2 != ancestor->
m_Children.end(); ++it2)
1276 const Token* token = tree->
at(*it2);
1280 result.insert(*it2);
1283 for (
size_t i = 0; i < token->
m_Aliases.size(); ++i)
1287 result.insert(*it2);
1303 for (TokenList::const_iterator it = tl->begin(); it != tl->end(); ++it)
1305 const Token* token = *it;
1311 result.insert(token->
m_Index);
1314 for (
size_t i = 0; i < token->
m_Aliases.size(); ++i)
1318 result.insert(token->
m_Index);
1332 return result.size();
1406 cb_unused
short int kindMask)
1408 if (!tree)
return 0;
1410 TRACE(
_T(
"NativeParserBase::GenerateResultSet_2()"));
1414 for (TokenIdxSet::const_iterator
ptr = parentSet.
begin();
ptr != parentSet.
end(); ++
ptr)
1416 size_t parentIdx = (*ptr);
1417 Token* parent = tree->
at(parentIdx);
1421 for (TokenIdxSet::const_iterator it = parent->
m_Children.begin();
1425 const Token* token = tree->
at(*it);
1437 for (TokenIdxSet::const_iterator it = parent->
m_Ancestors.begin();
1441 const Token* ancestor = tree->
at(*it);
1444 for (TokenIdxSet::const_iterator it2 = ancestor->
m_Children.begin();
1448 const Token* token = tree->
at(*it2);
1453 result.insert(*it2);
1465 if (tree->
FindMatches(target, tmpMatches, caseSens, isPrefix))
1467 TokenIdxSet::const_iterator it;
1468 for (it = tmpMatches.begin(); it != tmpMatches.end(); ++it)
1470 const Token* token = tree->
at(*it);
1472 textMatchSet.insert(*it);
1476 if (!textMatchSet.empty())
1478 TRACE(
_T(
"Find %lu valid text matched tokens from the tree."),
1479 static_cast<unsigned long>(textMatchSet.size()));
1484 for (TokenIdxSet::const_iterator parentIterator = parentSet.begin();
1485 parentIterator != parentSet.end();
1490 int parentIdx = (*parentIterator);
1493 for (TokenIdxSet::const_iterator it = textMatchSet.begin();
1494 it != textMatchSet.end();
1497 const Token* token = tree->
at(*it);
1513 if (parentIdx != -1)
1515 Token* tokenParent = tree->
at(parentIdx);
1530 for ( TokenIdxSet::const_iterator ancestorIterator = tokenParent->
m_Ancestors.begin();
1531 ancestorIterator != tokenParent->
m_Ancestors.end();
1532 ++ancestorIterator )
1541 else if (-1 == parentIdx)
1570 if (parentSet.count(-1))
1573 for (TokenList::const_iterator it = tl->begin(); it != tl->end(); ++it)
1575 const Token* token = (*it);
1578 for (
size_t i = 0; i < token->
m_Aliases.size(); ++i)
1582 result.insert(token->
m_Index);
1592 return result.size();
1603 const Token* token = tree->
at(
id);
1617 const Token* token = tree->
at(
id);
1641 for (TokenIdxSet::const_iterator pScope=searchScope.begin(); pScope!=searchScope.end(); ++pScope)
1643 actualTypeScope.insert(*pScope);
1645 if ((*pScope) != -1)
1647 const Token* token = tree->
at(*pScope);
1655 actualTypeScope.insert(parent->
m_Index);
1671 TRACE(
_T(
"NativeParserBase::GetTokenFromCurrentLine()"));
1679 const Token* classToken =
nullptr;
1680 for (TokenIdxSet::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
1682 const Token* token = tree->
at(*it);
1686 TRACE(
_T(
"GetTokenFromCurrentLine() Iterating: tN='%s', tF='%s', tStart=%u, tEnd=%u"),
1695 TRACE(
_T(
"GetTokenFromCurrentLine() tkAnyFunction : tN='%s', tF='%s', tStart=%u, tEnd=%u"),
1706 TRACE(
_T(
"GetTokenFromCurrentLine() tkConstructor : tN='%s', tF='%s', tStart=%u, tEnd=%u"),
1716 TRACE(
_T(
"GetTokenFromCurrentLine() tkClass : tN='%s', tF='%s', tStart=%u, tEnd=%u"),
1725 TRACE(
_T(
"GetTokenFromCurrentLine() Function out of bounds: tN='%s', tF='%s', tStart=%u, ")
1728 static_cast<unsigned long>(curLine), static_cast<unsigned long>(curLine));
1743 for (TokenIdxSet::const_iterator it = tokens.begin(); it != tokens.end(); ++it)
1745 const Token* token = tree->
at(*it);
1754 for (TokenIdxSet::const_iterator clIt = classes.begin(); clIt != classes.end(); ++clIt)
1756 const Token* tk = tree->
at(*clIt);
1766 for (TokenIdxSet::iterator chIt = token->
m_Children.begin();
1770 const Token* tk = tree->
at(*chIt);
1820 tkTip =
wxT(
"Error while pretty printing token!");
1867 result +=
wxT(
" const");
1869 result +=
wxT(
" noexcept");
std::vector< Token * > TokenList
wxString F(const wxChar *msg,...)
sprintf-like function
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.
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
static bool IsOperatorPointer(int startAt, const wxString &line)
static bool IsOperatorDot(int startAt, const wxString &line)
check whether line[startAt] is a dot character
int m_ParentIndex
Parent Token index.
const_iterator begin() const
constructor class member function
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...
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
wxString m_BaseType
this is what the parser believes is the actual return value: e.g.
wxString m_Name
Token's name, it can be searched in the TokenTree.
unsigned int m_ImplLine
function implementation line index
typedef, note typedefs are stored as classes inheriting from the typedef'd type, this takes advantage...
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
container like tokens, those tokens can have children tokens
wxString GetFilename() const
get a full path of the file which contains the current Token
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
unsigned int m_ImplLineStart
if token is impl, opening brace line
TokenIdxSet m_Ancestors
all the ancestors in the inheritance hierarchy
int m_Index
current Token index in the tree, it is index of the std::vector<Token*>, so use the index...
static bool IsOpeningBracket(int startAt, const wxString &line)
Test whether the current character is a '(' or '['.
unsigned int m_ImplLineEnd
if token is impl, closing brace line
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.
wxString & Remove(size_t pos)
bool m_IsNoExcept
the member method is noexcept (yes/no)
bool MatchType(TokenKind kind, short int kindMask)
wxArrayString m_Aliases
used for namespace aliases
This is just a simple lexer class.
int FindFunctionOpenParenthesis(const wxString &calltip)
Finds the position of the opening parenthesis marking the beginning of the params.
TokenScope m_Scope
public? private? protected?
wxString DisplayName() const
a short simple string to show the token information, this usually generate for show the tip message w...
bool m_IsOperator
is operator overload function?
bool AddChildrenOfUnnamed(TokenTree *tree, const Token *parent, TokenIdxSet &result)
collect child tokens of the specified token, the specified token must be unnamed. ...
void DebugLog(const wxString &msg)
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.
void RecalcInheritanceChain(Token *token)
convert the Token's ancestor string to it's IDs this contains recursive calls, for example in such co...
bool empty()
check to see whether the TokenTree is empty
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
value_type GetValue() const
a symbol found in the parsed files, it can be many kinds, such as a variable, a class and so on...
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.
size_t ResolveActualType(TokenTree *tree, wxString searchText, const TokenIdxSet &searchScope, TokenIdxSet &result)
Get the Type information of the searchText string.
wxString m_TemplateAlias
alias for templates, e.g.
static int AfterWhitespace(int startAt, const wxString &line)
search from left to right, move the cursor to the first character after the space ...
bool IsSameAs(const wxString &s, bool caseSensitive=true) const
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
bool m_IsConst
the member method is const (yes/no)
OperatorType
the delimiter separating two Parser Component, See ParserComponent struct for more details ...
#define CC_LOCKER_TRACK_TT_MTX_UNLOCK(M)
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.
const TokenList * GetTokens() const
Protected access to internal lists / maps.
bool s_DebugSmartSense
if this option is enabled, there will be many log messages when doing semantic match ...
bool HasChildren() const
check if the token has any child tokens.
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 ...
const wxString & _(const wxString &string)
static bool IsOperatorEnd(int startAt, const wxString &line)
check startAt is at some character like:
wxString m_Args
If it is a function Token, then this value is function arguments, e.g.
unsigned int m_ImplFileIdx
function implementation file index
#define CC_LOCKER_TRACK_TT_MTX_LOCK(M)
static int BeginOfToken(int startAt, const wxString &line)
go to the first character of the identifier, e.g
wxString m_TemplateArgument
template argument list, comma separated list string
static int BeforeToken(int startAt, const wxString &line)
wxString & erase(size_type pos=0, size_type n=npos)
bool DeleteAllChildren()
delete all the child tokens of the current token, not only remove the relation, but also delete the T...
TokenKind m_TokenKind
See TokenKind class.
static bool InsideToken(int startAt, const wxString &line)
check whether the line[startAt] point to the identifier
const_iterator end() const
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
general function, not constructor nor destructor
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.
size_t Add(const wxString &str, size_t copies=1)
const wxString ptr(_T("*"))
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...
size_t FindMatches(const wxString &query, TokenIdxSet &result, bool caseSensitive, bool is_prefix, TokenKind kindMask=tkUndefined)
find a collection of matched tokens
void GetCallTipHighlight(const wxString &calltip, int *start, int *end, int typedCommas)
Returns the start and end of the call-tip highlight region.
int Find(wxUniChar ch, bool fromEnd=false) const
wxUniChar GetChar(size_t n) const
macro definition, such as: #define AAA(x,y) f(x,y), where AAA is a token of tkMacroDef ...
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
wxString m_FullType
this is the full return value (if any): e.g.
wxString GetTokenKindString() const
the token kind string, e.g.
void CollectSearchScopes(const TokenIdxSet &searchScope, TokenIdxSet &actualTypeScope, TokenTree *tree)
Collect search scopes, add the searchScopes's parent scope.
NativeParserBase()
Constructor.
#define TRACE(format, args...)
wxString Mid(size_t first, size_t nCount=wxString::npos) const
wxString GetToken()
Consume and return the current token string.
the usage of the macro, for example: AAA(1,2)