- enhancement: improve parse result for STL <random>

This commit is contained in:
Roy Qu 2022-11-12 12:14:19 +08:00
parent edfd09191c
commit 6a6dc126a4
4 changed files with 29 additions and 7 deletions

View File

@ -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 <random>
- 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

View File

@ -3618,7 +3618,7 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
break;
} else if (isWordChar(mTokenizer[mIndex]->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+1<mTokenizer.tokenCount()
&& mTokenizer[mTokenizer[mIndex+1]->matchIndex+1]->text=='(') {
//function pointer

View File

@ -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()

View File

@ -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();