work save
This commit is contained in:
parent
baab677fa1
commit
20917e3a8b
7
NEWS.md
7
NEWS.md
|
@ -1,3 +1,10 @@
|
||||||
|
Red Panda C++ Version 2.2
|
||||||
|
|
||||||
|
- enhancement: basic code completion support for C++ lambda
|
||||||
|
- enhancement: slightly reduce parsing time
|
||||||
|
- fix: Wrong charset name returned when saveing file
|
||||||
|
- fix: 'using =' / 'namespace =' not correctly handled
|
||||||
|
|
||||||
Red Panda C++ Version 2.1
|
Red Panda C++ Version 2.1
|
||||||
|
|
||||||
- fix: editors that not in the editing panel shouldn't trigger switch breakpoint
|
- fix: editors that not in the editing panel shouldn't trigger switch breakpoint
|
||||||
|
|
|
@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(APP_VERSION) {
|
isEmpty(APP_VERSION) {
|
||||||
APP_VERSION = 2.1
|
APP_VERSION = 2.2
|
||||||
}
|
}
|
||||||
|
|
||||||
macos: {
|
macos: {
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe
|
||||||
else
|
else
|
||||||
mClassScope = StatementClassScope::Public; // structs are public by default
|
mClassScope = StatementClassScope::Public; // structs are public by default
|
||||||
mCurrentClassScope.append(mClassScope);
|
mCurrentClassScope.append(mClassScope);
|
||||||
//qDebug()<<"++add scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
qDebug()<<"++add scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppParser::removeScopeLevel(int line)
|
void CppParser::removeScopeLevel(int line)
|
||||||
|
@ -1454,7 +1454,7 @@ void CppParser::removeScopeLevel(int line)
|
||||||
// Remove class list
|
// Remove class list
|
||||||
if (mCurrentScope.isEmpty())
|
if (mCurrentScope.isEmpty())
|
||||||
return; // TODO: should be an exception
|
return; // TODO: should be an exception
|
||||||
//qDebug()<<"--remove scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
qDebug()<<"--remove scope"<<mCurrentFile<<line<<mCurrentClassScope.count();
|
||||||
PStatement currentScope = getCurrentScope();
|
PStatement currentScope = getCurrentScope();
|
||||||
PFileIncludes fileIncludes = mPreprocessor.includesList().value(mCurrentFile);
|
PFileIncludes fileIncludes = mPreprocessor.includesList().value(mCurrentFile);
|
||||||
if (currentScope && (currentScope->kind == StatementKind::skBlock)) {
|
if (currentScope && (currentScope->kind == StatementKind::skBlock)) {
|
||||||
|
@ -2320,9 +2320,6 @@ void CppParser::handleMethod(const QString &sType, const QString &sName, int arg
|
||||||
mIndex=mTokenizer[mIndex+1]->matchIndex+1;
|
mIndex=mTokenizer[mIndex+1]->matchIndex+1;
|
||||||
} 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==':') {
|
|
||||||
foundColon=true;
|
|
||||||
break;
|
|
||||||
} else
|
} else
|
||||||
mIndex++;
|
mIndex++;
|
||||||
}
|
}
|
||||||
|
@ -2534,10 +2531,13 @@ void CppParser::handleNamespace(KeywordType skipType)
|
||||||
mClassScope,
|
mClassScope,
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
addSoloScopeLevel(namespaceStatement,startLine);
|
|
||||||
|
|
||||||
// Skip pass next '{'
|
// find next '{' or ';'
|
||||||
mIndex = indexOfNextLeftBrace(mIndex)+1;
|
mIndex = indexOfNextSemicolonOrLeftBrace(mIndex);
|
||||||
|
if (mTokenizer[mIndex]->text=='{')
|
||||||
|
addSoloScopeLevel(namespaceStatement,startLine);
|
||||||
|
//skip it
|
||||||
|
mIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2667,6 +2667,7 @@ void CppParser::handlePreprocessor()
|
||||||
goto handlePreprocessorEnd;
|
goto handlePreprocessorEnd;
|
||||||
int delimPos = s.lastIndexOf(':');
|
int delimPos = s.lastIndexOf(':');
|
||||||
if (delimPos>=0) {
|
if (delimPos>=0) {
|
||||||
|
qDebug()<<mCurrentScope.size()<<mCurrentFile<<mTokenizer[mIndex]->line<<s.mid(0,delimPos).trimmed();
|
||||||
mCurrentFile = s.mid(0,delimPos).trimmed();
|
mCurrentFile = s.mid(0,delimPos).trimmed();
|
||||||
mIsSystemHeader = isSystemHeaderFile(mCurrentFile) || isProjectHeaderFile(mCurrentFile);
|
mIsSystemHeader = isSystemHeaderFile(mCurrentFile) || isProjectHeaderFile(mCurrentFile);
|
||||||
mIsProjectFile = mProjectFiles.contains(mCurrentFile);
|
mIsProjectFile = mProjectFiles.contains(mCurrentFile);
|
||||||
|
@ -3396,7 +3397,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
|
|
||||||
QStringList preprocessResult = mPreprocessor.result();
|
QStringList preprocessResult = mPreprocessor.result();
|
||||||
#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");
|
||||||
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
|
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
|
||||||
#endif
|
#endif
|
||||||
|
@ -3410,7 +3411,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
if (mTokenizer.tokenCount() == 0)
|
if (mTokenizer.tokenCount() == 0)
|
||||||
return;
|
return;
|
||||||
#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)));
|
||||||
#endif
|
#endif
|
||||||
// Process the token list
|
// Process the token list
|
||||||
while(true) {
|
while(true) {
|
||||||
|
@ -3418,8 +3419,8 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// mStatementList.dumpAll(QString("r:\\all-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)));
|
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
|
||||||
#endif
|
#endif
|
||||||
//reduce memory usage
|
//reduce memory usage
|
||||||
internalClear();
|
internalClear();
|
||||||
|
@ -4790,6 +4791,23 @@ int CppParser::indexOfNextSemicolon(int index)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CppParser::indexOfNextSemicolonOrLeftBrace(int index)
|
||||||
|
{
|
||||||
|
while (index<mTokenizer.tokenCount()) {
|
||||||
|
switch(mTokenizer[index]->text[0].unicode()) {
|
||||||
|
case ';':
|
||||||
|
case '{':
|
||||||
|
return index;
|
||||||
|
case '(':
|
||||||
|
index = mTokenizer[index]->matchIndex+1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
|
||||||
int CppParser::indexOfNextColon(int index)
|
int CppParser::indexOfNextColon(int index)
|
||||||
{
|
{
|
||||||
while (index<mTokenizer.tokenCount()) {
|
while (index<mTokenizer.tokenCount()) {
|
||||||
|
|
|
@ -467,13 +467,14 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isInvalidFunctionArgsSuffixChar(const QChar& ch) const {
|
bool isInvalidFunctionArgsSuffixChar(const QChar& ch) const {
|
||||||
|
|
||||||
|
// &&
|
||||||
switch(ch.unicode()){
|
switch(ch.unicode()){
|
||||||
case '.':
|
case '.':
|
||||||
case '-':
|
case '-':
|
||||||
case '+':
|
case '+':
|
||||||
case '/':
|
case '/':
|
||||||
case '%':
|
case '%':
|
||||||
case '&':
|
|
||||||
case '*':
|
case '*':
|
||||||
case '|':
|
case '|':
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -563,6 +564,7 @@ private:
|
||||||
void updateSerialId();
|
void updateSerialId();
|
||||||
|
|
||||||
int indexOfNextSemicolon(int index);
|
int indexOfNextSemicolon(int index);
|
||||||
|
int indexOfNextSemicolonOrLeftBrace(int index);
|
||||||
int indexOfNextColon(int index);
|
int indexOfNextColon(int index);
|
||||||
int indexOfNextLeftBrace(int index);
|
int indexOfNextLeftBrace(int index);
|
||||||
int indexPassParenthesis(int index);
|
int indexPassParenthesis(int index);
|
||||||
|
|
|
@ -735,8 +735,10 @@ void CppTokenizer::advance()
|
||||||
mCurrent++;
|
mCurrent++;
|
||||||
break;
|
break;
|
||||||
case '=': {
|
case '=': {
|
||||||
if (mTokenList.size()>2
|
if (mTokenList.size()>=2
|
||||||
&& mTokenList[mTokenList.size()-2]->text == "using") {
|
&&( mTokenList[mTokenList.size()-2]->text == "using"
|
||||||
|
|| mTokenList[mTokenList.size()-2]->text == "namespace")
|
||||||
|
) {
|
||||||
addToken("=", mCurrentLine, TokenType::Normal);
|
addToken("=", mCurrentLine, TokenType::Normal);
|
||||||
mCurrent++;
|
mCurrent++;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -33,7 +33,7 @@ RedPandaIDE.depends += redpanda-git-askpass
|
||||||
|
|
||||||
APP_NAME = RedPandaCPP
|
APP_NAME = RedPandaCPP
|
||||||
|
|
||||||
APP_VERSION = 2.1
|
APP_VERSION = 2.2
|
||||||
|
|
||||||
linux: {
|
linux: {
|
||||||
isEmpty(PREFIX) {
|
isEmpty(PREFIX) {
|
||||||
|
|
|
@ -688,7 +688,7 @@ void Document::saveToFile(QFile &file, const QByteArray& encoding,
|
||||||
if (allAscii) {
|
if (allAscii) {
|
||||||
realEncoding = ENCODING_ASCII;
|
realEncoding = ENCODING_ASCII;
|
||||||
} else if (encoding == ENCODING_AUTO_DETECT) {
|
} else if (encoding == ENCODING_AUTO_DETECT) {
|
||||||
if (codec->name().compare("System",Qt::CaseInsensitive)) {
|
if (codec->name().compare("System",Qt::CaseInsensitive)==0) {
|
||||||
realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
|
realEncoding = pCharsetInfoManager->getDefaultSystemEncoding();
|
||||||
} else {
|
} else {
|
||||||
realEncoding = codec->name();
|
realEncoding = codec->name();
|
||||||
|
|
Loading…
Reference in New Issue