work save
This commit is contained in:
parent
ca59fd7d70
commit
7c7242c1a3
|
@ -1401,24 +1401,27 @@ bool CppParser::isCurrentScope(const QString &command)
|
||||||
return (statement->command == s);
|
return (statement->command == s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldResetBlock)
|
void CppParser::addSoloScopeLevel(PStatement& statement, int line)
|
||||||
{
|
{
|
||||||
// Add class list
|
// Add class list
|
||||||
|
|
||||||
PStatement parentScope;
|
// PStatement parentScope;
|
||||||
if (shouldResetBlock && statement && (statement->kind == StatementKind::skBlock)) {
|
// if (shouldResetBlock && statement && (statement->kind == StatementKind::skBlock)) {
|
||||||
parentScope = statement->parentScope.lock();
|
// parentScope = statement->parentScope.lock();
|
||||||
while (parentScope && (parentScope->kind == StatementKind::skBlock)) {
|
// while (parentScope && (parentScope->kind == StatementKind::skBlock)) {
|
||||||
parentScope = parentScope->parentScope.lock();
|
// parentScope = parentScope->parentScope.lock();
|
||||||
}
|
// }
|
||||||
if (!parentScope)
|
// if (!parentScope)
|
||||||
statement.reset();
|
// statement.reset();
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (mCurrentClassScope.count()>0) {
|
if (mCurrentClassScope.count()>0) {
|
||||||
mCurrentClassScope.back() = mClassScope;
|
mCurrentClassScope.back() = mClassScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!statement) {
|
||||||
|
qDebug()<<"lol";
|
||||||
|
}
|
||||||
mCurrentScope.append(statement);
|
mCurrentScope.append(statement);
|
||||||
|
|
||||||
PFileIncludes fileIncludes = mPreprocessor.includesList().value(mCurrentFile);
|
PFileIncludes fileIncludes = mPreprocessor.includesList().value(mCurrentFile);
|
||||||
|
@ -1968,7 +1971,7 @@ void CppParser::handleCatchBlock()
|
||||||
mClassScope,
|
mClassScope,
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
addSoloScopeLevel(block,startLine,false);
|
addSoloScopeLevel(block,startLine);
|
||||||
if (!mTokenizer[mIndex+1]->text.contains("..."))
|
if (!mTokenizer[mIndex+1]->text.contains("..."))
|
||||||
scanMethodArgs(block,mIndex, mTokenizer[mIndex]->matchIndex);
|
scanMethodArgs(block,mIndex, mTokenizer[mIndex]->matchIndex);
|
||||||
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
||||||
|
@ -1987,7 +1990,6 @@ void CppParser::handleEnum(bool isTypedef)
|
||||||
mIndex++; //skip class
|
mIndex++; //skip class
|
||||||
|
|
||||||
}
|
}
|
||||||
bool isNameAfterBraces=false;
|
|
||||||
bool isAdhocVar=false;
|
bool isAdhocVar=false;
|
||||||
int endIndex=-1;
|
int endIndex=-1;
|
||||||
if ((mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text.startsWith('{')) { // enum {...} NAME
|
if ((mIndex< mTokenizer.tokenCount()) && mTokenizer[mIndex]->text.startsWith('{')) { // enum {...} NAME
|
||||||
|
@ -2013,7 +2015,6 @@ void CppParser::handleEnum(bool isTypedef)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
endIndex=i+1;
|
endIndex=i+1;
|
||||||
isNameAfterBraces=true;
|
|
||||||
} else if (mIndex+1< mTokenizer.tokenCount() && mTokenizer[mIndex+1]->text.startsWith('{')){ // enum NAME {...};
|
} else if (mIndex+1< mTokenizer.tokenCount() && mTokenizer[mIndex+1]->text.startsWith('{')){ // enum NAME {...};
|
||||||
enumName = mTokenizer[mIndex]->text;
|
enumName = mTokenizer[mIndex]->text;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2520,7 +2521,11 @@ void CppParser::handleOtherTypedefs()
|
||||||
}
|
}
|
||||||
QString newType;
|
QString newType;
|
||||||
while(mIndex+1<mTokenizer.tokenCount()) {
|
while(mIndex+1<mTokenizer.tokenCount()) {
|
||||||
if (mTokenizer[mIndex]->text == '(') {
|
if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text == ',' ) {
|
||||||
|
mIndex++;
|
||||||
|
} else if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text == ';' ) {
|
||||||
|
break;
|
||||||
|
} else if (mTokenizer[mIndex]->text == '(') {
|
||||||
int paramStart=mTokenizer[mIndex]->matchIndex+1;
|
int paramStart=mTokenizer[mIndex]->matchIndex+1;
|
||||||
QString newType = mTokenizer[mIndex+1]->text;
|
QString newType = mTokenizer[mIndex+1]->text;
|
||||||
if (paramStart>=mTokenizer.tokenCount()
|
if (paramStart>=mTokenizer.tokenCount()
|
||||||
|
@ -2571,10 +2576,6 @@ void CppParser::handleOtherTypedefs()
|
||||||
false);
|
false);
|
||||||
newType = "";
|
newType = "";
|
||||||
mIndex++;
|
mIndex++;
|
||||||
} else if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text == ',' ) {
|
|
||||||
mIndex++;
|
|
||||||
} else if (mIndex < mTokenizer.tokenCount() && mTokenizer[mIndex]->text == ';' ) {
|
|
||||||
break;
|
|
||||||
} else {
|
} else {
|
||||||
newType += mTokenizer[mIndex]->text;
|
newType += mTokenizer[mIndex]->text;
|
||||||
mIndex++;
|
mIndex++;
|
||||||
|
@ -2681,7 +2682,6 @@ bool CppParser::handleStatement()
|
||||||
int idx2=getCurrentBlockBeginSkip();
|
int idx2=getCurrentBlockBeginSkip();
|
||||||
int idx3=getCurrentInlineNamespaceEndSkip();
|
int idx3=getCurrentInlineNamespaceEndSkip();
|
||||||
KeywordType keywordType;
|
KeywordType keywordType;
|
||||||
bool isFunctionPointer;
|
|
||||||
if (mIndex >= idx2) {
|
if (mIndex >= idx2) {
|
||||||
//skip (previous handled) block begin
|
//skip (previous handled) block begin
|
||||||
mBlockBeginSkips.pop_back();
|
mBlockBeginSkips.pop_back();
|
||||||
|
@ -2842,8 +2842,12 @@ void CppParser::handleStructs(bool isTypedef)
|
||||||
PStatement firstSynonym;
|
PStatement firstSynonym;
|
||||||
// Add class/struct name BEFORE opening brace
|
// Add class/struct name BEFORE opening brace
|
||||||
if (mTokenizer[mIndex]->text.front() != '{') {
|
if (mTokenizer[mIndex]->text.front() != '{') {
|
||||||
while(true) {
|
while(mIndex < mTokenizer.tokenCount()) {
|
||||||
if ((mIndex + 1 < mTokenizer.tokenCount())
|
if (mTokenizer[mIndex]->text.front() == ':'
|
||||||
|
|| mTokenizer[mIndex]->text.front() == '{'
|
||||||
|
|| mTokenizer[mIndex]->text.front() == ';') {
|
||||||
|
break;
|
||||||
|
} else if ((mIndex + 1 < mTokenizer.tokenCount())
|
||||||
&& (mTokenizer[mIndex + 1]->text.front() == ','
|
&& (mTokenizer[mIndex + 1]->text.front() == ','
|
||||||
|| mTokenizer[mIndex + 1]->text.front() == ';'
|
|| mTokenizer[mIndex + 1]->text.front() == ';'
|
||||||
|| mTokenizer[mIndex + 1]->text.front() == '{'
|
|| mTokenizer[mIndex + 1]->text.front() == '{'
|
||||||
|
@ -2893,12 +2897,6 @@ void CppParser::handleStructs(bool isTypedef)
|
||||||
mIndex+=2;
|
mIndex+=2;
|
||||||
} else
|
} else
|
||||||
mIndex++;
|
mIndex++;
|
||||||
if (mIndex >= mTokenizer.tokenCount())
|
|
||||||
break;
|
|
||||||
if (mTokenizer[mIndex]->text.front() == ':'
|
|
||||||
|| mTokenizer[mIndex]->text.front() == '{'
|
|
||||||
|| mTokenizer[mIndex]->text.front() == ';')
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3141,11 +3139,11 @@ bool CppParser::tryHandleVar()
|
||||||
//failed to handle
|
//failed to handle
|
||||||
return false;
|
return false;
|
||||||
if (varType=="extern") {
|
if (varType=="extern") {
|
||||||
lastType=varType;
|
|
||||||
isExtern=true;
|
isExtern=true;
|
||||||
} else if (varType=="static") {
|
} else if (varType=="static") {
|
||||||
lastType=varType;
|
|
||||||
isStatic=true;
|
isStatic=true;
|
||||||
|
} else {
|
||||||
|
lastType=varType;
|
||||||
}
|
}
|
||||||
mIndex++;
|
mIndex++;
|
||||||
|
|
||||||
|
@ -3175,8 +3173,7 @@ bool CppParser::tryHandleVar()
|
||||||
|| mTokenizer[mIndex + 1]->text=='{') {
|
|| mTokenizer[mIndex + 1]->text=='{') {
|
||||||
//end of type info
|
//end of type info
|
||||||
break;
|
break;
|
||||||
}
|
} else if (mTokenizer[mIndex]->text!="struct"
|
||||||
if (mTokenizer[mIndex]->text!="struct"
|
|
||||||
&& mTokenizer[mIndex]->text!="class"
|
&& mTokenizer[mIndex]->text!="class"
|
||||||
&& mTokenizer[mIndex]->text!="union") {
|
&& mTokenizer[mIndex]->text!="union") {
|
||||||
QString s=mTokenizer[mIndex]->text;
|
QString s=mTokenizer[mIndex]->text;
|
||||||
|
@ -3198,22 +3195,23 @@ bool CppParser::tryHandleVar()
|
||||||
|
|
||||||
bool varAdded = false;
|
bool varAdded = false;
|
||||||
QString tempType;
|
QString tempType;
|
||||||
while(true) {
|
while(mIndex<mTokenizer.tokenCount()) {
|
||||||
// Skip bit identifiers,
|
// Skip bit identifiers,
|
||||||
// e.g.:
|
// e.g.:
|
||||||
// handle
|
// handle
|
||||||
// unsigned short bAppReturnCode:8,reserved:6,fBusy:1,fAck:1
|
// unsigned short bAppReturnCode:8,reserved:6,fBusy:1,fAck:1
|
||||||
// as
|
// as
|
||||||
// unsigned short bAppReturnCode,reserved,fBusy,fAck
|
// unsigned short bAppReturnCode,reserved,fBusy,fAck
|
||||||
if ( (mIndex < mTokenizer.tokenCount()) && (mTokenizer[mIndex]->text.front() == ':')) {
|
if (mTokenizer[mIndex]->text.front() == ':') {
|
||||||
while ( (mIndex < mTokenizer.tokenCount())
|
while ( (mIndex < mTokenizer.tokenCount())
|
||||||
&& !(
|
&& !(
|
||||||
mTokenizer[mIndex]->text.startsWith(',')
|
mTokenizer[mIndex]->text.startsWith(',')
|
||||||
|| mTokenizer[mIndex]->text.startsWith(';')
|
|| mTokenizer[mIndex]->text.startsWith(';')
|
||||||
))
|
))
|
||||||
mIndex++;
|
mIndex++;
|
||||||
}
|
} else if (mTokenizer[mIndex]->text==';') {
|
||||||
if (mTokenizer[mIndex]->text=='('
|
break;
|
||||||
|
} else if (mTokenizer[mIndex]->text=='('
|
||||||
&& mTokenizer[mIndex]->matchIndex+1<mTokenizer.tokenCount()
|
&& mTokenizer[mIndex]->matchIndex+1<mTokenizer.tokenCount()
|
||||||
&& mTokenizer[mTokenizer[mIndex]->matchIndex+1]->text=='(') {
|
&& mTokenizer[mTokenizer[mIndex]->matchIndex+1]->text=='(') {
|
||||||
//function pointer
|
//function pointer
|
||||||
|
@ -3275,11 +3273,10 @@ bool CppParser::tryHandleVar()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mIndex++;
|
mIndex++;
|
||||||
} else if (mTokenizer[mIndex]->text==';') {
|
|
||||||
break;
|
|
||||||
} else if (mTokenizer[mIndex]->text=='(') {
|
} else if (mTokenizer[mIndex]->text=='(') {
|
||||||
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
||||||
} else if (mTokenizer[mIndex]->text=='{') {
|
} else if (mTokenizer[mIndex]->text=='{') {
|
||||||
|
tempType="";
|
||||||
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
mIndex=mTokenizer[mIndex]->matchIndex+1;
|
||||||
} else {
|
} else {
|
||||||
tempType="";
|
tempType="";
|
||||||
|
@ -3319,6 +3316,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
mPreprocessor.preprocess(fileName, buffer);
|
mPreprocessor.preprocess(fileName, buffer);
|
||||||
|
|
||||||
QStringList preprocessResult = mPreprocessor.result();
|
QStringList preprocessResult = mPreprocessor.result();
|
||||||
|
stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
|
// stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
|
||||||
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
|
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
|
||||||
|
@ -3340,6 +3338,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
|
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
|
||||||
|
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
|
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
|
||||||
//
|
//
|
||||||
|
@ -4371,25 +4370,69 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, int argStart
|
||||||
//function pointer
|
//function pointer
|
||||||
int argStart=mTokenizer[i]->matchIndex+1;
|
int argStart=mTokenizer[i]->matchIndex+1;
|
||||||
int argEnd=mTokenizer[argStart]->matchIndex;
|
int argEnd=mTokenizer[argStart]->matchIndex;
|
||||||
i=
|
QString cmd=mTokenizer[i+1]->text;
|
||||||
|
if (cmd.startsWith('*'))
|
||||||
|
cmd=cmd.mid(1);
|
||||||
|
QString args=mergeArgs(argStart,argEnd);
|
||||||
|
if (!cmd.isEmpty()) {
|
||||||
|
addStatement(
|
||||||
|
functionStatement,
|
||||||
|
mCurrentFile,
|
||||||
|
varType, // 'int*'
|
||||||
|
cmd, // a
|
||||||
|
args,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
mTokenizer[i+1]->line,
|
||||||
|
StatementKind::skParameter,
|
||||||
|
StatementScope::Local,
|
||||||
|
StatementClassScope::None,
|
||||||
|
true,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
i=argEnd+1;
|
||||||
|
varType="";
|
||||||
} else if (mTokenizer[i]->text=='{') {
|
} else if (mTokenizer[i]->text=='{') {
|
||||||
i=mTokenizer[i]->matchIndex+1;
|
i=mTokenizer[i]->matchIndex+1;
|
||||||
} else if (mTokenizer[i]->text=='(') {
|
} else if (mTokenizer[i]->text=='(') {
|
||||||
i=mTokenizer[i]->matchIndex+1;
|
i=mTokenizer[i]->matchIndex+1;
|
||||||
} else if (isWordChar(mTokenizer[i]->text[0])) {
|
} else if (isWordChar(mTokenizer[i]->text[0])) {
|
||||||
if (varType.isEmpty()) {
|
|
||||||
|
|
||||||
} else if
|
|
||||||
QString cmd=mTokenizer[i]->text;
|
QString cmd=mTokenizer[i]->text;
|
||||||
if () {
|
if (i+1==argEnd || mTokenizer[i+1]->text==',') {
|
||||||
QString args,suffix;
|
bool noCmd=false;
|
||||||
parseCommandTypeAndArgs(cmd,suffix,args);
|
if (!cmd.startsWith('*')
|
||||||
if (!cmd.isEmpty()) {
|
&& !cmd.startsWith('&')
|
||||||
|
&& !cmd.endsWith(']')) {
|
||||||
PStatement statement=findStatementOf(mCurrentFile,cmd,functionStatement,true);
|
PStatement statement=findStatementOf(mCurrentFile,cmd,functionStatement,true);
|
||||||
if (!statement || !isTypeStatement(statement->kind)) {
|
noCmd = (statement && isTypeStatement(statement->kind));
|
||||||
|
if (!noCmd) {
|
||||||
|
QString args,suffix;
|
||||||
|
parseCommandTypeAndArgs(cmd,suffix,args);
|
||||||
|
if (!cmd.isEmpty()) {
|
||||||
|
addStatement(
|
||||||
|
functionStatement,
|
||||||
|
mCurrentFile,
|
||||||
|
varType+suffix, // 'int*'
|
||||||
|
cmd, // a
|
||||||
|
args,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
mTokenizer[i]->line,
|
||||||
|
StatementKind::skParameter,
|
||||||
|
StatementScope::Local,
|
||||||
|
StatementClassScope::None,
|
||||||
|
true,
|
||||||
|
false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
varType+=cmd;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
varType="";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4599,13 +4642,15 @@ bool CppParser::isNotFuncArgs(int startIndex, int endIndex)
|
||||||
return true;
|
return true;
|
||||||
if (isLetterChar(ch)) {
|
if (isLetterChar(ch)) {
|
||||||
QString currentText=mTokenizer[i]->text;
|
QString currentText=mTokenizer[i]->text;
|
||||||
if (currentText=="true" || currentText=="false" || currentText=="nullptr"
|
if (!mCppTypeKeywords.contains(currentText)) {
|
||||||
|| currentText=="const")
|
if (currentText=="true" || currentText=="false" || currentText=="nullptr" )
|
||||||
return true;
|
return true;
|
||||||
PStatement statement =findStatementOf(mCurrentFile,word,getCurrentScope(),true);
|
|
||||||
if (statement &&
|
PStatement statement =findStatementOf(mCurrentFile,word,getCurrentScope(),true);
|
||||||
!isTypeStatement(statement->kind))
|
if (statement &&
|
||||||
return true;
|
!isTypeStatement(statement->kind))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ private:
|
||||||
bool isStatic);
|
bool isStatic);
|
||||||
void setInheritance(int index, const PStatement& classStatement, bool isStruct);
|
void setInheritance(int index, const PStatement& classStatement, bool isStruct);
|
||||||
bool isCurrentScope(const QString& command);
|
bool isCurrentScope(const QString& command);
|
||||||
void addSoloScopeLevel(PStatement& statement, int line, bool shouldResetBlock = true); // adds new solo level
|
void addSoloScopeLevel(PStatement& statement, int line); // adds new solo level
|
||||||
void removeScopeLevel(int line); // removes level
|
void removeScopeLevel(int line); // removes level
|
||||||
|
|
||||||
int indexOfMatchingBrace(int startAt) {
|
int indexOfMatchingBrace(int startAt) {
|
||||||
|
|
|
@ -67,10 +67,10 @@ void CppTokenizer::tokenize(const QStringList &buffer)
|
||||||
addToken("}",mCurrentLine,TokenType::RightBrace);
|
addToken("}",mCurrentLine,TokenType::RightBrace);
|
||||||
}
|
}
|
||||||
while (!mUnmatchedBrackets.isEmpty()) {
|
while (!mUnmatchedBrackets.isEmpty()) {
|
||||||
addToken("]",mCurrentLine,TokenType::RightBrace);
|
addToken("]",mCurrentLine,TokenType::RightBracket);
|
||||||
}
|
}
|
||||||
while (!mUnmatchedParenthesis.isEmpty()) {
|
while (!mUnmatchedParenthesis.isEmpty()) {
|
||||||
addToken(")",mCurrentLine,TokenType::RightBrace);
|
addToken(")",mCurrentLine,TokenType::RightParenthesis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,28 +167,6 @@ void CppTokenizer::countLines()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppTokenizer::getArguments()
|
|
||||||
{
|
|
||||||
QChar* offset = mCurrent;
|
|
||||||
skipPair('(', ')');
|
|
||||||
QString result(offset,mCurrent-offset);
|
|
||||||
simplifyArgs(result);
|
|
||||||
if ((*mCurrent == '.') || ((*mCurrent == '-') && (*(mCurrent + 1) == '>'))) {
|
|
||||||
// skip '.' and '->'
|
|
||||||
while ( !( *mCurrent == 0
|
|
||||||
|| *mCurrent == '('
|
|
||||||
|| *mCurrent == ';'
|
|
||||||
|| *mCurrent == '{'
|
|
||||||
|| *mCurrent == '}'
|
|
||||||
|| *mCurrent == ')'
|
|
||||||
|| isLineChar(*mCurrent)
|
|
||||||
|| isSpaceChar(*mCurrent)) )
|
|
||||||
mCurrent++;
|
|
||||||
}
|
|
||||||
skipToNextToken();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CppTokenizer::getForInit()
|
QString CppTokenizer::getForInit()
|
||||||
{
|
{
|
||||||
QChar* startOffset = mCurrent;
|
QChar* startOffset = mCurrent;
|
||||||
|
@ -262,8 +240,10 @@ QString CppTokenizer::getNextToken(TokenType *pTokenType, bool bSkipArray, bool
|
||||||
if (*(mCurrent + 1) == ':') {
|
if (*(mCurrent + 1) == ':') {
|
||||||
countLines();
|
countLines();
|
||||||
mCurrent+=2;
|
mCurrent+=2;
|
||||||
|
result = "::";
|
||||||
// Append next token to this one
|
// Append next token to this one
|
||||||
result = "::"+getWord(true, bSkipArray, bSkipBlock);
|
if (isIdentChar(*mCurrent))
|
||||||
|
result+=getWord(true, bSkipArray, bSkipBlock);
|
||||||
done = true;
|
done = true;
|
||||||
} else {
|
} else {
|
||||||
countLines();
|
countLines();
|
||||||
|
@ -436,13 +416,15 @@ QString CppTokenizer::getWord(bool bSkipParenthesis, bool bSkipArray, bool bSkip
|
||||||
} else if ((*mCurrent == '-') && (*(mCurrent + 1) == '>')) {
|
} else if ((*mCurrent == '-') && (*(mCurrent + 1) == '>')) {
|
||||||
result+=QString(mCurrent,2);
|
result+=QString(mCurrent,2);
|
||||||
mCurrent+=2;
|
mCurrent+=2;
|
||||||
} else if ((*mCurrent == ':') && (*(mCurrent + 1) == ':')) {
|
} else if ((*mCurrent == ':') && (*(mCurrent + 1) == ':') ) {
|
||||||
if (result != "using") {
|
if (result != "using") {
|
||||||
result+=QString(mCurrent,2);
|
result+=QString(mCurrent,2);
|
||||||
mCurrent+=2;
|
mCurrent+=2;
|
||||||
// Append next token to this one
|
if (isIdentChar(*mCurrent)) {
|
||||||
QString s = getWord(bSkipParenthesis, bSkipArray, bSkipBlock);
|
// Append next token to this one
|
||||||
result += s;
|
QString s = getWord(bSkipParenthesis, bSkipArray, bSkipBlock);
|
||||||
|
result += s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ private:
|
||||||
void countLines();
|
void countLines();
|
||||||
PToken getToken(int index);
|
PToken getToken(int index);
|
||||||
|
|
||||||
QString getArguments();
|
|
||||||
QString getForInit();
|
QString getForInit();
|
||||||
QString getNextToken(
|
QString getNextToken(
|
||||||
TokenType *pTokenType,
|
TokenType *pTokenType,
|
||||||
|
|
|
@ -77,7 +77,7 @@ enum class KeywordType {
|
||||||
None // It's a keyword but don't process here
|
None // It's a keyword but don't process here
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//It will be used as hash key. DONT make it enum class!!!!!
|
||||||
enum StatementKind {
|
enum StatementKind {
|
||||||
skUnknown,
|
skUnknown,
|
||||||
skNamespace,
|
skNamespace,
|
||||||
|
|
Loading…
Reference in New Issue