From 522722c41865c11c0a255e5cb119d9e66cbd5ad0 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Tue, 20 Feb 2024 17:25:37 +0800 Subject: [PATCH] - Enhancement: Improved Raw string support --- NEWS.md | 1 + RedPandaIDE/editor.cpp | 1 - RedPandaIDE/parser/cpptokenizer.cpp | 26 +++++++++++++++++++++++-- libs/qsynedit/qsynedit/syntaxer/cpp.cpp | 24 +++++++++++++++++++---- libs/qsynedit/qsynedit/syntaxer/cpp.h | 2 ++ 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index cfe3460f..82eb9bad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -46,6 +46,7 @@ Red Panda C++ Version 2.26 - Fix: Expression that starts with full scoped variables might be treated as var definition. - Enhancement: Don't auto-indent in raw string. - Fix: Function list is not correctly retrived for full-scoped functions. + - Enhancement: Improved Raw string support Red Panda C++ Version 2.25 diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index cdd654ab..a41b74c4 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -4351,7 +4351,6 @@ void Editor::updateFunctionTip(bool showTip) // Don't bother scanning the database when there's no identifier to scan for // Only do the cumbersome list filling when showing a new tooltip... - if (s != pMainWindow->functionTip()->functionFullName() && !mParser->parsing()) { pMainWindow->functionTip()->clearTips(); diff --git a/RedPandaIDE/parser/cpptokenizer.cpp b/RedPandaIDE/parser/cpptokenizer.cpp index d8e4edd7..a5130d9c 100644 --- a/RedPandaIDE/parser/cpptokenizer.cpp +++ b/RedPandaIDE/parser/cpptokenizer.cpp @@ -748,16 +748,38 @@ void CppTokenizer::skipRawString() { mCurrent++; //skip R bool noEscape = false; + bool findDCharSeq = true; + QString dCharSeq; while(true) { mCurrent++; switch(mCurrent->unicode()) { case '(': - noEscape = true; + if (findDCharSeq) { + noEscape = true; + findDCharSeq = false; + } break; case ')': - noEscape = false; + if (noEscape) { + bool ok=true; + QChar* pChar=mCurrent+1; + for (int i=0;i127)) { mRange.state = RangeState::rsUnknown; mRun+=1; return; @@ -974,14 +979,25 @@ void CppSyntaxer::procRawString() case '\t': return; case '(': - if (mRange.state==RangeState::rsRawString) + if (mRange.state==RangeState::rsRawString) { mRange.state = RangeState::rsRawStringNotEscaping; + mRawStringInitialDCharSeq += "\""; + } break; case ')': - if (mRange.state == RangeState::rsRawStringNotEscaping) - mRange.state = RangeState::rsRawStringEnd; + qDebug()<=mLineSize && mRange.state != RangeState::rsRawStringNotEscaping) diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.h b/libs/qsynedit/qsynedit/syntaxer/cpp.h index 2c7509ad..4f5021cf 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.h +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.h @@ -159,6 +159,8 @@ private: int mLeftBraces; int mRightBraces; + QString mRawStringInitialDCharSeq; + QSet mCustomTypeKeywords; PTokenAttribute mPreprocessorAttribute;