diff --git a/NEWS.md b/NEWS.md index 5ad22440..94b8d5b0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -25,10 +25,11 @@ Red Panda C++ Version 2.4 - fix: &operator= functions are not correctly parsed; - fix: Code Formatter's "add indent to continueous lines" option is not correctly saved. - fix: _Pragma is not correctly handled; + - enhancement: improve parse result for STL - change: the default value for UI font size : 11 - change: the default value for add leading zeros to line numbers : false - - + - upgrade integrated libturtle. fix: nothing is drawed when set background color to BLACK + - upgrade integrate fmtlib. fix: imcompatible with GBK encoding Red Panda C++ Version 2.3 diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index c0caf747..4388a23a 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1457,7 +1457,7 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe mClassScope = StatementClassScope::Public; // structs are public by default mCurrentClassScope.append(mClassScope); #ifdef QT_DEBUG - //if (mCurrentClassScope.count()==1) +// if (mCurrentClassScope.count()==1) // qDebug()<<"++add scope"<text[0])) { QString cmd=mTokenizer[mIndex]->text; - if (mTokenizer[mIndex+1]->text=='(' + if (mIndex+1< mTokenizer.tokenCount() && mTokenizer[mIndex+1]->text=='(' && mTokenizer[mIndex+1]->matchIndex+1matchIndex+1]->text=='(') { //function pointer diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index 5dbbf90c..755b3394 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -201,7 +201,6 @@ QString CppTokenizer::getForInit() QString CppTokenizer::getNextToken(TokenType *pTokenType, bool bSkipArray, bool bSkipBlock) { QString result; - int backupIndex; bool done = false; *pTokenType=TokenType::Normal; while (true) { @@ -759,7 +758,28 @@ void CppTokenizer::skipTemplateArgs() if (*mCurrent != '<') return; - skipPair('<', '>'); + if (skipAngleBracketPair()) + return; + QChar* lastBracketPos = mCurrent; + bool shouldExit=false; + while (true) { + switch(mCurrent->unicode()) { + case '\0': + case ';': + case '}': + case '{': + shouldExit=true; + break; + case '>': + lastBracketPos = mCurrent; + break; + } + if (shouldExit) + break; + mCurrent++; + } + if (*lastBracketPos=='>') + mCurrent = lastBracketPos+1; //skip '>'; } void CppTokenizer::skipToEOL() diff --git a/RedPandaIDE/parser/cpptokenizer.h b/RedPandaIDE/parser/cpptokenizer.h index de3d3f5c..4bcab3a4 100644 --- a/RedPandaIDE/parser/cpptokenizer.h +++ b/RedPandaIDE/parser/cpptokenizer.h @@ -82,6 +82,7 @@ private: void skipAssignment(); void skipDoubleQuotes(); void skipPair(const QChar& cStart, const QChar cEnd); + void skipParenthesis(); bool skipAngleBracketPair(); void skipRawString(); void skipSingleQuote();