Improve raw string syntax color
This commit is contained in:
parent
89c895837a
commit
e49f815119
|
@ -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<QVariant>("");
|
||||
while (mRun<mLineSize) {
|
||||
if (mRange.state!=RangeState::rsRawStringNotEscaping &&
|
||||
(mLine[mRun]=='"'
|
||||
|
@ -981,20 +982,24 @@ void CppSyntaxer::procRawString()
|
|||
case '(':
|
||||
if (mRange.state==RangeState::rsRawString) {
|
||||
mRange.state = RangeState::rsRawStringNotEscaping;
|
||||
mRawStringInitialDCharSeq += "\"";
|
||||
rawStringInitialDCharSeq += "\"";
|
||||
mRange.extraData = std::make_shared<QVariant>(rawStringInitialDCharSeq);
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
if (mRange.state == RangeState::rsRawStringNotEscaping
|
||||
&& mLine.mid(mRun+1,mRawStringInitialDCharSeq.length()) == mRawStringInitialDCharSeq) {
|
||||
mRun = mRun+1+mRawStringInitialDCharSeq.length();
|
||||
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)
|
||||
|
|
|
@ -159,8 +159,6 @@ private:
|
|||
int mLeftBraces;
|
||||
int mRightBraces;
|
||||
|
||||
QString mRawStringInitialDCharSeq;
|
||||
|
||||
QSet<QString> mCustomTypeKeywords;
|
||||
|
||||
PTokenAttribute mPreprocessorAttribute;
|
||||
|
|
|
@ -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<IndentInfo> indents;
|
||||
QVector<IndentInfo> indents; // indents stack (needed by auto indent)
|
||||
IndentInfo lastUnindent;
|
||||
// QVector<int> 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<int> matchingIndents; /* the indent matched ( and removed )
|
||||
// but not started at this line
|
||||
// (need by auto indent) */
|
||||
bool hasTrailingSpaces;
|
||||
std::shared_ptr<QVariant> extraData;
|
||||
|
||||
bool operator==(const SyntaxState& s2);
|
||||
IndentInfo getLastIndent();
|
||||
IndentType getLastIndentType();
|
||||
|
|
Loading…
Reference in New Issue