- enhancement: Correctly reformat C++ three-way comparision operator "<=>"
This commit is contained in:
parent
5240b1f01f
commit
4f23c35808
1
NEWS.md
1
NEWS.md
|
@ -32,6 +32,7 @@ Red Panda C++ Version 2.23
|
||||||
- fix: Tips for problem is not correctly displayed.
|
- fix: Tips for problem is not correctly displayed.
|
||||||
- enhancement: Folder mode in "File in files" dialog.
|
- enhancement: Folder mode in "File in files" dialog.
|
||||||
- enhancement: When open a file, test if it contains binary contains.
|
- enhancement: When open a file, test if it contains binary contains.
|
||||||
|
- enhancement: Correctly reformat C++ three-way comparision operator "<=>"
|
||||||
|
|
||||||
Red Panda C++ Version 2.22
|
Red Panda C++ Version 2.22
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ AutolinkManager* pAutolinkManager;
|
||||||
|
|
||||||
AutolinkManager::AutolinkManager()
|
AutolinkManager::AutolinkManager()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PAutolink AutolinkManager::getLink(const QString &header) const
|
PAutolink AutolinkManager::getLink(const QString &header) const
|
||||||
|
|
|
@ -558,12 +558,14 @@ void CppSyntaxer::procGreater()
|
||||||
switch (mLine[mRun+1].unicode()) {
|
switch (mLine[mRun+1].unicode()) {
|
||||||
case '=':
|
case '=':
|
||||||
mRun += 2;
|
mRun += 2;
|
||||||
|
if (mRun<mLineSize && mLine[mRun]=='>') // C++20 <=>
|
||||||
|
mRun++;
|
||||||
return;
|
return;
|
||||||
case '>':
|
case '>':
|
||||||
if (mRun+2<mLineSize && mLine[mRun+2] == '=') {
|
if (mRun+2<mLineSize && mLine[mRun+2] == '=') { // >>=
|
||||||
mRun+=3;
|
mRun+=3;
|
||||||
} else {
|
} else {
|
||||||
mRun += 2;
|
mRun += 2; // >>
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,7 @@ const string ASResource::AS_GR_GR_GR = string(">>>");
|
||||||
const string ASResource::AS_LS_EQUAL = string("<=");
|
const string ASResource::AS_LS_EQUAL = string("<=");
|
||||||
const string ASResource::AS_LS_LS = string("<<");
|
const string ASResource::AS_LS_LS = string("<<");
|
||||||
const string ASResource::AS_LS_LS_LS = string("<<<");
|
const string ASResource::AS_LS_LS_LS = string("<<<");
|
||||||
|
const string ASResource::AS_THREEWAY_COMPARISION = string("<=>");
|
||||||
const string ASResource::AS_QUESTION_QUESTION = string("??");
|
const string ASResource::AS_QUESTION_QUESTION = string("??");
|
||||||
const string ASResource::AS_LAMBDA = string("=>"); // C# lambda expression arrow
|
const string ASResource::AS_LAMBDA = string("=>"); // C# lambda expression arrow
|
||||||
const string ASResource::AS_ARROW = string("->");
|
const string ASResource::AS_ARROW = string("->");
|
||||||
|
@ -350,8 +351,8 @@ void ASResource::buildIndentableMacros(vector<const pair<const string, const str
|
||||||
*/
|
*/
|
||||||
void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators)
|
void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators)
|
||||||
{
|
{
|
||||||
const size_t elements = 15;
|
// const size_t elements = 16;
|
||||||
nonAssignmentOperators->reserve(elements);
|
// nonAssignmentOperators->reserve(elements);
|
||||||
|
|
||||||
nonAssignmentOperators->emplace_back(&AS_EQUAL);
|
nonAssignmentOperators->emplace_back(&AS_EQUAL);
|
||||||
nonAssignmentOperators->emplace_back(&AS_PLUS_PLUS);
|
nonAssignmentOperators->emplace_back(&AS_PLUS_PLUS);
|
||||||
|
@ -367,8 +368,9 @@ void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmen
|
||||||
nonAssignmentOperators->emplace_back(&AS_AND);
|
nonAssignmentOperators->emplace_back(&AS_AND);
|
||||||
nonAssignmentOperators->emplace_back(&AS_OR);
|
nonAssignmentOperators->emplace_back(&AS_OR);
|
||||||
nonAssignmentOperators->emplace_back(&AS_LAMBDA);
|
nonAssignmentOperators->emplace_back(&AS_LAMBDA);
|
||||||
|
nonAssignmentOperators->emplace_back(&AS_THREEWAY_COMPARISION);
|
||||||
|
|
||||||
assert(nonAssignmentOperators->size() < elements);
|
// assert(nonAssignmentOperators->size() < elements);
|
||||||
sort(nonAssignmentOperators->begin(), nonAssignmentOperators->end(), sortOnLength);
|
sort(nonAssignmentOperators->begin(), nonAssignmentOperators->end(), sortOnLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +465,8 @@ void ASResource::buildOperators(vector<const string*>* operators, int fileType)
|
||||||
operators->emplace_back(&AS_LS_LS);
|
operators->emplace_back(&AS_LS_LS);
|
||||||
operators->emplace_back(&AS_QUESTION_QUESTION);
|
operators->emplace_back(&AS_QUESTION_QUESTION);
|
||||||
operators->emplace_back(&AS_LAMBDA);
|
operators->emplace_back(&AS_LAMBDA);
|
||||||
|
operators->emplace_back(&AS_THREEWAY_COMPARISION);
|
||||||
|
|
||||||
operators->emplace_back(&AS_ARROW);
|
operators->emplace_back(&AS_ARROW);
|
||||||
operators->emplace_back(&AS_AND);
|
operators->emplace_back(&AS_AND);
|
||||||
operators->emplace_back(&AS_OR);
|
operators->emplace_back(&AS_OR);
|
||||||
|
|
|
@ -273,6 +273,7 @@ public:
|
||||||
static const string AS_GCC_MIN_ASSIGN, AS_GCC_MAX_ASSIGN;
|
static const string AS_GCC_MIN_ASSIGN, AS_GCC_MAX_ASSIGN;
|
||||||
static const string AS_EQUAL, AS_PLUS_PLUS, AS_MINUS_MINUS, AS_NOT_EQUAL, AS_GR_EQUAL;
|
static const string AS_EQUAL, AS_PLUS_PLUS, AS_MINUS_MINUS, AS_NOT_EQUAL, AS_GR_EQUAL;
|
||||||
static const string AS_LS_EQUAL, AS_LS_LS_LS, AS_LS_LS, AS_GR_GR_GR, AS_GR_GR;
|
static const string AS_LS_EQUAL, AS_LS_LS_LS, AS_LS_LS, AS_GR_GR_GR, AS_GR_GR;
|
||||||
|
static const string AS_THREEWAY_COMPARISION;
|
||||||
static const string AS_QUESTION_QUESTION, AS_LAMBDA;
|
static const string AS_QUESTION_QUESTION, AS_LAMBDA;
|
||||||
static const string AS_ARROW, AS_AND, AS_OR;
|
static const string AS_ARROW, AS_AND, AS_OR;
|
||||||
static const string AS_SCOPE_RESOLUTION;
|
static const string AS_SCOPE_RESOLUTION;
|
||||||
|
|
Loading…
Reference in New Issue