work save
This commit is contained in:
parent
8a2d40f6d7
commit
2e54b4460d
|
@ -338,7 +338,6 @@ PStatement CppParser::findStatementOf(const QString &fileName, const QString &ph
|
|||
if (!statement)
|
||||
return PStatement();
|
||||
}
|
||||
qDebug()<<"-----";
|
||||
PStatement lastScopeStatement;
|
||||
QString typeName;
|
||||
PStatement typeStatement;
|
||||
|
@ -404,6 +403,18 @@ PStatement CppParser::findStatementOf(const QString &fileName, const QString &ph
|
|||
return statement;
|
||||
}
|
||||
|
||||
PStatement CppParser::findStatement(
|
||||
const QString &fileName,
|
||||
const QStringList &phraseExpression,
|
||||
const PStatement ¤tScope)
|
||||
{
|
||||
QMutexLocker locker(&mMutex);
|
||||
if (mParsing)
|
||||
return PStatement();
|
||||
int pos = 0;
|
||||
return doFindStatement(fileName,phraseExpression,pos,currentScope,PStatement());
|
||||
}
|
||||
|
||||
PStatement CppParser::findStatementOf(const QString &fileName, const QString &phrase, const PStatement& currentClass, bool force)
|
||||
{
|
||||
PStatement statementParentType;
|
||||
|
@ -3345,6 +3356,66 @@ PStatement CppParser::findStatementInNamespace(const QString &name, const QStrin
|
|||
return PStatement();
|
||||
}
|
||||
|
||||
PStatement CppParser::doParseSubExpression3(const QString &fileName,
|
||||
const QStringList &phraseExpression,
|
||||
int &pos,
|
||||
const PStatement ¤tScope,
|
||||
const PStatement &ownerStatement)
|
||||
{
|
||||
if (pos>=phraseExpression.length())
|
||||
return PStatement();
|
||||
if (phraseExpression[pos]=="*") {
|
||||
pos++;
|
||||
return doParseSubExpression3(fileName,
|
||||
phraseExpression,
|
||||
pos,
|
||||
currentScope,
|
||||
ownerStatement);
|
||||
} else if (phraseExpression[pos]=="&") {
|
||||
pos++;
|
||||
return doParseSubExpression3(fileName,
|
||||
phraseExpression,
|
||||
pos,
|
||||
currentScope,
|
||||
ownerStatement);
|
||||
}
|
||||
return doParseSubExpression2(fileName,
|
||||
phraseExpression,
|
||||
pos,
|
||||
currentScope,
|
||||
ownerStatement);
|
||||
}
|
||||
|
||||
PStatement CppParser::doFindStatement(const QString &fileName,
|
||||
const QStringList &phraseExpression,
|
||||
int& pos,
|
||||
const PStatement ¤tScope,
|
||||
const PStatement &ownerStatement)
|
||||
{
|
||||
if (pos>=phraseExpression.length())
|
||||
return PStatement();
|
||||
//find the start scope statement
|
||||
PStatement currentStatement = doParseSubExpression3(fileName,phraseExpression,pos,currentScope, ownerStatement);
|
||||
while (pos < phraseExpression.length() ) {
|
||||
if (currentStatement &&
|
||||
(currentStatement->kind == StatementKind::skVariable
|
||||
|| currentStatement->kind == StatementKind::skFunction)
|
||||
&& (phraseExpression[pos]==".*"
|
||||
|| phraseExpression[pos]=="->*")) {
|
||||
pos++; // skip '::';
|
||||
PStatement currentStatementScope = findTypeDefinitionOf(
|
||||
fileName,
|
||||
currentStatement->type,
|
||||
currentStatement->parentScope.lock());
|
||||
currentStatement = doParseSubExpression3(fileName,phraseExpression,pos,currentScope, currentStatementScope);
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return currentStatement;
|
||||
}
|
||||
|
||||
int CppParser::getBracketEnd(const QString &s, int startAt)
|
||||
{
|
||||
int i = startAt;
|
||||
|
|
|
@ -49,6 +49,9 @@ public:
|
|||
const QString& phrase,
|
||||
const PStatement& currentClass,
|
||||
bool force = false);
|
||||
PStatement findStatement(const QString& fileName,
|
||||
const QStringList& phraseExpression,
|
||||
const PStatement& currentScope);
|
||||
//{Find statement starting from startScope}
|
||||
PStatement findStatementStartingFrom(const QString& fileName,
|
||||
const QString& phrase,
|
||||
|
@ -198,6 +201,18 @@ private:
|
|||
PStatement findStatementInNamespace(
|
||||
const QString& name,
|
||||
const QString& namespaceName);
|
||||
|
||||
PStatement doParseSubExpression3(
|
||||
const QString& fileName,
|
||||
const QStringList& phraseExpression,
|
||||
int &pos,
|
||||
const PStatement& currentScope,
|
||||
const PStatement& ownerStatement);
|
||||
PStatement doFindStatement(const QString& fileName,
|
||||
const QStringList& phraseExpression,
|
||||
int &pos,
|
||||
const PStatement& currentScope,
|
||||
const PStatement& ownerStatement);
|
||||
int getBracketEnd(const QString& s, int startAt);
|
||||
StatementClassScope getClassScope(int index);
|
||||
int getCurrentBlockBeginSkip();
|
||||
|
@ -311,6 +326,8 @@ private:
|
|||
bool isTypeStatement(StatementKind kind);
|
||||
|
||||
void updateSerialId();
|
||||
|
||||
|
||||
private:
|
||||
int mParserId;
|
||||
int mSerialCount;
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
const QStringList& memberExpression,
|
||||
const QString& filename,
|
||||
int line);
|
||||
bool search(const QString& phrase, bool autoHideOnSingleResult);
|
||||
bool search(const QString& memberPhrase, bool autoHideOnSingleResult);
|
||||
|
||||
PStatement selectedStatement();
|
||||
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
const QStringList& memberExpression,
|
||||
const QString& fileName,
|
||||
int line);
|
||||
void getFullCompletionListFor(const QString& preWord);
|
||||
void getCompletionListForPreWord(const QString& preWord);
|
||||
void addKeyword(const QString& keyword);
|
||||
bool isIncluded(const QString& fileName);
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue