diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp index e3323468..b8c86d29 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp @@ -963,8 +963,9 @@ void CppSyntaxer::procQuestion() void CppSyntaxer::procRawString() { mTokenId = TokenId::RawString; + QString rawStringInitialDCharSeq; if (mRange.state == RangeState::rsRawString) - mRawStringInitialDCharSeq=""; + mRange.extraData = std::make_shared(""); while (mRun(rawStringInitialDCharSeq); } break; case ')': - if (mRange.state == RangeState::rsRawStringNotEscaping - && mLine.mid(mRun+1,mRawStringInitialDCharSeq.length()) == mRawStringInitialDCharSeq) { - mRun = mRun+1+mRawStringInitialDCharSeq.length(); - mRange.state = RangeState::rsUnknown; - return; + if (mRange.state == RangeState::rsRawStringNotEscaping) { + rawStringInitialDCharSeq = mRange.extraData->toString(); + if ( mLine.mid(mRun+1,rawStringInitialDCharSeq.length()) == rawStringInitialDCharSeq) { + mRun = mRun+1+rawStringInitialDCharSeq.length(); + mRange.state = RangeState::rsUnknown; + mRange.extraData = nullptr; + return; + } } break; } if (mRange.state == RangeState::rsRawString) - mRawStringInitialDCharSeq += mLine[mRun]; + rawStringInitialDCharSeq += mLine[mRun]; mRun+=1; } if (mRun>=mLineSize && mRange.state != RangeState::rsRawStringNotEscaping) diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.h b/libs/qsynedit/qsynedit/syntaxer/cpp.h index 4f5021cf..2c7509ad 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.h +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.h @@ -159,8 +159,6 @@ private: int mLeftBraces; int mRightBraces; - QString mRawStringInitialDCharSeq; - QSet mCustomTypeKeywords; PTokenAttribute mPreprocessorAttribute; diff --git a/libs/qsynedit/qsynedit/syntaxer/syntaxer.h b/libs/qsynedit/qsynedit/syntaxer/syntaxer.h index 5d39ee6b..96a708a2 100644 --- a/libs/qsynedit/qsynedit/syntaxer/syntaxer.h +++ b/libs/qsynedit/qsynedit/syntaxer/syntaxer.h @@ -54,15 +54,11 @@ struct SyntaxState { int parenthesisLevel; // current parenthesis embedding level (needed by rainbow color) // int leftBraces; // unpairing left braces in the current line ( needed by block folding) // int rightBraces; // unparing right braces in the current line (needed by block folding) - QVector indents; + QVector indents; // indents stack (needed by auto indent) IndentInfo lastUnindent; -// QVector indents; // indents stack (needed by auto indent) -// int firstIndentThisLine; /* index of first indent that appended to the indents -// * stack at this line ( need by auto indent) */ -// QVector matchingIndents; /* the indent matched ( and removed ) -// but not started at this line -// (need by auto indent) */ bool hasTrailingSpaces; + std::shared_ptr extraData; + bool operator==(const SyntaxState& s2); IndentInfo getLastIndent(); IndentType getLastIndentType();