fix: '::' is not correctly handled when skip to : in the parser

This commit is contained in:
Roy Qu 2023-03-10 16:02:47 +08:00
parent f0f9741220
commit 60055107ca
2 changed files with 12 additions and 7 deletions

View File

@ -3817,7 +3817,7 @@ void CppParser::internalParse(const QString &fileName)
QStringList preprocessResult = mPreprocessor.result();
#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.dumpIncludesListTo("r:\\includes.txt");
#endif
@ -3831,7 +3831,7 @@ void CppParser::internalParse(const QString &fileName)
if (mTokenizer.tokenCount() == 0)
return;
#ifdef QT_DEBUG
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
#endif
#ifdef QT_DEBUG
mLastIndex = -1;
@ -3842,8 +3842,8 @@ void CppParser::internalParse(const QString &fileName)
break;
}
#ifdef QT_DEBUG
// mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
// mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
#endif
//reduce memory usage
internalClear();
@ -5441,9 +5441,14 @@ int CppParser::indexOfNextSemicolonOrLeftBrace(int index)
int CppParser::indexOfNextColon(int index)
{
while (index<mTokenizer.tokenCount()) {
switch(mTokenizer[index]->text[0].unicode()) {
QString s =mTokenizer[index]->text;
switch(s[0].unicode()) {
case ':':
if (s.length()==1)
return index;
else
index++;
break;
case '(':
index = mTokenizer[index]->matchIndex+1;
break;

View File

@ -188,7 +188,7 @@ void ProjectGeneralWidget::on_btnRemove_clicked()
setSettingsChanged();
}
void ProjectGeneralWidget::on_cbEncoding_currentTextChanged(const QString &arg1)
void ProjectGeneralWidget::on_cbEncoding_currentTextChanged(const QString &/*arg1*/)
{
QString userData = ui->cbEncoding->currentData().toString();
if (userData == ENCODING_AUTO_DETECT