Code::Blocks
SVN r11506
|
#include <nativeparser_base.h>
Classes | |
struct | ParserComponent |
a long statement can be divided to a ParserComponent chain. More... | |
Public Types | |
enum | ParserTokenType { pttUndefined = 0, pttSearchText, pttClass, pttNamespace, pttFunction } |
divide a statement to several pieces(parser component), each component has a type member More... | |
enum | OperatorType { otOperatorUndefined = 0, otOperatorSquare, otOperatorParentheses, otOperatorPointer, otOperatorStar } |
the delimiter separating two Parser Component, See ParserComponent struct for more details More... | |
Public Member Functions | |
NativeParserBase () | |
Constructor. More... | |
virtual | ~NativeParserBase () |
Destructor. More... | |
Protected Member Functions | |
void | Reset () |
Init cc search member variables. More... | |
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. More... | |
void | FindCurrentFunctionScope (TokenTree *tree, const TokenIdxSet &procResult, TokenIdxSet &scopeResult) |
if the expression return the container tokens, which are the parent of the expression. More... | |
void | CleanupSearchScope (TokenTree *tree, TokenIdxSet *searchScope) |
remove all the container tokens in the token index set. More... | |
void | GetCallTipHighlight (const wxString &calltip, int *start, int *end, int typedCommas) |
Returns the start and end of the call-tip highlight region. More... | |
int | FindFunctionOpenParenthesis (const wxString &calltip) |
Finds the position of the opening parenthesis marking the beginning of the params. More... | |
wxString | GetCCToken (wxString &line, ParserTokenType &tokenType, OperatorType &tokenOperatorType) |
helper function to split the statement More... | |
unsigned int | FindCCTokenStart (const wxString &line) |
helper function to split the statement More... | |
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, and fetch the beginning identifier More... | |
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. More... | |
size_t | BreakUpComponents (const wxString &actual, std::queue< ParserComponent > &components) |
break a statement to several ParserComponents, and store them in a queue. More... | |
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 queue one by one. More... | |
void | ResolveOperator (TokenTree *tree, const OperatorType &tokenOperatorType, const TokenIdxSet &tokens, const TokenIdxSet &searchScope, TokenIdxSet &result) |
used to solve the overloaded operator functions return type More... | |
size_t | ResolveActualType (TokenTree *tree, wxString searchText, const TokenIdxSet &searchScope, TokenIdxSet &result) |
Get the Type information of the searchText string. More... | |
void | ResolveTemplateMap (TokenTree *tree, const wxString &searchStr, const TokenIdxSet &actualTypeScope, TokenIdxSet &initialScope) |
resolve template map [formal parameter] to [actual parameter] More... | |
void | AddTemplateAlias (TokenTree *tree, const int &id, const TokenIdxSet &actualTypeScope, TokenIdxSet &initialScope) |
add template parameter, get the actual parameter from the formal parameter list More... | |
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. More... | |
size_t | GenerateResultSet (TokenTree *tree, const wxString &target, const TokenIdxSet &ptrParentID, TokenIdxSet &result, bool caseSens=true, bool isPrefix=false, short int kindMask=0xFFFF) |
This function is just like the one above, especially that it use a single parent Token id, not the parent id set in previous one. More... | |
bool | IsAllocator (TokenTree *tree, const int &id) |
Test if token with this id is allocator class. More... | |
bool | DependsOnAllocator (TokenTree *tree, const int &id) |
Test if token with this id depends on allocator class. More... | |
void | CollectSearchScopes (const TokenIdxSet &searchScope, TokenIdxSet &actualTypeScope, TokenTree *tree) |
Collect search scopes, add the searchScopes's parent scope. More... | |
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. More... | |
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 More... | |
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 this recursive function, should already entered a critical section. More... | |
Static Protected Member Functions | |
static int | CountCommas (const wxString &lineText, int start) |
static bool | InsideToken (int startAt, const wxString &line) |
check whether the line[startAt] point to the identifier More... | |
static int | BeginOfToken (int startAt, const wxString &line) |
go to the first character of the identifier, e.g More... | |
static int | BeforeToken (int startAt, const wxString &line) |
static bool | IsOperatorEnd (int startAt, const wxString &line) |
check startAt is at some character like: More... | |
static bool | IsOperatorPointer (int startAt, const wxString &line) |
static bool | IsOperatorBegin (int startAt, const wxString &line) |
check if startAt point to "->" or "::" operator More... | |
static bool | IsOperatorDot (int startAt, const wxString &line) |
check whether line[startAt] is a dot character More... | |
static int | BeforeWhitespace (int startAt, const wxString &line) |
move to the char before whitespace and tabs, e.g. More... | |
static int | AfterWhitespace (int startAt, const wxString &line) |
search from left to right, move the cursor to the first character after the space More... | |
static bool | IsOpeningBracket (int startAt, const wxString &line) |
Test whether the current character is a '(' or '['. More... | |
static bool | IsClosingBracket (int startAt, const wxString &line) |
check the current char (line[startAt]) is either ')' or ']' More... | |
Private Member Functions | |
bool | AddChildrenOfUnnamed (TokenTree *tree, const Token *parent, TokenIdxSet &result) |
collect child tokens of the specified token, the specified token must be unnamed. More... | |
bool | AddChildrenOfEnum (TokenTree *tree, const Token *parent, TokenIdxSet &result) |
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 More... | |
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 (dest) More... | |
bool | MatchText (const wxString &text, const wxString &target, bool caseSens, bool isPrefix) |
bool | MatchType (TokenKind kind, short int kindMask) |
Private Attributes | |
ParserComponent | m_LastComponent |
std::map< wxString, wxString > | m_TemplateMap |
Definition at line 23 of file nativeparser_base.h.
the delimiter separating two Parser Component, See ParserComponent struct for more details
Enumerator | |
---|---|
otOperatorUndefined | |
otOperatorSquare | |
otOperatorParentheses | |
otOperatorPointer | |
otOperatorStar |
Definition at line 37 of file nativeparser_base.h.
divide a statement to several pieces(parser component), each component has a type member
Enumerator | |
---|---|
pttUndefined | |
pttSearchText | |
pttClass | |
pttNamespace | |
pttFunction |
Definition at line 27 of file nativeparser_base.h.
NativeParserBase::NativeParserBase | ( | ) |
Constructor.
Definition at line 65 of file nativeparser_base.cpp.
Referenced by NativeParserBase::ParserComponent::Clear().
|
virtual |
Destructor.
Definition at line 69 of file nativeparser_base.cpp.
Referenced by NativeParserBase::ParserComponent::Clear().
|
inlineprivate |
Definition at line 669 of file nativeparser_base.h.
References TokenTree::at(), Token::m_Children, Token::m_Scope, Token::m_TokenKind, tkEnum, and tsPrivate.
Referenced by AddChildrenOfUnnamed(), and GenerateResultSet().
|
inlineprivate |
collect child tokens of the specified token, the specified token must be unnamed.
used for GenerateResultSet() function
tree | TokenTree pointer |
parent | we need to collect the children of this token |
result | collected tokens |
Definition at line 643 of file nativeparser_base.h.
References AddChildrenOfEnum(), TokenTree::at(), Token::m_Children, Token::m_IsAnonymous, Token::m_Scope, Token::m_TokenKind, tkClass, tkEnum, and tsPrivate.
Referenced by GenerateResultSet().
|
private |
loop on the input Token index set (source), add all its public constructors to output Token index set (dest)
Definition at line 966 of file nativeparser_base.cpp.
References TokenTree::at(), wxString::EndsWith(), Token::m_Children, Token::m_IsOperator, Token::m_Name, Token::m_Scope, Token::m_TokenKind, tkClass, tkConstructor, tsPublic, tsUndefined, and wxT.
Referenced by IsChildOfUnnamedOrEnum(), and ResolveExpression().
|
protected |
add template parameter, get the actual parameter from the formal parameter list
id | template token id |
actualTypeScope | search scope |
initialScope | resolved result |
tree | Token tree pointer. |
Definition at line 1160 of file nativeparser_base.cpp.
References _T, TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, TokenTree::empty(), wxString::IsEmpty(), wxString::Last(), Token::m_TemplateAlias, m_TemplateMap, Token::m_TokenKind, wxString::RemoveLast(), ResolveActualType(), s_TokenTreeMutex, and tkTypedef.
Referenced by NativeParserBase::ParserComponent::Clear(), ResolveExpression(), and ResolveOperator().
|
inlinestaticprotected |
search from left to right, move the cursor to the first character after the space
[in] | startAt | the begin of the cursor |
[in] | line | the string buffer |
Definition at line 598 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by FindCCTokenStart(), GetCCToken(), and GetNextCCToken().
|
inlinestaticprotected |
Definition at line 513 of file nativeparser_base.h.
References wxString::GetChar(), wxString::Len(), and wxIsalnum().
Referenced by FindCCTokenStart().
|
inlinestaticprotected |
move to the char before whitespace and tabs, e.g.
the returned index is -1.
Definition at line 579 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by FindCCTokenStart().
|
inlinestaticprotected |
go to the first character of the identifier, e.g
this is the index before the first character of the identifier
Definition at line 504 of file nativeparser_base.h.
References wxString::GetChar(), wxString::Len(), and wxIsalnum().
Referenced by FindCCTokenStart().
|
protected |
break a statement to several ParserComponents, and store them in a queue.
actual | a statement string to be divided. |
components | output variable containing the queue. |
Definition at line 681 of file nativeparser_base.cpp.
References _T, NativeParserBase::ParserComponent::component, CCLogger::DebugLog(), F(), CCLogger::Get(), GetCCToken(), wxString::IsEmpty(), pttClass, pttFunction, pttNamespace, pttSearchText, pttUndefined, s_DebugSmartSense, NativeParserBase::ParserComponent::tokenOperatorType, NativeParserBase::ParserComponent::tokenType, TRACE, and wxString::wx_str().
Referenced by NativeParser::AI(), NativeParserBase::ParserComponent::Clear(), FindAIMatches(), NativeParser::FindCurrentFunctionToken(), NativeParser::ParseBufferForUsingNamespace(), and ResolveActualType().
|
protected |
remove all the container tokens in the token index set.
searchScope | The Tokens we need to remove from the tree |
Definition at line 339 of file nativeparser_base.cpp.
References TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, Token::m_TokenKind, s_TokenTreeMutex, tkAnyFunction, tkClass, tkNamespace, and tkTypedef.
Referenced by NativeParser::AI(), and NativeParserBase::ParserComponent::Clear().
|
protected |
Collect search scopes, add the searchScopes's parent scope.
searchScope | input search scope |
actualTypeScope | returned search scope |
tree | TokenTree pointer |
Definition at line 1635 of file nativeparser_base.cpp.
References TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, Token::m_Index, Token::m_ParentIndex, and s_TokenTreeMutex.
Referenced by NativeParserBase::ParserComponent::Clear(), ResolveExpression(), and ResolveOperator().
|
protected |
call tips are tips when you are entering some functions, such as you have a class definition
then there will be a tip window show the function prototype of the function
Definition at line 1737 of file nativeparser_base.cpp.
References _T, wxArrayString::Add(), TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, wxString::empty(), wxString::EndsWith(), TokenTree::FindMatches(), Tokenizer::GetToken(), Tokenizer::InitFromBuffer(), Token::m_Args, Token::m_BaseType, Token::m_Children, Token::m_FullType, Token::m_IsOperator, Token::m_Name, Token::m_Scope, Token::m_TokenKind, Tokenizer::PeekToken(), PrettyPrintToken(), s_TokenTreeMutex, tkClass, tkConstructor, tkFunction, tkMacroDef, tkVariable, TokenTree::TokenExists(), tsPublic, tsUndefined, and wxT.
Referenced by NativeParserBase::ParserComponent::Clear(), and NativeParser::GetCallTips().
|
inlinestaticprotected |
Definition at line 464 of file nativeparser_base.h.
References wxString::GetChar().
|
protected |
Test if token with this id depends on allocator class.
Currently, this function only identifies STL containers dependent on allocator.
All functions that call this recursive function, should already entered a critical section.
tree | TokenTree pointer |
id | token idx |
Definition at line 1611 of file nativeparser_base.cpp.
References _T, TokenTree::at(), wxString::Find(), Token::m_ParentIndex, Token::m_TemplateArgument, and wxNOT_FOUND.
Referenced by NativeParserBase::ParserComponent::Clear(), and GenerateResultSet().
|
protected |
Artificial Intelligence Matching.
All functions that call this recursive function, should already entered a critical section or a mutex to protect the TokenTree.
match (consume) the ParserComponent queue from left to right, the output result becomes the search scope of the next match. finally, give the results which match the last ParserComponent.
components | input ParserComponent queue |
parentTokenIdx,initial | search scope of the left most component, this is the direct parent of the current statement(expression) |
fullMatch | the result should be a full text match or prefix match |
Definition at line 87 of file nativeparser_base.cpp.
References _(), _T, TokenTree::at(), BreakUpComponents(), NativeParserBase::ParserComponent::component, CCLogger::DebugLog(), F(), GenerateResultSet(), CCLogger::Get(), wxString::IsEmpty(), Token::m_BaseType, Token::m_Children, Token::m_Index, Token::m_IsOperator, Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, pttSearchText, s_DebugSmartSense, tkClass, tkEnum, tkNamespace, tkTypedef, NativeParserBase::ParserComponent::tokenType, TRACE, and wxString::wx_str().
Referenced by NativeParserBase::ParserComponent::Clear(), and NativeParser::FindCurrentFunctionToken().
|
protected |
helper function to split the statement
so, brace level should be considered
Definition at line 482 of file nativeparser_base.cpp.
References _T, AfterWhitespace(), BeforeToken(), BeforeWhitespace(), BeginOfToken(), wxString::GetChar(), wxUniChar::GetValue(), IsClosingBracket(), IsOpeningBracket(), IsOperatorDot(), IsOperatorEnd(), wxString::Len(), wxString::Mid(), TRACE, and wxString::wx_str().
Referenced by NativeParserBase::ParserComponent::Clear(), and GetCCToken().
|
protected |
if the expression return the container tokens, which are the parent of the expression.
[in] | procResult | input function index collection |
[out] | scopeResult | filtered output function index collection For example, if we have such code class A { void f() { statement|<-----CC here }; } |
Definition at line 306 of file nativeparser_base.cpp.
References _T, TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, CCLogger::DebugLog(), CCLogger::Get(), Token::HasChildren(), Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, s_DebugSmartSense, s_TokenTreeMutex, tkAnyFunction, and tkClass.
Referenced by NativeParser::AI(), and NativeParserBase::ParserComponent::Clear().
|
protected |
Finds the position of the opening parenthesis marking the beginning of the params.
See GetCallTipHighlight() for more details
Definition at line 401 of file nativeparser_base.cpp.
References wxString::length(), and wxT.
Referenced by NativeParserBase::ParserComponent::Clear(), and GetCallTipHighlight().
|
protected |
Generate the matching results under the Parent Token index set.
All functions that call this recursive function, should already entered a critical section.
tree | TokenTree pointer |
target | Scope (defined in TokenIdxSet) |
result | result token index set |
isPrefix | whether a full match is used or only do a prefix match |
kindMask | define the result tokens filter, such as only class type is OK |
Definition at line 1221 of file nativeparser_base.cpp.
References _(), _T, AddChildrenOfEnum(), AddChildrenOfUnnamed(), TokenTree::at(), wxString::begin(), CCLogger::DebugLog(), DependsOnAllocator(), wxString::end(), F(), TokenTree::FindMatches(), CCLogger::Get(), Token::GetTokenKindString(), TokenTree::GetTokens(), IsAllocator(), IsChildOfUnnamedOrEnum(), wxString::IsEmpty(), Token::m_Aliases, Token::m_Ancestors, Token::m_Children, Token::m_Index, Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, MatchText(), MatchType(), ParserConsts::ptr, TokenTree::RecalcInheritanceChain(), s_DebugSmartSense, tkEnum, tkNamespace, TRACE, and wxString::wx_str().
Referenced by NativeParserBase::ParserComponent::Clear(), FindAIMatches(), NativeParser::FindCurrentFunctionToken(), ResolveActualType(), ResolveExpression(), and ResolveOperator().
|
protected |
This function is just like the one above, especially that it use a single parent Token id, not the parent id set in previous one.
All functions that call this recursive function, should already entered a critical section.
|
protected |
Returns the start and end of the call-tip highlight region.
For a function prototype "void MyNamespace::SomeClass::func(int a, float b)" if we have a function call statement "obj->f(x,y)", when we hover on the "y", we should high light the "float b" in the calltip
[in] | calltip | is the calltip string |
[out] | start | the start index of the high light string |
[out] | end | the end index of the high light string |
[in] | typedCommas | e.g. "func(x, y)", in this case, we say we have typed one comma before the hovered "y", so we know we need to high light the second parameter, which is "float b" |
Definition at line 360 of file nativeparser_base.cpp.
References _T, FindFunctionOpenParenthesis(), wxString::GetChar(), wxString::length(), and TRACE.
Referenced by NativeParserBase::ParserComponent::Clear().
|
protected |
helper function to split the statement
line | a statement string | |
[out] | tokenType | the returned type of the string |
[out] | tokenOperatorType | if it is a function call token, specify which type of function call It contains a string on the following form: char* mychar = SomeNamespace::m_SomeVar.SomeMeth ^----start from here |
first we locate the first non-space char starting from the end:
then we remove everything before it, so we get "SomeNamespace::m_SomeVar.SomeMeth"
Now we cut the first component "SomeNamespace" and return it. The statement line becomes:
so that if we call this function again with the (modified) line, we'll return "m_SomeVar" and modify line (again) to become:
and so on and so forth until we return an empty string... NOTE: if we find () args or [] arrays in our way, we skip them (done in GetNextCCToken)... todo: it looks like [] is not skipped, because we have to handle the operator[] also, if we see a aaa(), we always think it is a function call
Definition at line 419 of file nativeparser_base.cpp.
References _T, AfterWhitespace(), wxString::Clear(), FindCCTokenStart(), wxString::GetChar(), GetNextCCToken(), wxString::IsEmpty(), IsOperatorDot(), IsOperatorEnd(), IsOperatorPointer(), wxString::Len(), otOperatorParentheses, otOperatorPointer, otOperatorSquare, otOperatorUndefined, pttClass, pttFunction, pttNamespace, pttSearchText, wxString::Remove(), TRACE, wxString::wx_str(), and wxEmptyString.
Referenced by BreakUpComponents(), and NativeParserBase::ParserComponent::Clear().
|
protected |
helper function to read the next CCToken, begin from the startAt, this point to a non-space character, and fetch the beginning identifier
startAt | this will be updated to the char after the identifier |
tokenOperatorType | the type of the operator E.g. SomeMethod()-> ^begin |
Definition at line 558 of file nativeparser_base.cpp.
References _T, AfterWhitespace(), wxString::GetChar(), wxUniChar::GetValue(), InsideToken(), IsClosingBracket(), IsOpeningBracket(), IsOperatorBegin(), wxString::Len(), otOperatorParentheses, otOperatorSquare, otOperatorStar, TRACE, and wxString::wx_str().
Referenced by NativeParserBase::ParserComponent::Clear(), and GetCCToken().
|
protected |
used to get the correct token index in current line, e.g.
tokens | all current file's function and class, which cover the current line |
curLine | the line of the current caret position |
file | editor file name |
Definition at line 1666 of file nativeparser_base.cpp.
References _T, TokenTree::at(), Token::DisplayName(), Token::GetFilename(), TokenTree::InsertFileOrGetIndex(), Token::m_ImplFileIdx, Token::m_ImplLine, Token::m_ImplLineEnd, Token::m_ImplLineStart, Token::m_Index, Token::m_TokenKind, tkAnyFunction, tkClass, tkConstructor, TRACE, and wxString::wx_str().
Referenced by NativeParserBase::ParserComponent::Clear(), and NativeParser::FindCurrentFunctionStart().
|
inlinestaticprotected |
check whether the line[startAt] point to the identifier
Definition at line 489 of file nativeparser_base.h.
References wxString::GetChar(), wxString::Len(), and wxIsalnum().
Referenced by GetNextCCToken().
|
protected |
Test if token with this id is allocator class.
All functions that call this function, should already entered a critical section.
tree | TokenTree pointer |
id | token idx |
Definition at line 1597 of file nativeparser_base.cpp.
References _T, TokenTree::at(), wxString::IsSameAs(), and Token::m_Name.
Referenced by NativeParserBase::ParserComponent::Clear(), and GenerateResultSet().
|
inlineprivate |
check to see if the token is an unnamed class or enum under the parent token
This function will internally recursive call itself.
tree | pointer to the TokenTree |
targetIdx | the checked token index |
parentIdx | the search scope |
Definition at line 695 of file nativeparser_base.h.
References AddConstructors(), TokenTree::at(), Token::m_Children, Token::m_IsAnonymous, Token::m_TokenKind, tkClass, and tkEnum.
Referenced by GenerateResultSet().
|
inlinestaticprotected |
check the current char (line[startAt]) is either ')' or ']'
Definition at line 621 of file nativeparser_base.h.
References wxString::GetChar().
Referenced by FindCCTokenStart(), and GetNextCCToken().
|
inlinestaticprotected |
Test whether the current character is a '(' or '['.
startAt | the current cursor on the buffer |
Definition at line 613 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by FindCCTokenStart(), and GetNextCCToken().
|
inlinestaticprotected |
check if startAt point to "->" or "::" operator
Definition at line 550 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by GetNextCCToken().
|
inlinestaticprotected |
check whether line[startAt] is a dot character
Definition at line 561 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by FindCCTokenStart(), and GetCCToken().
|
inlinestaticprotected |
check startAt is at some character like:
Definition at line 531 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by FindCCTokenStart(), and GetCCToken().
|
inlinestaticprotected |
Definition at line 540 of file nativeparser_base.h.
References wxString::GetChar(), and wxString::Len().
Referenced by GetCCToken().
|
inlineprivate |
Definition at line 730 of file nativeparser_base.h.
References wxString::IsEmpty(), wxString::StartsWith(), wxString::Upper(), and wxString::wx_str().
Referenced by GenerateResultSet().
|
inlineprivate |
Definition at line 743 of file nativeparser_base.h.
Referenced by GenerateResultSet().
|
protected |
For ComputeCallTip() No critical section needed in this recursive function! All functions that call this recursive function, should already entered a critical section.
Definition at line 1828 of file nativeparser_base.cpp.
References TokenTree::at(), wxString::empty(), Token::GetFormattedArgs(), wxString::IsEmpty(), Token::m_Args, Token::m_BaseType, Token::m_FullType, Token::m_IsConst, Token::m_IsNoExcept, Token::m_Name, Token::m_ParentIndex, Token::m_TokenKind, tkAnyContainer, tkAnyFunction, tkClass, tkConstructor, tkDestructor, tkEnum, tkEnumerator, tkFunction, tkMacroDef, tkMacroUse, tkNamespace, tkTypedef, tkUndefined, tkVariable, TokenTree::TokenExists(), and wxT.
Referenced by NativeParserBase::ParserComponent::Clear(), and ComputeCallTip().
|
protected |
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.
Note that these tokens are marked as temporary tokens, so if the edit caret moves to another function body, these temporary tokens should be removed.
Definition at line 651 of file nativeparser_base.cpp.
References TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, Token::DeleteAllChildren(), Token::m_TokenKind, s_TokenTreeMutex, and tkAnyFunction.
Referenced by NativeParserBase::ParserComponent::Clear(), NativeParser::MarkItemsByAI(), and NativeParser::SetParser().
|
protected |
Init cc search member variables.
Definition at line 73 of file nativeparser_base.cpp.
References NativeParserBase::ParserComponent::Clear(), and m_LastComponent.
Referenced by NativeParserBase::ParserComponent::Clear(), and NativeParser::InitCCSearchVariables().
|
protected |
Get the Type information of the searchText string.
searchText | input search text |
searchScope | search scope defined in TokenIdxSet format |
result | result token specify the Type of searchText |
Definition at line 1086 of file nativeparser_base.cpp.
References BreakUpComponents(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, NativeParserBase::ParserComponent::component, GenerateResultSet(), and s_TokenTreeMutex.
Referenced by AddTemplateAlias(), NativeParserBase::ParserComponent::Clear(), ResolveExpression(), ResolveOperator(), and ResolveTemplateMap().
|
protected |
A statement(expression) is expressed by a ParserComponent queue We do a match from the left of the queue one by one.
Here is a simple description about the algorithm, suppose we have such code snippet
We first split the statement "obj.fun()." into 3 components: component name
We do three loops here, each loop, we consume one component. Also each loop's result will serve as the next loop's search scope.
Loop 1 We first search the tree by the text "obj", we find a matched variable token, which has the type string "AAA::CCC", then the text "AAA::CCC" is resolved to a class kind token "class CCC" Loop 2 We search the tree by the text "fun". Here the search scope should be "CCC", it's the result from the previous loop, so we find that there is a function kind token under "class CCC", which is "function fun()" token. Then we need to see the return type of the fun() token, which is the name "BBB". Then we do another text search for "BBB" in the tree, and find a class kind token "class BBB" Loop 3 Since the last search text is empty, we just return all the children of the "class BBB" token, so finally, we give the child variable kind token "m_aaa", then the code suggestion should prompt the string "m_aaa"
tree | the token tree pointer | |
components | expression structure expressed in std::queue<ParserComponent> | |
searchScope | search scope defined by TokenIdxSet | |
[out] | the | final result token index |
caseSense | case sensitive match | |
isPrefix | match type( full match or prefix match) |
Definition at line 740 of file nativeparser_base.cpp.
References _T, AddConstructors(), AddTemplateAlias(), TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, CollectSearchScopes(), NativeParserBase::ParserComponent::component, CCLogger::DebugLog(), wxString::erase(), F(), GenerateResultSet(), CCLogger::Get(), wxString::IsEmpty(), Token::m_BaseType, Token::m_Index, Token::m_IsOperator, m_LastComponent, Token::m_Name, Token::m_ParentIndex, Token::m_TemplateMap, m_TemplateMap, Token::m_TokenKind, otOperatorUndefined, pttNamespace, pttSearchText, ResolveActualType(), ResolveOperator(), ResolveTemplateMap(), s_DebugSmartSense, s_TokenTreeMutex, tkClass, NativeParserBase::ParserComponent::tokenOperatorType, NativeParserBase::ParserComponent::tokenType, and wxString::wx_str().
Referenced by NativeParser::AI(), and NativeParserBase::ParserComponent::Clear().
|
protected |
used to solve the overloaded operator functions return type
tokenOperatorType | overloaded operator type, could be [], (), -> |
tokens | input tokens set |
tree | Token tree pointer |
searchScope | search scope |
result | output result |
Definition at line 995 of file nativeparser_base.cpp.
References _T, AddTemplateAlias(), TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, CollectSearchScopes(), TokenTree::empty(), GenerateResultSet(), wxString::IsEmpty(), Token::m_BaseType, Token::m_TokenKind, otOperatorParentheses, otOperatorPointer, otOperatorSquare, otOperatorStar, otOperatorUndefined, ResolveActualType(), ResolveTemplateMap(), s_TokenTreeMutex, tkClass, and tkTypedef.
Referenced by NativeParserBase::ParserComponent::Clear(), and ResolveExpression().
|
protected |
resolve template map [formal parameter] to [actual parameter]
searchStr | input Search String |
actualtypeScope | Token type(actual parameter) |
initialScope | search scope |
Definition at line 1137 of file nativeparser_base.cpp.
References m_TemplateMap, and ResolveActualType().
Referenced by NativeParserBase::ParserComponent::Clear(), ResolveExpression(), and ResolveOperator().
|
private |
Definition at line 749 of file nativeparser_base.h.
Referenced by Reset(), and ResolveExpression().
Definition at line 750 of file nativeparser_base.h.
Referenced by AddTemplateAlias(), ResolveExpression(), and ResolveTemplateMap().