From 20917e3a8bbb52f1a90729ebd71e86a22efc8130 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 3 Nov 2022 00:49:22 +0800 Subject: [PATCH] work save --- NEWS.md | 7 +++++ RedPandaIDE/RedPandaIDE.pro | 2 +- RedPandaIDE/parser/cppparser.cpp | 42 +++++++++++++++++++-------- RedPandaIDE/parser/cppparser.h | 4 ++- RedPandaIDE/parser/cpptokenizer.cpp | 6 ++-- Red_Panda_CPP.pro | 2 +- libs/qsynedit/qsynedit/TextBuffer.cpp | 2 +- 7 files changed, 47 insertions(+), 18 deletions(-) diff --git a/NEWS.md b/NEWS.md index 783c2d3a..11662470 100644 --- a/NEWS.md +++ b/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 - fix: editors that not in the editing panel shouldn't trigger switch breakpoint diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index c99aa3c9..7207bfca 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -10,7 +10,7 @@ isEmpty(APP_NAME) { } isEmpty(APP_VERSION) { - APP_VERSION = 2.1 + APP_VERSION = 2.2 } macos: { diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index bc68b7d3..00f3644a 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1446,7 +1446,7 @@ void CppParser::addSoloScopeLevel(PStatement& statement, int line, bool shouldRe else mClassScope = StatementClassScope::Public; // structs are public by default mCurrentClassScope.append(mClassScope); - //qDebug()<<"++add scope"<kind == StatementKind::skBlock)) { @@ -2320,9 +2320,6 @@ void CppParser::handleMethod(const QString &sType, const QString &sName, int arg mIndex=mTokenizer[mIndex+1]->matchIndex+1; } else if (mTokenizer[mIndex]->text=='(') { mIndex=mTokenizer[mIndex]->matchIndex+1; - }else if (mTokenizer[mIndex]->text==':') { - foundColon=true; - break; } else mIndex++; } @@ -2534,10 +2531,13 @@ void CppParser::handleNamespace(KeywordType skipType) mClassScope, true, false); - addSoloScopeLevel(namespaceStatement,startLine); - // Skip pass next '{' - mIndex = indexOfNextLeftBrace(mIndex)+1; + // find next '{' or ';' + mIndex = indexOfNextSemicolonOrLeftBrace(mIndex); + if (mTokenizer[mIndex]->text=='{') + addSoloScopeLevel(namespaceStatement,startLine); + //skip it + mIndex++; } } @@ -2667,6 +2667,7 @@ void CppParser::handlePreprocessor() goto handlePreprocessorEnd; int delimPos = s.lastIndexOf(':'); if (delimPos>=0) { + qDebug()<line<text[0].unicode()) { + case ';': + case '{': + return index; + case '(': + index = mTokenizer[index]->matchIndex+1; + break; + default: + index++; + } + } + return index; +} + int CppParser::indexOfNextColon(int index) { while (index