Code::Blocks  SVN r11506
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
NativeParser Class Reference

NativeParser class is just like a manager class to control Parser objects. More...

#include <nativeparser.h>

Inheritance diagram for NativeParser:
Collaboration diagram for NativeParser:

Public Member Functions

 NativeParser ()
 Constructor. More...
 
 ~NativeParser ()
 Destructor. More...
 
ParserBaseGetParser ()
 return a reference to the currently active Parser object More...
 
ParserBaseGetParserByProject (cbProject *project)
 return the Parser pointer corresponding to the input C::B project More...
 
ParserBaseGetParserByFilename (const wxString &filename)
 return the Parser pointer associated with the input file If a file belongs to several Parser objects, the first found Parser will returned. More...
 
cbProjectGetProjectByParser (ParserBase *parser)
 return the C::B project associated with Parser pointer More...
 
cbProjectGetProjectByFilename (const wxString &filename)
 return the C::B project containing the filename The function first try to match the filename in the active project, next to match other projects opened, If the file exists in several projects, the first matched project will be returned. More...
 
cbProjectGetProjectByEditor (cbEditor *editor)
 return the C::B project containing the cbEditor pointer More...
 
cbProjectGetCurrentProject ()
 Get current project by active editor or just return active project. More...
 
bool IsParserPerWorkspace () const
 Return true if use one Parser per whole workspace. More...
 
bool Done ()
 Return true if all the parser's batch-parse stages are finished, otherwise return false. More...
 
wxImageListGetImageList ()
 Used to support Symbol browser and codecompletion UI Image list is used to initialize the symbol browser tree node image. More...
 
int GetTokenKindImage (const Token *token)
 Returns the image assigned to a specific token for a symbol browser. More...
 
wxArrayString GetAllPathsByFilename (const wxString &filename)
 Get the implementation file path if the input is a header file. More...
 
ParserBaseCreateParser (cbProject *project)
 Dynamically allocate a Parser object for the input C::B project, note that while create a new Parser object, the DoFullParsing() function will be called, which collect the macro definitions, and start the batch parsing from the thread pool. More...
 
bool DeleteParser (cbProject *project)
 delete the Parser object for the input project More...
 
bool ReparseFile (cbProject *project, const wxString &filename)
 Single file re-parse. More...
 
bool AddFileToParser (cbProject *project, const wxString &filename, ParserBase *parser=nullptr)
 New file was added to the C::B project, so this will cause a re-parse on the new added file. More...
 
bool RemoveFileFromParser (cbProject *project, const wxString &filename)
 remove a file from C::B project and Parser More...
 
void RereadParserOptions ()
 when user changes the CC option, we should re-read the option More...
 
void ReparseCurrentProject ()
 re-parse the active Parser (the project associated with m_Parser member variable More...
 
void ReparseSelectedProject ()
 re-parse the project select by context menu in projects management panel More...
 
size_t MarkItemsByAI (ccSearchData *searchData, TokenIdxSet &result, bool reallyUseAI=true, bool isPrefix=true, bool caseSensitive=false, int caretPos=-1)
 collect tokens where a code suggestion list can be shown More...
 
size_t MarkItemsByAI (TokenIdxSet &result, bool reallyUseAI=true, bool isPrefix=true, bool caseSensitive=false, int caretPos=-1)
 the same as before, but we don't specify the searchData information, so it will use the active editor and current caret information. More...
 
int GetCallTips (wxArrayString &items, int &typedCommas, cbEditor *ed, int pos=wxNOT_FOUND)
 Call tips are tips when you are typing function arguments these tips information could be: the prototypes information of the current function, the type information of the variable. More...
 
wxArrayStringGetProjectSearchDirs (cbProject *project)
 project search path is used for auto completion for #include <> More...
 
ClassBrowserGetClassBrowser () const
 return active class browser pointer More...
 
void CreateClassBrowser ()
 create the class browser More...
 
void RemoveClassBrowser (bool appShutDown=false)
 remove the class browser More...
 
void UpdateClassBrowser ()
 update the class browser tree More...
 

Static Public Member Functions

static void AddPaths (wxArrayString &dirs, const wxString &path, bool hasExt)
 Add the paths to path array, and this will be used in GetAllPathsByFilename() function. More...
 

Protected Member Functions

bool DoFullParsing (cbProject *project, ParserBase *parser)
 When a Parser is created, we need a full parsing stage including: 1, parse the priority header files firstly. More...
 
bool SwitchParser (cbProject *project, ParserBase *parser)
 Switch parser object according the current active editor and filename. More...
 
void SetParser (ParserBase *parser)
 Set a new Parser as the active Parser Set the active parser pointer (m_Parser member variable) update the ClassBrowser's Parser pointer re-fresh the symbol browser tree. More...
 
void ClearParsers ()
 Clear all Parser object. More...
 
void RemoveObsoleteParsers ()
 Remove all the obsolete Parser object if the number exceeds the limited number (can be set in the CC's option), then all the obsolete parser will be removed. More...
 
std::pair< cbProject *, ParserBase * > GetParserInfoByCurrentEditor ()
 Get cbProject and Parser pointer, according to the current active editor. More...
 
void SetTokenKindImage (int kind, const wxBitmap &bitmap, const wxBitmap &mask=wxNullBitmap)
 Used to support Symbol browser and codecompletion UI Image list is used to initialize the symbol browser tree node image. More...
 
void SetTokenKindImage (int kind, const wxBitmap &bitmap, const wxColour &maskColour)
 
void SetTokenKindImage (int kind, const wxIcon &icon)
 
void SetCBViewMode (const BrowserViewMode &mode)
 set the class browser view mode More...
 

Private Types

typedef std::pair< cbProject *, ParserBase * > ProjectParserPair
 
typedef std::list< ProjectParserPairParserList
 
- Private Types inherited from NativeParserBase
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...
 

Private Member Functions

void OnProjectLoadingHook (cbProject *project, TiXmlElement *elem, bool loading)
 Read or Write project' CC options when a C::B project is loading or saving user can set those settings in Menu->Project->Properties->C/C++ parser options panel. More...
 
size_t AI (TokenIdxSet &result, ccSearchData *searchData, const wxString &lineText=wxEmptyString, bool isPrefix=false, bool caseSensitive=false, TokenIdxSet *search_scope=0, int caretPos=-1)
 Start an Artificial Intelligence search algorithm to gather all the matching tokens. More...
 
size_t FindCurrentFunctionToken (ccSearchData *searchData, TokenIdxSet &result, int caretPos=-1)
 return all the tokens matching the current function(hopefully, just one) More...
 
int FindCurrentFunctionStart (ccSearchData *searchData, wxString *nameSpace=0L, wxString *procName=0L, int *functionIndex=0L, int caretPos=-1)
 returns the position where the current function scope starts. More...
 
bool LastAISearchWasGlobal () const
 used in CodeCompletion suggestion list to boost the performance, we use a caches More...
 
const wxStringLastAIGlobalSearch () const
 The same as above. More...
 
bool ParseUsingNamespace (ccSearchData *searchData, TokenIdxSet &search_scope, int caretPos=-1)
 collect the using namespace directive in the editor specified by searchData More...
 
bool ParseBufferForUsingNamespace (const wxString &buffer, TokenIdxSet &search_scope, bool bufferSkipBlocks=true)
 collect the using namespace directive in the buffer specified by searchData More...
 
bool ParseFunctionArguments (ccSearchData *searchData, int caretPos=-1)
 collect function argument, add them to the token tree (as temporary tokens) More...
 
bool ParseLocalBlock (ccSearchData *searchData, TokenIdxSet &search_scope, int caretPos=-1)
 parses from the start of function up to the cursor, this is used to collect local variables. More...
 
bool AddCompilerDirs (cbProject *project, ParserBase *parser)
 collect the header file search directories, those dirs include: 1, project's base dir, e.g. More...
 
bool AddCompilerPredefinedMacros (cbProject *project, ParserBase *parser)
 collect compiler specific predefined preprocessor definition, this is usually run a special compiler command, like GCC -dM for gcc. More...
 
bool AddCompilerPredefinedMacrosGCC (const wxString &compilerId, cbProject *project, wxString &defs, ParserBase *parser)
 collect GCC compiler predefined preprocessor definition More...
 
wxString GetCompilerStandardGCC (Compiler *compiler, cbProject *project)
 lookup GCC compiler -std=XXX option More...
 
wxString GetCompilerUsingStandardGCC (const wxArrayString &compilerOptions)
 lookup GCC compiler -std=XXX option for specific GCC options More...
 
bool AddCompilerPredefinedMacrosVC (const wxString &compilerId, wxString &defs, ParserBase *parser)
 collect VC compiler predefined preprocessor definition More...
 
bool AddProjectDefinedMacros (cbProject *project, ParserBase *parser)
 collect project (user) defined preprocessor definition, such as for wxWidgets project, the macro may have "#define wxUSE_UNICODE" defined in its project file. More...
 
void AddCompilerIncludeDirsToParser (const Compiler *compiler, ParserBase *parser)
 Add compiler include directories (from search paths) to a parser. More...
 
const wxArrayStringGetGCCCompilerDirs (const wxString &cpp_compiler)
 Collect the default compiler include file search paths. More...
 
void AddGCCCompilerDirs (const wxString &masterPath, const wxString &compilerCpp, ParserBase *parser)
 Add the collected default GCC compiler include search paths to a parser. More...
 
void AddIncludeDirsToParser (const wxArrayString &dirs, const wxString &base, ParserBase *parser)
 Add a list of directories to the parser's search directories, normalise to "base" path, if "base" is not empty. More...
 
void OnParserStart (wxCommandEvent &event)
 Event handler when the batch parse starts, print some log information. More...
 
void OnParserEnd (wxCommandEvent &event)
 Event handler when the batch parse finishes, print some log information, check whether the active editor belong to the current parser, if not, do a parser switch. More...
 
void OnParsingOneByOneTimer (wxTimerEvent &event)
 If use one parser per whole workspace, we need parse all project one by one, E.g. More...
 
void OnEditorActivated (EditorBase *editor)
 Event handler when an editor activate, NONE project is handled here. More...
 
void OnEditorClosed (EditorBase *editor)
 Event handler when an editor closed, if it is the last editor belong to NONE project, then the NONE Parser will be removed. More...
 
void InitCCSearchVariables ()
 Init cc search member variables. More...
 
bool AddProjectToParser (cbProject *project)
 Add one project to the common parser in one parser for the whole workspace mode. More...
 
bool RemoveProjectFromParser (cbProject *project)
 Remove cbp from the common parser, this only happens in one parser for whole workspace mode when a parser is removed from the workspace, we should remove the project from the parser. More...
 
- Private Member Functions inherited from NativeParserBase
 NativeParserBase ()
 Constructor. More...
 
virtual ~NativeParserBase ()
 Destructor. More...
 
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...
 

Private Attributes

ParserList m_ParserList
 a list holing all the cbp->parser pairs, if in one parser per project mode, there are many many pairs in this list. More...
 
ParserBasem_TempParser
 a temp parser object pointer More...
 
ParserBasem_Parser
 active parser object pointer More...
 
wxTimer m_TimerParsingOneByOne
 a delay timer to parser every project in sequence More...
 
ClassBrowserm_ClassBrowser
 symbol browser window More...
 
bool m_ClassBrowserIsFloating
 if true, which means m_ClassBrowser is floating (not docked) More...
 
ProjectSearchDirsMap m_ProjectSearchDirsMap
 a map: project pointer -> C/C++ parser search paths for this project, this is the per-project code completion search-dirs. More...
 
int m_HookId
 project loader hook ID More...
 
wxImageListm_ImageList
 Images for class browser. More...
 
wxArrayString m_StandaloneFiles
 all the files which opened, but does not belong to any cbp More...
 
bool m_ParserPerWorkspace
 if true, which means the parser hold tokens of the whole workspace's project, if false then one parser per a cbp More...
 
std::set< cbProject * > m_ParsedProjects
 only used when m_ParserPerWorkspace is true, and holds all the cbps for the common parser More...
 
wxString m_LastAIGlobalSearch
 same case like above, it holds the search string More...
 
bool m_LastAISearchWasGlobal
 true if the phrase for code-completion is empty or partial text (i.e. no . -> or :: operators) More...
 
cbStyledTextCtrlm_LastControl
 
wxString m_LastFile
 
int m_LastFunctionIndex
 
int m_LastFuncTokenIdx
 saved the function token's index, for remove all local variable More...
 
int m_LastLine
 
wxString m_LastNamespace
 
wxString m_LastPROC
 
int m_LastResult
 

Friends

class CodeCompletion
 

Additional Inherited Members

- Static Private Member Functions inherited from NativeParserBase
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...
 

Detailed Description

NativeParser class is just like a manager class to control Parser objects.

Normally, Each C::B Project (cbp) will have an associated Parser object. In another mode, all C::B project belong to a C::B workspace share a single Parser object. Nativeparser will manage all the Parser objects.

Definition at line 55 of file nativeparser.h.

Member Typedef Documentation

◆ ParserList

typedef std::list<ProjectParserPair> NativeParser::ParserList
private

Definition at line 459 of file nativeparser.h.

◆ ProjectParserPair

typedef std::pair<cbProject*, ParserBase*> NativeParser::ProjectParserPair
private

Definition at line 458 of file nativeparser.h.

Constructor & Destructor Documentation

◆ NativeParser()

NativeParser::NativeParser ( )

◆ ~NativeParser()

NativeParser::~NativeParser ( )

Member Function Documentation

◆ AddCompilerDirs()

bool NativeParser::AddCompilerDirs ( cbProject project,
ParserBase parser 
)
private

collect the header file search directories, those dirs include: 1, project's base dir, e.g.

if you cbp file was c:/bbb/aaa.cbp, then c:/bbb is added. 2, project's setting search dirs, for a wx project, then c:/wxWidgets2.8.12/include is added. 3, a project may has some targets, so add search dirs for those targets 4, compiler's own search path, like: c:/mingw/include

Definition at line 1884 of file nativeparser.cpp.

References _T, AddCompilerIncludeDirsToParser(), ParserBase::AddIncludeDir(), AddIncludeDirsToParser(), CCLogger::DebugLog(), CCLogger::Get(), CompileTargetBase::GetBasePath(), cbProject::GetBuildTarget(), cbProject::GetBuildTargetsCount(), Compiler::GetCommandGenerator(), CompilerFactory::GetCompiler(), CompileTargetBase::GetCompilerID(), CompilerFactory::GetDefaultCompiler(), CompileOptionsBase::GetIncludeDirs(), ParserBase::Options(), ParserOptions::platformCheck, CompileOptionsBase::SupportsCurrentPlatform(), and TRACE.

Referenced by AddProjectToParser(), and DoFullParsing().

◆ AddCompilerIncludeDirsToParser()

void NativeParser::AddCompilerIncludeDirsToParser ( const Compiler compiler,
ParserBase parser 
)
private

◆ AddCompilerPredefinedMacros()

bool NativeParser::AddCompilerPredefinedMacros ( cbProject project,
ParserBase parser 
)
private

collect compiler specific predefined preprocessor definition, this is usually run a special compiler command, like GCC -dM for gcc.

Returns
true if there are some macro definition added, else it is false

Definition at line 1969 of file nativeparser.cpp.

References _T, AddCompilerPredefinedMacrosGCC(), AddCompilerPredefinedMacrosVC(), ParserBase::AddPredefinedMacros(), wxString::Contains(), CompileTargetBase::GetCompilerID(), CompilerFactory::GetDefaultCompilerID(), wxString::IsEmpty(), ParserBase::Options(), wxString::StartsWith(), TRACE, ParserOptions::wantPreprocessor, and wxString::wx_str().

Referenced by AddProjectToParser(), and DoFullParsing().

◆ AddCompilerPredefinedMacrosGCC()

bool NativeParser::AddCompilerPredefinedMacrosGCC ( const wxString compilerId,
cbProject project,
wxString defs,
ParserBase parser 
)
private

◆ AddCompilerPredefinedMacrosVC()

bool NativeParser::AddCompilerPredefinedMacrosVC ( const wxString compilerId,
wxString defs,
ParserBase parser 
)
private

◆ AddFileToParser()

bool NativeParser::AddFileToParser ( cbProject project,
const wxString filename,
ParserBase parser = nullptr 
)

New file was added to the C::B project, so this will cause a re-parse on the new added file.

Parameters
projectC::B project
filenamefilename with full path in the C::B project

Definition at line 664 of file nativeparser.cpp.

References _T, ParserBase::AddFile(), ParserCommon::FileType(), ParserCommon::ftOther, GetParserByProject(), TRACE, and ParserBase::UpdateParsingProject().

Referenced by AddProjectToParser(), and OnEditorActivated().

◆ AddGCCCompilerDirs()

void NativeParser::AddGCCCompilerDirs ( const wxString masterPath,
const wxString compilerCpp,
ParserBase parser 
)
private

◆ AddIncludeDirsToParser()

void NativeParser::AddIncludeDirsToParser ( const wxArrayString dirs,
const wxString base,
ParserBase parser 
)
private

Add a list of directories to the parser's search directories, normalise to "base" path, if "base" is not empty.

Replaces macros.

Definition at line 2425 of file nativeparser.cpp.

References _T, ParserBase::AddIncludeDir(), CCLogger::DebugLog(), F(), CCLogger::Get(), Manager::Get(), wxArrayString::GetCount(), wxFileName::GetFullPath(), Manager::GetMacrosManager(), wxString::IsEmpty(), NormalizePath(), MacrosManager::ReplaceMacros(), TRACE, and wxString::wx_str().

Referenced by AddCompilerDirs(), AddCompilerIncludeDirsToParser(), and DoFullParsing().

◆ AddPaths()

void NativeParser::AddPaths ( wxArrayString dirs,
const wxString path,
bool  hasExt 
)
static

Add the paths to path array, and this will be used in GetAllPathsByFilename() function.

internally, all the folder paths were recorded in UNIX format.

Parameters
dirsthe target dir collection
paththe new added path
hasExtthe file path has extensions, such as C:/aaa/bbb.cpp

Definition at line 542 of file nativeparser.cpp.

References _T, wxArrayString::Add(), wxString::BeforeLast(), wxArrayString::Index(), UnixFilename(), and wxNOT_FOUND.

Referenced by GetAllPathsByFilename().

◆ AddProjectDefinedMacros()

bool NativeParser::AddProjectDefinedMacros ( cbProject project,
ParserBase parser 
)
private

◆ AddProjectToParser()

bool NativeParser::AddProjectToParser ( cbProject project)
private

◆ AI()

size_t NativeParser::AI ( TokenIdxSet result,
ccSearchData searchData,
const wxString lineText = wxEmptyString,
bool  isPrefix = false,
bool  caseSensitive = false,
TokenIdxSet search_scope = 0,
int  caretPos = -1 
)
private

Start an Artificial Intelligence search algorithm to gather all the matching tokens.

The actual AI is in FindAIMatches() below.

Parameters
resultoutput parameter.
searchDatacbEditor information.
lineTextcurrent statement.
isPrefixif true, then the result contains all the tokens whose name is a prefix of current lineText.
caseSensitivetrue is case sensitive is enabled on the match.
search_scopeit is the "parent token" where we match the "search-key".
caretPosuse current caret position if it is -1.
Returns
matched token number

Definition at line 1321 of file nativeparser.cpp.

References _T, NativeParserBase::BreakUpComponents(), NativeParserBase::CleanupSearchScope(), wxString::Clear(), ccSearchData::control, CCLogger::DebugLog(), F(), NativeParserBase::FindCurrentFunctionScope(), FindCurrentFunctionToken(), CCLogger::Get(), wxScintilla::GetCurrentPos(), wxScintilla::GetLength(), wxScintilla::GetTextRange(), ParserBase::GetTokenTree(), wxString::IsEmpty(), wxScintilla::LineFromPosition(), m_LastAIGlobalSearch, m_LastAISearchWasGlobal, m_Parser, wxScintilla::PositionFromLine(), NativeParserBase::ResolveExpression(), s_DebugSmartSense, TRACE, wxString::Trim(), and wxString::wx_str().

Referenced by MarkItemsByAI().

◆ ClearParsers()

void NativeParser::ClearParsers ( )
protected

Clear all Parser object.

Definition at line 1161 of file nativeparser.cpp.

References _T, DeleteParser(), m_ParsedProjects, m_ParserList, m_ParserPerWorkspace, and TRACE.

Referenced by RereadParserOptions(), and ~NativeParser().

◆ CreateClassBrowser()

void NativeParser::CreateClassBrowser ( )

◆ CreateParser()

ParserBase * NativeParser::CreateParser ( cbProject project)

Dynamically allocate a Parser object for the input C::B project, note that while create a new Parser object, the DoFullParsing() function will be called, which collect the macro definitions, and start the batch parsing from the thread pool.

Parameters
projectC::B project
Returns
Parser pointer of the project.

Definition at line 554 of file nativeparser.cpp.

References _(), _T, CCLogger::DebugLog(), DoFullParsing(), F(), CCLogger::Get(), GetParserByProject(), CompileTargetBase::GetTitle(), CCLogger::Log(), m_ParsedProjects, m_Parser, m_ParserList, m_ParserPerWorkspace, m_TempParser, RemoveObsoleteParsers(), SetParser(), TRACE, and wxString::wx_str().

Referenced by OnEditorActivated(), OnParsingOneByOneTimer(), ReparseCurrentProject(), ReparseSelectedProject(), and RereadParserOptions().

◆ DeleteParser()

bool NativeParser::DeleteParser ( cbProject project)

◆ DoFullParsing()

bool NativeParser::DoFullParsing ( cbProject project,
ParserBase parser 
)
protected

◆ Done()

bool NativeParser::Done ( )

Return true if all the parser's batch-parse stages are finished, otherwise return false.

Definition at line 350 of file nativeparser.cpp.

References _T, m_ParserList, and TRACE.

◆ FindCurrentFunctionStart()

int NativeParser::FindCurrentFunctionStart ( ccSearchData searchData,
wxString nameSpace = 0L,
wxString procName = 0L,
int *  functionIndex = 0L,
int  caretPos = -1 
)
private

returns the position where the current function scope starts.

optionally, returns the function's namespace (ends in double-colon ::), name and token

Parameters
[in]searchDatasearch data struct pointer
[out]nameSpaceget the namespace modifier
[out]procNameget the function name
[out]functionTokenget the token of current function
caretPoscaret position in cbEditor
Returns
current function line number

Definition at line 1454 of file nativeparser.cpp.

References _T, TokenTree::at(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, ccSearchData::control, CCLogger::DebugLog(), Token::DisplayName(), F(), ccSearchData::file, ParserBase::FindTokensInFile(), CCLogger::Get(), wxScintilla::GetCharAt(), wxScintilla::GetCurrentPos(), wxScintilla::GetLength(), wxScintilla::GetModify(), Token::GetNamespace(), NativeParserBase::GetTokenFromCurrentLine(), ParserBase::GetTokenTree(), wxScintilla::LineFromPosition(), Token::m_ImplLine, Token::m_Index, m_LastControl, m_LastFile, m_LastFunctionIndex, m_LastLine, m_LastNamespace, m_LastPROC, m_LastResult, Token::m_Name, m_Parser, Token::m_TokenKind, wxScintilla::PositionFromLine(), s_DebugSmartSense, s_TokenTreeMutex, tkAnyFunction, tkClass, TRACE, and wxString::wx_str().

Referenced by FindCurrentFunctionToken(), and ParseLocalBlock().

◆ FindCurrentFunctionToken()

size_t NativeParser::FindCurrentFunctionToken ( ccSearchData searchData,
TokenIdxSet result,
int  caretPos = -1 
)
private

return all the tokens matching the current function(hopefully, just one)

Parameters
editoreditor pointer
resultoutput result containing all the Token index
caretPos-1 if the current caret position is used.
Returns
number of result Tokens

Definition at line 1405 of file nativeparser.cpp.

References NativeParserBase::BreakUpComponents(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, NativeParserBase::FindAIMatches(), FindCurrentFunctionStart(), NativeParserBase::GenerateResultSet(), ParserBase::GetTokenTree(), wxString::IsEmpty(), m_Parser, wxString::RemoveLast(), s_TokenTreeMutex, tkAnyFunction, tkClass, tkNamespace, and tkTypedef.

Referenced by AI(), and ParseFunctionArguments().

◆ GetAllPathsByFilename()

wxArrayString NativeParser::GetAllPathsByFilename ( const wxString filename)

Get the implementation file path if the input is a header file.

or Get the header file path if the input is an implementation file. Both the implementation file and header file can be in different directories.

Parameters
filenameinput filename
Returns
corresponding file paths, in wxArrayString format

Definition at line 465 of file nativeparser.cpp.

References _T, AddPaths(), wxFileName::AppendDir(), CCLogger::DebugLog(), wxFileName::DirExists(), F(), CCLogger::Get(), cbProject::GetCommonTopLevelPath(), wxArrayString::GetCount(), GetCurrentProject(), wxFileName::GetExt(), wxFileName::GetFullPath(), wxFileName::GetName(), wxFileName::GetPath(), GetProjectByParser(), wxFileName::HasExt(), wxArrayString::IsEmpty(), wxDir::IsOpened(), IsParserPerWorkspace(), m_Parser, wxString::StartsWith(), TRACE, wxDir::Traverse(), wxDIR_DIRS, wxDIR_FILES, wxEmptyString, and wxT.

Referenced by ClassBrowserBuilderThread::Init().

◆ GetCallTips()

int NativeParser::GetCallTips ( wxArrayString items,
int &  typedCommas,
cbEditor ed,
int  pos = wxNOT_FOUND 
)

Call tips are tips when you are typing function arguments these tips information could be: the prototypes information of the current function, the type information of the variable.

Here are the basic algorithm

if you have a function declaration like this: int fun(int a, float b, char c); when user are typing code, the caret is located here fun(arg1, arg2| ^end ^ begin we first do a backward search, should find the "fun" as the function name and later return the string "int fun(int a, float b, char c)" as the call tip typedCommas is 1, since one argument is already typed.

Parameters
[out]itemsarray to store the tip results.
typedCommashow much comma characters the user has typed in the current line before the cursor.
edthe editor
posthe location of the caret, if not supplied, the current caret is used
Returns
The location in the editor of the beginning of the argument list

Definition at line 883 of file nativeparser.cpp.

References _T, wxArrayString::Add(), wxArrayString::Clear(), NativeParserBase::ComputeCallTip(), ccSearchData::control, ParserBase::Done(), wxScintilla::GetCharAt(), cbEditor::GetControl(), wxScintilla::GetCurrentPos(), EditorBase::GetFilename(), wxScintilla::GetStyleAt(), wxScintilla::GetTextRange(), ParserBase::GetTokenTree(), cbStyledTextCtrl::IsCharacter(), cbStyledTextCtrl::IsComment(), wxString::IsEmpty(), cbStyledTextCtrl::IsString(), m_Parser, MarkItemsByAI(), wxArrayString::Sort(), TRACE, wxScintilla::WordEndPosition(), wxScintilla::WordStartPosition(), wxString::wx_str(), wxNOT_FOUND, wxSCI_INVALID_POSITION, and wxT.

◆ GetClassBrowser()

ClassBrowser* NativeParser::GetClassBrowser ( ) const
inline

return active class browser pointer

Definition at line 235 of file nativeparser.h.

References wxNullBitmap.

◆ GetCompilerStandardGCC()

wxString NativeParser::GetCompilerStandardGCC ( Compiler compiler,
cbProject project 
)
private

◆ GetCompilerUsingStandardGCC()

wxString NativeParser::GetCompilerUsingStandardGCC ( const wxArrayString compilerOptions)
private

lookup GCC compiler -std=XXX option for specific GCC options

Definition at line 2100 of file nativeparser.cpp.

References _T, CCLogger::DebugLog(), wxString::Format(), CCLogger::Get(), and wxString::wx_str().

Referenced by GetCompilerStandardGCC().

◆ GetCurrentProject()

cbProject * NativeParser::GetCurrentProject ( )

◆ GetGCCCompilerDirs()

const wxArrayString & NativeParser::GetGCCCompilerDirs ( const wxString cpp_compiler)
private

◆ GetImageList()

wxImageList* NativeParser::GetImageList ( )
inline

Used to support Symbol browser and codecompletion UI Image list is used to initialize the symbol browser tree node image.

Definition at line 113 of file nativeparser.h.

References wxNOT_FOUND.

Referenced by ClassBrowserBuilderThread::BuildTree().

◆ GetParser()

ParserBase& NativeParser::GetParser ( )
inline

◆ GetParserByFilename()

ParserBase * NativeParser::GetParserByFilename ( const wxString filename)

return the Parser pointer associated with the input file If a file belongs to several Parser objects, the first found Parser will returned.

Parameters
filenamefilename with full path.
Returns
Parser pointer

Definition at line 277 of file nativeparser.cpp.

References GetParserByProject(), and GetProjectByFilename().

◆ GetParserByProject()

ParserBase * NativeParser::GetParserByProject ( cbProject project)

return the Parser pointer corresponding to the input C::B project

Parameters
projectinput C::B project pointer
Returns
a pointer to parser object

Definition at line 256 of file nativeparser.cpp.

References _T, m_ParsedProjects, m_ParserList, m_ParserPerWorkspace, and TRACE.

Referenced by AddFileToParser(), AddProjectToParser(), CreateParser(), GetParserByFilename(), GetParserInfoByCurrentEditor(), GetProjectByFilename(), OnEditorActivated(), RemoveFileFromParser(), RemoveProjectFromParser(), ReparseFile(), and SwitchParser().

◆ GetParserInfoByCurrentEditor()

std::pair< cbProject *, ParserBase * > NativeParser::GetParserInfoByCurrentEditor ( )
protected

◆ GetProjectByEditor()

cbProject * NativeParser::GetProjectByEditor ( cbEditor editor)

return the C::B project containing the cbEditor pointer

Parameters
editorAny valid cbEditor pointer
Returns
project pointer

Definition at line 331 of file nativeparser.cpp.

References EditorBase::GetFilename(), ProjectFile::GetParentProject(), GetProjectByFilename(), and cbEditor::GetProjectFile().

Referenced by CodeRefactoring::DoRenameSymbols(), GetCurrentProject(), GetParserInfoByCurrentEditor(), OnEditorActivated(), and CodeRefactoring::Parse().

◆ GetProjectByFilename()

cbProject * NativeParser::GetProjectByFilename ( const wxString filename)

return the C::B project containing the filename The function first try to match the filename in the active project, next to match other projects opened, If the file exists in several projects, the first matched project will be returned.

Parameters
filenameinput filename
Returns
project pointer containing the file

Definition at line 295 of file nativeparser.cpp.

References _T, Manager::Get(), ProjectManager::GetActiveProject(), cbProject::GetFileByFilename(), GetParserByProject(), Manager::GetProjectManager(), ProjectManager::GetProjects(), ParserBase::IsFileParsed(), TRACE, and wxString::wx_str().

Referenced by GetParserByFilename(), and GetProjectByEditor().

◆ GetProjectByParser()

cbProject * NativeParser::GetProjectByParser ( ParserBase parser)

return the C::B project associated with Parser pointer

Parameters
parserParser pointer
Returns
C::B Project pointer

Definition at line 283 of file nativeparser.cpp.

References _T, m_ParserList, NULL, and TRACE.

Referenced by GetAllPathsByFilename(), ClassBrowser::OnJumpTo(), ClassBrowser::OnTreeItemDoubleClick(), and ClassBrowser::UpdateClassBrowserView().

◆ GetProjectSearchDirs()

wxArrayString & NativeParser::GetProjectSearchDirs ( cbProject project)

project search path is used for auto completion for #include <>

Definition at line 958 of file nativeparser.cpp.

References m_ProjectSearchDirsMap.

Referenced by DoFullParsing(), CCOptionsProjectDlg::OnApply(), and OnProjectLoadingHook().

◆ GetTokenKindImage()

int NativeParser::GetTokenKindImage ( const Token token)

◆ InitCCSearchVariables()

void NativeParser::InitCCSearchVariables ( )
private

Init cc search member variables.

Definition at line 2692 of file nativeparser.cpp.

References wxString::Clear(), m_LastControl, m_LastFile, m_LastFunctionIndex, m_LastLine, m_LastNamespace, m_LastPROC, m_LastResult, and NativeParserBase::Reset().

Referenced by SetParser().

◆ IsParserPerWorkspace()

bool NativeParser::IsParserPerWorkspace ( ) const
inline

◆ LastAIGlobalSearch()

const wxString& NativeParser::LastAIGlobalSearch ( ) const
inlineprivate

◆ LastAISearchWasGlobal()

bool NativeParser::LastAISearchWasGlobal ( ) const
inlineprivate

used in CodeCompletion suggestion list to boost the performance, we use a caches

Definition at line 340 of file nativeparser.h.

◆ MarkItemsByAI() [1/2]

size_t NativeParser::MarkItemsByAI ( ccSearchData searchData,
TokenIdxSet result,
bool  reallyUseAI = true,
bool  isPrefix = true,
bool  caseSensitive = false,
int  caretPos = -1 
)

collect tokens where a code suggestion list can be shown

Parameters
[in]searchDatasearch location, the place where the caret locates
[out]resultcontaining all matching result token indexes
reallyUseAItrue means the context scope information should be considered, false if only do a plain word match
isPrefixpartially match which result all the Tokens' name with the same prefix, otherwise use full-text match
caseSensitivecase sensitive or not
caretPosWhere the current caret locates, -1 means we use the current caret position.
Returns
the matching Token count

Definition at line 802 of file nativeparser.cpp.

References _(), _T, AI(), CC_LOCKER_TRACK_TT_MTX_LOCK, CC_LOCKER_TRACK_TT_MTX_UNLOCK, TokenTree::Clear(), CCLogger::DebugLog(), ParserBase::Done(), CCLogger::Get(), ParserBase::GetTempTokenTree(), ParserBase::GetTokenTree(), m_LastFuncTokenIdx, m_Parser, ParserBase::NotDoneReason(), ParseFunctionArguments(), ParseLocalBlock(), ParseUsingNamespace(), NativeParserBase::RemoveLastFunctionChildren(), s_TokenTreeMutex, TokenTree::size(), TRACE, and wxEmptyString.

Referenced by GetCallTips(), MarkItemsByAI(), CodeRefactoring::Parse(), and CodeRefactoring::VerifyResult().

◆ MarkItemsByAI() [2/2]

size_t NativeParser::MarkItemsByAI ( TokenIdxSet result,
bool  reallyUseAI = true,
bool  isPrefix = true,
bool  caseSensitive = false,
int  caretPos = -1 
)

the same as before, but we don't specify the searchData information, so it will use the active editor and current caret information.

Definition at line 861 of file nativeparser.cpp.

References _T, ccSearchData::control, CCLogger::DebugLog(), F(), CCLogger::Get(), Manager::Get(), EditorManager::GetBuiltinActiveEditor(), cbEditor::GetControl(), Manager::GetEditorManager(), EditorBase::GetFilename(), MarkItemsByAI(), s_DebugSmartSense, and TRACE.

◆ OnEditorActivated()

void NativeParser::OnEditorActivated ( EditorBase editor)
private

◆ OnEditorClosed()

void NativeParser::OnEditorClosed ( EditorBase editor)
private

Event handler when an editor closed, if it is the last editor belong to NONE project, then the NONE Parser will be removed.

Definition at line 2677 of file nativeparser.cpp.

References DeleteParser(), EditorBase::GetFilename(), wxArrayString::Index(), wxArrayString::IsEmpty(), m_StandaloneFiles, NULL, wxArrayString::RemoveAt(), RemoveFileFromParser(), and wxNOT_FOUND.

◆ OnParserEnd()

void NativeParser::OnParserEnd ( wxCommandEvent event)
private

Event handler when the batch parse finishes, print some log information, check whether the active editor belong to the current parser, if not, do a parser switch.

Definition at line 2493 of file nativeparser.cpp.

References _(), _T, CCLogger::DebugLog(), F(), CCLogger::Get(), GetParserInfoByCurrentEditor(), CompileTargetBase::GetTitle(), CCLogger::Log(), m_Parser, m_TimerParsingOneByOne, ParserCommon::ptAddFileToParser, ParserCommon::ptCreateParser, ParserCommon::ptReparseFile, ParserCommon::ptUndefined, wxTimer::Start(), SwitchParser(), TRACE, UpdateClassBrowser(), wxString::wx_str(), and wxTIMER_ONE_SHOT.

Referenced by NativeParser(), and ~NativeParser().

◆ OnParserStart()

void NativeParser::OnParserStart ( wxCommandEvent event)
private

◆ OnParsingOneByOneTimer()

void NativeParser::OnParsingOneByOneTimer ( wxTimerEvent event)
private

If use one parser per whole workspace, we need parse all project one by one, E.g.

If a workspace contains A.cbp, B.cbp and C.cbp, and we are in the mode of one parser for the whole workspace, we first parse A.cbp, after that we should continue to parse B.cbp. When finishing parsing B.cbp, we need the timer again to parse the C.cbp. If we are in the mode of one parser for one project, then after parsing A.cbp, the timer is kicked, so there is a chance to parse the B.cbp or C.cbp, but only when user opened some file of B.cbp or C.cbp when the timer event arrived.

Definition at line 2550 of file nativeparser.cpp.

References _T, AddProjectToParser(), CreateParser(), CCLogger::DebugLog(), CCLogger::Get(), Manager::Get(), ProjectManager::GetActiveProject(), EditorManager::GetBuiltinActiveEditor(), Manager::GetEditorManager(), GetParserInfoByCurrentEditor(), Manager::GetProjectManager(), ProjectManager::GetProjects(), CCLogger::Log(), m_ParsedProjects, m_Parser, m_ParserPerWorkspace, SwitchParser(), and TRACE.

Referenced by NativeParser(), and ~NativeParser().

◆ OnProjectLoadingHook()

void NativeParser::OnProjectLoadingHook ( cbProject project,
TiXmlElement *  elem,
bool  loading 
)
private

Read or Write project' CC options when a C::B project is loading or saving user can set those settings in Menu->Project->Properties->C/C++ parser options panel.

Parameters
projectwhich project we are handling
elemparent node of the project xml file (cbp) containing addtinal information
loadingtrue if the project is loading

Definition at line 1268 of file nativeparser.cpp.

References wxArrayString::Add(), cbC2U(), cbU2C(), wxArrayString::GetCount(), GetProjectSearchDirs(), wxArrayString::Index(), and wxNOT_FOUND.

Referenced by NativeParser().

◆ ParseBufferForUsingNamespace()

bool NativeParser::ParseBufferForUsingNamespace ( const wxString buffer,
TokenIdxSet search_scope,
bool  bufferSkipBlocks = true 
)
private

◆ ParseFunctionArguments()

bool NativeParser::ParseFunctionArguments ( ccSearchData searchData,
int  caretPos = -1 
)
private

◆ ParseLocalBlock()

bool NativeParser::ParseLocalBlock ( ccSearchData searchData,
TokenIdxSet search_scope,
int  caretPos = -1 
)
private

◆ ParseUsingNamespace()

bool NativeParser::ParseUsingNamespace ( ccSearchData searchData,
TokenIdxSet search_scope,
int  caretPos = -1 
)
private

collect the using namespace directive in the editor specified by searchData

Parameters
searchDatasearch location
search_scoperesulting tokens collection
caretPoscaret position, if not specified, we use the current caret position

Definition at line 1563 of file nativeparser.cpp.

References _T, ccSearchData::control, CCLogger::DebugLog(), CCLogger::Get(), wxScintilla::GetCurrentPos(), wxScintilla::GetLength(), wxScintilla::GetTextRange(), ParseBufferForUsingNamespace(), s_DebugSmartSense, and TRACE.

Referenced by MarkItemsByAI().

◆ RemoveClassBrowser()

void NativeParser::RemoveClassBrowser ( bool  appShutDown = false)

◆ RemoveFileFromParser()

bool NativeParser::RemoveFileFromParser ( cbProject project,
const wxString filename 
)

remove a file from C::B project and Parser

Parameters
projectC::B project
filenamefilename with full patch in the C::B project

Definition at line 684 of file nativeparser.cpp.

References _T, GetParserByProject(), ParserBase::RemoveFile(), and TRACE.

Referenced by OnEditorActivated(), OnEditorClosed(), and RemoveProjectFromParser().

◆ RemoveObsoleteParsers()

void NativeParser::RemoveObsoleteParsers ( )
protected

Remove all the obsolete Parser object if the number exceeds the limited number (can be set in the CC's option), then all the obsolete parser will be removed.

Definition at line 1177 of file nativeparser.cpp.

References _(), _T, wxArrayString::Add(), CCLogger::DebugLog(), DeleteParser(), F(), CCLogger::Get(), Manager::Get(), Manager::GetConfigManager(), wxArrayString::GetCount(), GetParserInfoByCurrentEditor(), CCLogger::Log(), m_ParserList, ConfigManager::ReadInt(), and TRACE.

Referenced by CreateParser(), and RereadParserOptions().

◆ RemoveProjectFromParser()

bool NativeParser::RemoveProjectFromParser ( cbProject project)
private

Remove cbp from the common parser, this only happens in one parser for whole workspace mode when a parser is removed from the workspace, we should remove the project from the parser.

Definition at line 2791 of file nativeparser.cpp.

References _(), _T, CCLogger::DebugLog(), F(), ProjectFile::file, ParserCommon::FileType(), ParserCommon::ftOther, CCLogger::Get(), cbProject::GetFilesList(), wxFileName::GetFullPath(), GetParserByProject(), CompileTargetBase::GetTitle(), CCLogger::Log(), m_ParsedProjects, ProjectFile::relativeFilename, RemoveFileFromParser(), and wxString::wx_str().

Referenced by DeleteParser().

◆ ReparseCurrentProject()

void NativeParser::ReparseCurrentProject ( )

re-parse the active Parser (the project associated with m_Parser member variable

Definition at line 762 of file nativeparser.cpp.

References _T, CreateParser(), DeleteParser(), GetCurrentProject(), and TRACE.

Referenced by ClassBrowser::OnForceReparse().

◆ ReparseFile()

bool NativeParser::ReparseFile ( cbProject project,
const wxString filename 
)

Single file re-parse.

This was happening when you add a single file to project, or a file was modified. the main logic of this function call is: 1, once this function is called, the file will be marked as "need to be reparsed" in the token tree, and a timer(reparse timer) is started. 2, on reparse timer hit, we collect all the files marked as "need to be reparsed" from the token tree, remove them from the token tree, and call AddParse() to add parsing job, this will ticket the On batch timer 3, when on batch timer hit, it see there are some parsing jobs to do (m_BatchParseFiles is not empty), then it will run a thread job ParserThreadedTask 4, Once the ParserThreadedTask is running, it will create all the Parserthreads and run them in the thread pool

Parameters
projectC::B project
filenamefilename with full path in the C::B project

Definition at line 647 of file nativeparser.cpp.

References _T, ParserCommon::FileType(), ParserCommon::ftOther, GetParserByProject(), ParserBase::Reparse(), TRACE, and ParserBase::UpdateParsingProject().

◆ ReparseSelectedProject()

void NativeParser::ReparseSelectedProject ( )

◆ RereadParserOptions()

void NativeParser::RereadParserOptions ( )

◆ SetCBViewMode()

void NativeParser::SetCBViewMode ( const BrowserViewMode mode)
protected

set the class browser view mode

Definition at line 1262 of file nativeparser.cpp.

References bvmInheritance, ParserBase::ClassBrowserOptions(), m_Parser, BrowserOptions::showInheritance, and UpdateClassBrowser().

◆ SetParser()

void NativeParser::SetParser ( ParserBase parser)
protected

Set a new Parser as the active Parser Set the active parser pointer (m_Parser member variable) update the ClassBrowser's Parser pointer re-fresh the symbol browser tree.

if we did switch the parser, we also need to remove the temporary tokens of the old parser.

Definition at line 1140 of file nativeparser.cpp.

References ParserBase::GetTokenTree(), InitCCSearchVariables(), m_ClassBrowser, m_LastFuncTokenIdx, m_Parser, NativeParserBase::RemoveLastFunctionChildren(), and ClassBrowser::SetParser().

Referenced by CreateParser(), DeleteParser(), and SwitchParser().

◆ SetTokenKindImage() [1/3]

void NativeParser::SetTokenKindImage ( int  kind,
const wxBitmap bitmap,
const wxBitmap mask = wxNullBitmap 
)
protected

Used to support Symbol browser and codecompletion UI Image list is used to initialize the symbol browser tree node image.

Definition at line 1235 of file nativeparser.cpp.

References m_ImageList, PARSER_IMG_MAX, and wxImageList::Replace().

◆ SetTokenKindImage() [2/3]

void NativeParser::SetTokenKindImage ( int  kind,
const wxBitmap bitmap,
const wxColour maskColour 
)
protected

◆ SetTokenKindImage() [3/3]

void NativeParser::SetTokenKindImage ( int  kind,
const wxIcon icon 
)
protected

Definition at line 1255 of file nativeparser.cpp.

References m_ImageList, PARSER_IMG_MAX, and wxImageList::Replace().

◆ SwitchParser()

bool NativeParser::SwitchParser ( cbProject project,
ParserBase parser 
)
protected

Switch parser object according the current active editor and filename.

Definition at line 1120 of file nativeparser.cpp.

References _(), _T, CCLogger::DebugLog(), F(), CCLogger::Get(), GetParserByProject(), CompileTargetBase::GetTitle(), CCLogger::Log(), m_Parser, SetParser(), TRACE, and wxString::wx_str().

Referenced by OnEditorActivated(), OnParserEnd(), OnParserStart(), and OnParsingOneByOneTimer().

◆ UpdateClassBrowser()

void NativeParser::UpdateClassBrowser ( )

Friends And Related Function Documentation

◆ CodeCompletion

friend class CodeCompletion
friend

Definition at line 287 of file nativeparser.h.

Member Data Documentation

◆ m_ClassBrowser

ClassBrowser* NativeParser::m_ClassBrowser
private

◆ m_ClassBrowserIsFloating

bool NativeParser::m_ClassBrowserIsFloating
private

if true, which means m_ClassBrowser is floating (not docked)

Definition at line 476 of file nativeparser.h.

Referenced by CreateClassBrowser(), RemoveClassBrowser(), and RereadParserOptions().

◆ m_HookId

int NativeParser::m_HookId
private

project loader hook ID

Definition at line 482 of file nativeparser.h.

Referenced by NativeParser(), and ~NativeParser().

◆ m_ImageList

wxImageList* NativeParser::m_ImageList
private

Images for class browser.

Definition at line 483 of file nativeparser.h.

Referenced by NativeParser(), SetTokenKindImage(), and ~NativeParser().

◆ m_LastAIGlobalSearch

wxString NativeParser::m_LastAIGlobalSearch
private

same case like above, it holds the search string

Definition at line 495 of file nativeparser.h.

Referenced by AI().

◆ m_LastAISearchWasGlobal

bool NativeParser::m_LastAISearchWasGlobal
private

true if the phrase for code-completion is empty or partial text (i.e. no . -> or :: operators)

Definition at line 496 of file nativeparser.h.

Referenced by AI().

◆ m_LastControl

cbStyledTextCtrl* NativeParser::m_LastControl
private

Definition at line 497 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastFile

wxString NativeParser::m_LastFile
private

Definition at line 498 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastFunctionIndex

int NativeParser::m_LastFunctionIndex
private

Definition at line 499 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastFuncTokenIdx

int NativeParser::m_LastFuncTokenIdx
private

saved the function token's index, for remove all local variable

Definition at line 500 of file nativeparser.h.

Referenced by MarkItemsByAI(), ParseLocalBlock(), and SetParser().

◆ m_LastLine

int NativeParser::m_LastLine
private

Definition at line 501 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastNamespace

wxString NativeParser::m_LastNamespace
private

Definition at line 502 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastPROC

wxString NativeParser::m_LastPROC
private

Definition at line 503 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_LastResult

int NativeParser::m_LastResult
private

Definition at line 504 of file nativeparser.h.

Referenced by FindCurrentFunctionStart(), and InitCCSearchVariables().

◆ m_ParsedProjects

std::set<cbProject*> NativeParser::m_ParsedProjects
private

only used when m_ParserPerWorkspace is true, and holds all the cbps for the common parser

Definition at line 492 of file nativeparser.h.

Referenced by AddProjectToParser(), ClearParsers(), CreateParser(), DeleteParser(), GetParserByProject(), OnParsingOneByOneTimer(), and RemoveProjectFromParser().

◆ m_Parser

ParserBase* NativeParser::m_Parser
private

◆ m_ParserList

ParserList NativeParser::m_ParserList
private

a list holing all the cbp->parser pairs, if in one parser per project mode, there are many many pairs in this list.

In one parser per workspace mode, there is only one pair, and the m_ParserList.begin()->second is the common parser for all the projects in workspace.

Definition at line 465 of file nativeparser.h.

Referenced by ClearParsers(), CreateParser(), DeleteParser(), Done(), GetParserByProject(), GetProjectByParser(), and RemoveObsoleteParsers().

◆ m_ParserPerWorkspace

bool NativeParser::m_ParserPerWorkspace
private

if true, which means the parser hold tokens of the whole workspace's project, if false then one parser per a cbp

Definition at line 490 of file nativeparser.h.

Referenced by ClearParsers(), CreateParser(), DeleteParser(), GetParserByProject(), NativeParser(), OnEditorActivated(), OnParsingOneByOneTimer(), and RereadParserOptions().

◆ m_ProjectSearchDirsMap

ProjectSearchDirsMap NativeParser::m_ProjectSearchDirsMap
private

a map: project pointer -> C/C++ parser search paths for this project, this is the per-project code completion search-dirs.

Definition at line 481 of file nativeparser.h.

Referenced by GetProjectSearchDirs().

◆ m_StandaloneFiles

wxArrayString NativeParser::m_StandaloneFiles
private

all the files which opened, but does not belong to any cbp

Definition at line 486 of file nativeparser.h.

Referenced by AddProjectToParser(), OnEditorActivated(), and OnEditorClosed().

◆ m_TempParser

ParserBase* NativeParser::m_TempParser
private

a temp parser object pointer

Definition at line 467 of file nativeparser.h.

Referenced by CreateParser(), DeleteParser(), NativeParser(), OnEditorActivated(), RereadParserOptions(), UpdateClassBrowser(), and ~NativeParser().

◆ m_TimerParsingOneByOne

wxTimer NativeParser::m_TimerParsingOneByOne
private

a delay timer to parser every project in sequence

Definition at line 472 of file nativeparser.h.

Referenced by OnParserEnd().


The documentation for this class was generated from the following files: