From 81d88fb5bd376cb38dc51141e04998ecb9a57118 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 10 Dec 2022 20:45:13 +0800 Subject: [PATCH] work save: refactor Highlighter --- RedPandaIDE/HighlighterManager.cpp | 2 +- RedPandaIDE/cpprefacter.cpp | 2 +- RedPandaIDE/editor.cpp | 34 +++++------ RedPandaIDE/editor.h | 4 +- RedPandaIDE/todoparser.cpp | 2 +- RedPandaIDE/widgets/filepropertiesdialog.cpp | 2 +- libs/qsynedit/qsynedit/MiscProcs.cpp | 8 +-- libs/qsynedit/qsynedit/MiscProcs.h | 8 +-- libs/qsynedit/qsynedit/SynEdit.cpp | 36 ++++++------ libs/qsynedit/qsynedit/SynEdit.h | 32 +++++----- libs/qsynedit/qsynedit/TextPainter.cpp | 16 ++--- libs/qsynedit/qsynedit/TextPainter.h | 4 +- .../qsynedit/exporter/synexporter.cpp | 4 +- libs/qsynedit/qsynedit/exporter/synexporter.h | 4 +- .../qsynedit/exporter/synhtmlexporter.cpp | 16 ++--- .../qsynedit/exporter/synhtmlexporter.h | 12 ++-- libs/qsynedit/qsynedit/highlighter/asm.cpp | 10 ++-- libs/qsynedit/qsynedit/highlighter/asm.h | 18 +++--- libs/qsynedit/qsynedit/highlighter/base.cpp | 20 +++---- libs/qsynedit/qsynedit/highlighter/base.h | 37 ++++++------ .../qsynedit/highlighter/composition.cpp | 2 +- .../qsynedit/highlighter/composition.h | 4 +- libs/qsynedit/qsynedit/highlighter/cpp.cpp | 30 +++++----- libs/qsynedit/qsynedit/highlighter/cpp.h | 58 +++++++++---------- .../highlighter/customhighlighterv1.h | 6 +- libs/qsynedit/qsynedit/highlighter/glsl.cpp | 30 +++++----- libs/qsynedit/qsynedit/highlighter/glsl.h | 58 +++++++++---------- .../highlighter/makefilehighlighter.cpp | 2 +- .../highlighter/makefilehighlighter.h | 14 ++--- 29 files changed, 237 insertions(+), 238 deletions(-) diff --git a/RedPandaIDE/HighlighterManager.cpp b/RedPandaIDE/HighlighterManager.cpp index 9bb6a5f5..cdcca91e 100644 --- a/RedPandaIDE/HighlighterManager.cpp +++ b/RedPandaIDE/HighlighterManager.cpp @@ -111,7 +111,7 @@ void HighlighterManager::applyColorScheme(QSynedit::PHighlighter highlighter, co for (QString name: highlighter->attributes().keys()) { PColorSchemeItem item = pColorManager->getItem(schemeName,name); if (item) { - QSynedit::PHighlighterAttribute attr = highlighter->attributes()[name]; + QSynedit::PTokenAttribute attr = highlighter->attributes()[name]; attr->setBackground(item->background()); attr->setForeground(item->foreground()); QSynedit::FontStyles styles = QSynedit::FontStyle::fsNone; diff --git a/RedPandaIDE/cpprefacter.cpp b/RedPandaIDE/cpprefacter.cpp index 37615d98..a4f20dfc 100644 --- a/RedPandaIDE/cpprefacter.cpp +++ b/RedPandaIDE/cpprefacter.cpp @@ -226,7 +226,7 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile( while (!editor.highlighter()->eol()) { int start = editor.highlighter()->getTokenPos() + 1; QString token = editor.highlighter()->getToken(); - QSynedit::PHighlighterAttribute attr = editor.highlighter()->getTokenAttribute(); + QSynedit::PTokenAttribute attr = editor.highlighter()->getTokenAttribute(); if (attr && attr->tokenType()==QSynedit::TokenType::Identifier) { if (token == statement->command) { //same name symbol , test if the same statement; diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 8dbdceb8..63ebdd4a 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -479,7 +479,7 @@ void Editor::setPageControl(QTabWidget *newPageControl) void Editor::undoSymbolCompletion(int pos) { - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; QString token; bool tokenFinished; @@ -961,7 +961,7 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr return false; } -void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PHighlighterAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) +void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PTokenAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) { if (token.isEmpty()) return; @@ -1530,7 +1530,7 @@ void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueT QSynedit::BufferCoord p; QString token; int start; - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; PSyntaxIssueList lst; if ((line<1) || (line>document()->count())) return; @@ -1718,7 +1718,7 @@ void Editor::onStatusChanged(QSynedit::StatusChanges changes) coord.ch = ch+1; coord.line = caretY(); } - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; QString token; if (getHighlighterAttriAtRowCol(coord,token,attr) && attr->tokenType() == QSynedit::TokenType::Operator) { @@ -1969,7 +1969,7 @@ QStringList Editor::getExpressionAtPosition( if (start>ch) { break; } - QSynedit::PHighlighterAttribute attr = highlighter->getTokenAttribute(); + QSynedit::PTokenAttribute attr = highlighter->getTokenAttribute(); if ( (line == pos.line-1) && (start<=ch) && (ch<=endPos)) { if (attr->tokenType() == QSynedit::TokenType::Comment @@ -2211,7 +2211,7 @@ bool Editor::handleSymbolCompletion(QChar key) } else { QSynedit::BufferCoord HighlightPos = QSynedit::BufferCoord{caretX()-1, caretY()}; // Check if that line is highlighted as comment - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; QString token; bool tokenFinished; if (getHighlighterAttriAtRowCol(HighlightPos, token, tokenFinished, attr)) { @@ -3058,7 +3058,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete, CodeComple QString word=""; QString s; - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; bool tokenFinished; QSynedit::BufferCoord pBeginPos, pEndPos; if (getHighlighterAttriAtRowCol( @@ -3548,7 +3548,7 @@ Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos) return TipType::Error; } - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; QString s; // Only allow hand tips in highlighted areas @@ -3753,7 +3753,7 @@ void Editor::updateFunctionTip(bool showTip) while(!highlighter()->eol()) { int start = highlighter()->getTokenPos(); QString token = highlighter()->getToken(); - QSynedit::PHighlighterAttribute attr = highlighter()->getTokenAttribute(); + QSynedit::PTokenAttribute attr = highlighter()->getTokenAttribute(); if (start>=currentChar) break; @@ -3962,7 +3962,7 @@ void Editor::popUserCodeInTabStops() } } -void Editor::onExportedFormatToken(QSynedit::PHighlighter syntaxHighlighter, int Line, int column, const QString &token, QSynedit::PHighlighterAttribute& attr) +void Editor::onExportedFormatToken(QSynedit::PHighlighter syntaxHighlighter, int Line, int column, const QString &token, QSynedit::PTokenAttribute& attr) { if (!syntaxHighlighter) return; @@ -4812,16 +4812,16 @@ void Editor::applySettings() invalidate(); } -static QSynedit::PHighlighterAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) { +static QSynedit::PTokenAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) { PColorSchemeItem item = pColorManager->getItem(schemeName,schemeItemName); if (item) { - QSynedit::PHighlighterAttribute attr = std::make_shared(attrName, + QSynedit::PTokenAttribute attr = std::make_shared(attrName, QSynedit::TokenType::Default); attr->setForeground(item->foreground()); attr->setBackground(item->background()); return attr; } - return QSynedit::PHighlighterAttribute(); + return QSynedit::PTokenAttribute(); } void Editor::applyColorScheme(const QString& schemeName) { @@ -4832,13 +4832,13 @@ void Editor::applyColorScheme(const QString& schemeName) setOptions(options); highlighterManager.applyColorScheme(highlighter(),schemeName); if (pSettings->editor().rainbowParenthesis()) { - QSynedit::PHighlighterAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PTokenAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_1); - QSynedit::PHighlighterAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PTokenAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_2); - QSynedit::PHighlighterAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PTokenAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_3); - QSynedit::PHighlighterAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PTokenAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_4); setRainbowAttrs(attr0,attr1,attr2,attr3); } diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index c9e9e168..e95f4e67 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -291,7 +291,7 @@ private: void clearUserCodeInTabStops(); void popUserCodeInTabStops(); void onExportedFormatToken(QSynedit::PHighlighter syntaxHighlighter, int Line, int column, const QString& token, - QSynedit::PHighlighterAttribute &attr); + QSynedit::PTokenAttribute &attr); void onScrollBarValueChanged(); static PCppParser sharedParser(ParserLanguage language); private: @@ -364,7 +364,7 @@ protected: // SynEdit interface protected: - void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PHighlighterAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) override; + void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PTokenAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) override; // QObject interface public: diff --git a/RedPandaIDE/todoparser.cpp b/RedPandaIDE/todoparser.cpp index 0ba5dce7..9e6c61d3 100644 --- a/RedPandaIDE/todoparser.cpp +++ b/RedPandaIDE/todoparser.cpp @@ -133,7 +133,7 @@ void TodoThread::doParseFile(const QString &filename, QSynedit::PHighlighter hig for (int i =0;isetLine(lines[i],i); while (!highlighter->eol()) { - QSynedit::PHighlighterAttribute attr; + QSynedit::PTokenAttribute attr; attr = highlighter->getTokenAttribute(); if (attr && attr->tokenType() == QSynedit::TokenType::Comment) { QString token = highlighter->getToken(); diff --git a/RedPandaIDE/widgets/filepropertiesdialog.cpp b/RedPandaIDE/widgets/filepropertiesdialog.cpp index fef7b75a..fd627978 100644 --- a/RedPandaIDE/widgets/filepropertiesdialog.cpp +++ b/RedPandaIDE/widgets/filepropertiesdialog.cpp @@ -56,7 +56,7 @@ void FilePropertiesDialog::calcFile(Editor *editor, while (jgetHighlighterAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1}, token,attr)) { // if it is preprocessor... diff --git a/libs/qsynedit/qsynedit/MiscProcs.cpp b/libs/qsynedit/qsynedit/MiscProcs.cpp index 061a777d..4a7f4769 100644 --- a/libs/qsynedit/qsynedit/MiscProcs.cpp +++ b/libs/qsynedit/qsynedit/MiscProcs.cpp @@ -44,7 +44,7 @@ int getEOL(const QString &Line, int start) bool internalEnumHighlighterAttris(PHighlighter Highlighter, bool SkipDuplicates, - HighlighterAttriProc highlighterAttriProc, + TokenAttributeProc highlighterAttriProc, std::initializer_list& Params, HighlighterList& HighlighterList) { bool Result = true; @@ -55,7 +55,7 @@ bool internalEnumHighlighterAttris(PHighlighter Highlighter, HighlighterList.append(Highlighter); } if (Highlighter) { - for (PHighlighterAttribute pAttr: Highlighter->attributes()){ + for (PTokenAttribute pAttr: Highlighter->attributes()){ QString UniqueAttriName = Highlighter->languageName() + QString("%1").arg(HighlighterList.indexOf(Highlighter)) + '.' + pAttr->name(); @@ -68,8 +68,8 @@ bool internalEnumHighlighterAttris(PHighlighter Highlighter, return Result; } -bool enumHighlighterAttributes(PHighlighter Highlighter, bool SkipDuplicates, - HighlighterAttriProc highlighterAttriProc, +bool enumTokenAttributes(PHighlighter Highlighter, bool SkipDuplicates, + TokenAttributeProc highlighterAttriProc, std::initializer_list Params) { if (!Highlighter || !highlighterAttriProc) { diff --git a/libs/qsynedit/qsynedit/MiscProcs.h b/libs/qsynedit/qsynedit/MiscProcs.h index 0a4854cc..142ddc4d 100644 --- a/libs/qsynedit/qsynedit/MiscProcs.h +++ b/libs/qsynedit/qsynedit/MiscProcs.h @@ -46,15 +46,15 @@ QStringList splitStrings(const QString& text); int calSpanLines(const BufferCoord& startPos, const BufferCoord& endPos); -using HighlighterAttriProc = std::function Params)>; // Enums all child highlighters and their attributes of a TSynMultiSyn through a // callback function. // This function also handles nested TSynMultiSyns including their MarkerAttri. -bool enumHighlighterAttributes(PHighlighter Highlighter, - bool SkipDuplicates, HighlighterAttriProc highlighterAttriProc, +bool enumTokenAttributes(PHighlighter Highlighter, + bool SkipDuplicates, TokenAttributeProc highlighterAttriProc, std::initializer_list Params); FontStyles getFontStyles(const QFont& font); diff --git a/libs/qsynedit/qsynedit/SynEdit.cpp b/libs/qsynedit/qsynedit/SynEdit.cpp index 9977b855..510c377e 100644 --- a/libs/qsynedit/qsynedit/SynEdit.cpp +++ b/libs/qsynedit/qsynedit/SynEdit.cpp @@ -357,13 +357,13 @@ int SynEdit::maxScrollWidth() const return std::max(maxLen-mCharsInWindow+1, 1); } -bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, PHighlighterAttribute &attri) +bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, PTokenAttribute &attri) { int tmpStart; return getHighlighterAttriAtRowColEx(pos, token, tmpStart, attri); } -bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, bool &tokenFinished, PHighlighterAttribute &attri) +bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token, bool &tokenFinished, PTokenAttribute &attri) { int posX, posY, endPos, start; QString line; @@ -395,12 +395,12 @@ bool SynEdit::getHighlighterAttriAtRowCol(const BufferCoord &pos, QString &token } } token = ""; - attri = PHighlighterAttribute(); + attri = PTokenAttribute(); tokenFinished = false; return false; } -bool SynEdit::getHighlighterAttriAtRowColEx(const BufferCoord &pos, QString &token, int &start, PHighlighterAttribute &attri) +bool SynEdit::getHighlighterAttriAtRowColEx(const BufferCoord &pos, QString &token, int &start, PTokenAttribute &attri) { int posX, posY, endPos; QString line; @@ -428,7 +428,7 @@ bool SynEdit::getHighlighterAttriAtRowColEx(const BufferCoord &pos, QString &tok } } token = ""; - attri = PHighlighterAttribute(); + attri = PTokenAttribute(); return false; } @@ -485,7 +485,7 @@ BufferCoord SynEdit::getMatchingBracketEx(BufferCoord APoint) QChar Test, BracketInc, BracketDec; int NumBrackets; QString vDummy; - PHighlighterAttribute attr; + PTokenAttribute attr; BufferCoord p; bool isCommentOrStringOrChar; int nBrackets = sizeof(Brackets) / sizeof(QChar); @@ -1264,7 +1264,7 @@ BufferCoord SynEdit::getPreviousLeftBrace(int x, int y) { QChar Test; QString vDummy; - PHighlighterAttribute attr; + PTokenAttribute attr; BufferCoord p; bool isCommentOrStringOrChar; BufferCoord Result{0,0}; @@ -1587,7 +1587,7 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) } SyntaxerState rangeAfterFirstToken = mHighlighter->getState(); QString firstToken = mHighlighter->getToken(); - PHighlighterAttribute attr = mHighlighter->getTokenAttribute(); + PTokenAttribute attr = mHighlighter->getTokenAttribute(); if (attr->tokenType() == TokenType::Keyword && lineText.endsWith(':') && ( @@ -1720,7 +1720,7 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) if (!indentAdded && !startLineText.isEmpty()) { BufferCoord coord; QString token; - PHighlighterAttribute attr; + PTokenAttribute attr; coord.line = startLine; coord.ch = document()->getString(startLine-1).length(); if (getHighlighterAttriAtRowCol(coord,token,attr) @@ -2413,7 +2413,7 @@ void SynEdit::insertLine(bool moveCaret) QString Temp2 = Temp; QString Temp3; - PHighlighterAttribute Attr; + PTokenAttribute Attr; // This is sloppy, but the Right Thing would be to track the column of markers // too, so they could be moved depending on whether they are after the caret... @@ -3296,7 +3296,7 @@ void SynEdit::recalcCharExtent() bool hasStyles[] = {false,false,false,false}; int size = 4; if (mHighlighter && mHighlighter->attributes().count()>0) { - for (const PHighlighterAttribute& attribute: mHighlighter->attributes()) { + for (const PTokenAttribute& attribute: mHighlighter->attributes()) { for (int i=0;istyles().testFlag(styles[i])) hasStyles[i] = true; @@ -3631,7 +3631,7 @@ int SynEdit::lineHasChar(int Line, int startChar, QChar character, const QString QString token; while (!mHighlighter->eol()) { token = mHighlighter->getToken(); - PHighlighterAttribute attr = mHighlighter->getTokenAttribute(); + PTokenAttribute attr = mHighlighter->getTokenAttribute(); if (token == character && attr->name()==highlighterAttrName) return mHighlighter->getTokenPos(); mHighlighter->next(); @@ -3998,22 +3998,22 @@ void SynEdit::setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed) mMouseWheelScrollSpeed = newMouseWheelScrollSpeed; } -const PHighlighterAttribute &SynEdit::rainbowAttr3() const +const PTokenAttribute &SynEdit::rainbowAttr3() const { return mRainbowAttr3; } -const PHighlighterAttribute &SynEdit::rainbowAttr2() const +const PTokenAttribute &SynEdit::rainbowAttr2() const { return mRainbowAttr2; } -const PHighlighterAttribute &SynEdit::rainbowAttr1() const +const PTokenAttribute &SynEdit::rainbowAttr1() const { return mRainbowAttr1; } -const PHighlighterAttribute &SynEdit::rainbowAttr0() const +const PTokenAttribute &SynEdit::rainbowAttr0() const { return mRainbowAttr0; } @@ -5687,7 +5687,7 @@ void SynEdit::onPaint(QPainter &) } void SynEdit::onPreparePaintHighlightToken(int , int , const QString &, - PHighlighterAttribute , FontStyles &, QColor &, QColor &) + PTokenAttribute , FontStyles &, QColor &, QColor &) { } @@ -6002,7 +6002,7 @@ bool SynEdit::isIdentChar(const QChar &ch) } } -void SynEdit::setRainbowAttrs(const PHighlighterAttribute &attr0, const PHighlighterAttribute &attr1, const PHighlighterAttribute &attr2, const PHighlighterAttribute &attr3) +void SynEdit::setRainbowAttrs(const PTokenAttribute &attr0, const PTokenAttribute &attr1, const PTokenAttribute &attr2, const PTokenAttribute &attr3) { mRainbowAttr0 = attr0; mRainbowAttr1 = attr1; diff --git a/libs/qsynedit/qsynedit/SynEdit.h b/libs/qsynedit/qsynedit/SynEdit.h index 1a980bee..9e61f403 100644 --- a/libs/qsynedit/qsynedit/SynEdit.h +++ b/libs/qsynedit/qsynedit/SynEdit.h @@ -248,11 +248,11 @@ public: int maxScrollHeight() const; bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token, - PHighlighterAttribute& attri); + PTokenAttribute& attri); bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token, - bool& tokenFinished, PHighlighterAttribute& attri); + bool& tokenFinished, PTokenAttribute& attri); bool getHighlighterAttriAtRowColEx(const BufferCoord& pos, QString& token, - int &start, PHighlighterAttribute& attri); + int &start, PTokenAttribute& attri); void beginUndoBlock(); void endUndoBlock(); @@ -301,10 +301,10 @@ public: bool pointToLine(const QPoint& point, int& line); bool isIdentChar(const QChar& ch); - void setRainbowAttrs(const PHighlighterAttribute &attr0, - const PHighlighterAttribute &attr1, - const PHighlighterAttribute &attr2, - const PHighlighterAttribute &attr3); + void setRainbowAttrs(const PTokenAttribute &attr0, + const PTokenAttribute &attr1, + const PTokenAttribute &attr2, + const PTokenAttribute &attr3); void updateMouseCursor(); @@ -411,13 +411,13 @@ public: bool caretUseTextColor() const; void setCaretUseTextColor(bool newCaretUseTextColor); - const PHighlighterAttribute &rainbowAttr0() const; + const PTokenAttribute &rainbowAttr0() const; - const PHighlighterAttribute &rainbowAttr1() const; + const PTokenAttribute &rainbowAttr1() const; - const PHighlighterAttribute &rainbowAttr2() const; + const PTokenAttribute &rainbowAttr2() const; - const PHighlighterAttribute &rainbowAttr3() const; + const PTokenAttribute &rainbowAttr3() const; int mouseWheelScrollSpeed() const; void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed); @@ -463,7 +463,7 @@ protected: virtual void onGutterPaint(QPainter& painter, int aLine, int X, int Y); virtual void onPaint(QPainter& painter); virtual void onPreparePaintHighlightToken(int line, - int aChar, const QString& token, PHighlighterAttribute attr, + int aChar, const QString& token, PTokenAttribute attr, FontStyles& style, QColor& foreground, QColor& background); virtual void onProcessCommand(EditCommand command, QChar car, void * pData); virtual void onCommandProcessed(EditCommand command, QChar car, void * pData); @@ -673,10 +673,10 @@ private: QColor mForegroundColor; QColor mBackgroundColor; QColor mCaretColor; - PHighlighterAttribute mRainbowAttr0; - PHighlighterAttribute mRainbowAttr1; - PHighlighterAttribute mRainbowAttr2; - PHighlighterAttribute mRainbowAttr3; + PTokenAttribute mRainbowAttr0; + PTokenAttribute mRainbowAttr1; + PTokenAttribute mRainbowAttr2; + PTokenAttribute mRainbowAttr3; bool mCaretUseTextColor; QColor mActiveLineColor; diff --git a/libs/qsynedit/qsynedit/TextPainter.cpp b/libs/qsynedit/qsynedit/TextPainter.cpp index 39c65492..23edfdb2 100644 --- a/libs/qsynedit/qsynedit/TextPainter.cpp +++ b/libs/qsynedit/qsynedit/TextPainter.cpp @@ -592,7 +592,7 @@ bool SynEditTextPainter::tokenIsSpaces(bool &bSpacesTest, const QString& token, // record. This will paint any chars already stored if there is // a (visible) change in the attributes. void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefore, - int tokenColumns, int cLine, PHighlighterAttribute p_Attri) + int tokenColumns, int cLine, PTokenAttribute p_Attri) { bool bCanAppend; QColor foreground, background; @@ -704,12 +704,12 @@ void SynEditTextPainter::paintFoldAttributes() indentLevel++ ; if (edit->mHighlighter) { if (edit->mCodeFolding.indentGuides) { - PHighlighterAttribute attr = edit->mHighlighter->symbolAttribute(); + PTokenAttribute attr = edit->mHighlighter->symbolAttribute(); getBraceColorAttr(indentLevel,attr); paintColor = attr->foreground(); } if (edit->mCodeFolding.fillIndents) { - PHighlighterAttribute attr = edit->mHighlighter->symbolAttribute(); + PTokenAttribute attr = edit->mHighlighter->symbolAttribute(); getBraceColorAttr(indentLevel,attr); gradientStart=attr->foreground(); attr = edit->mHighlighter->symbolAttribute(); @@ -762,13 +762,13 @@ void SynEditTextPainter::paintFoldAttributes() } -void SynEditTextPainter::getBraceColorAttr(int level, PHighlighterAttribute &attr) +void SynEditTextPainter::getBraceColorAttr(int level, PTokenAttribute &attr) { if (!edit->mOptions.testFlag(EditorOption::eoShowRainbowColor)) return; if (attr->tokenType() != TokenType::Operator) return; - PHighlighterAttribute oldAttr = attr; + PTokenAttribute oldAttr = attr; switch(level % 4) { case 0: attr = edit->mRainbowAttr0; @@ -794,12 +794,12 @@ void SynEditTextPainter::paintLines() QString sLine; // the current line QString sToken; // highlighter token info int nTokenColumnsBefore, nTokenColumnLen; - PHighlighterAttribute attr; + PTokenAttribute attr; int vFirstChar; int vLastChar; EditingAreaList areaList; PCodeFoldingRange foldRange; - PHighlighterAttribute preeditAttr; + PTokenAttribute preeditAttr; int nFold; QString sFold; @@ -1026,7 +1026,7 @@ void SynEditTextPainter::paintLines() if (nTokenColumnLen > 0) { sToken = edit->substringByColumns(sLine,nTokenColumnsBefore+1,nTokenColumnLen); addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol), - nTokenColumnLen, vLine, PHighlighterAttribute()); + nTokenColumnLen, vLine, PTokenAttribute()); } } // Draw LineBreak glyph. diff --git a/libs/qsynedit/qsynedit/TextPainter.h b/libs/qsynedit/qsynedit/TextPainter.h index ea85e680..a320ec4d 100644 --- a/libs/qsynedit/qsynedit/TextPainter.h +++ b/libs/qsynedit/qsynedit/TextPainter.h @@ -55,10 +55,10 @@ private: void paintHighlightToken(bool bFillToEOL); bool tokenIsSpaces(bool& bSpacesTest, const QString& token, bool& bIsSpaces); void addHighlightToken(const QString& token, int columnsBefore, int tokenColumns, - int cLine, PHighlighterAttribute p_Attri); + int cLine, PTokenAttribute p_Attri); void paintFoldAttributes(); - void getBraceColorAttr(int level, PHighlighterAttribute &attr); + void getBraceColorAttr(int level, PTokenAttribute &attr); void paintLines(); private: diff --git a/libs/qsynedit/qsynedit/exporter/synexporter.cpp b/libs/qsynedit/qsynedit/exporter/synexporter.cpp index c1f321ec..7caa19a9 100644 --- a/libs/qsynedit/qsynedit/exporter/synexporter.cpp +++ b/libs/qsynedit/qsynedit/exporter/synexporter.cpp @@ -90,7 +90,7 @@ void SynExporter::ExportRange(PDocument ALines, BufferCoord Start, BufferCoord S // export the line mHighlighter->setLine(Line, i); while (!mHighlighter->eol()) { - PHighlighterAttribute attri = mHighlighter->getTokenAttribute(); + PTokenAttribute attri = mHighlighter->getTokenAttribute(); int startPos = mHighlighter->getTokenPos(); QString token = mHighlighter->getToken(); if (i==Start.line && (startPos+token.length() < Start.ch)) { @@ -338,7 +338,7 @@ static QColor ValidatedColor(const QColor& color, const QColor& defaultColor) { else return defaultColor; } -void SynExporter::SetTokenAttribute(PHighlighterAttribute Attri) +void SynExporter::SetTokenAttribute(PTokenAttribute Attri) { if (mFirstAttribute) { mFirstAttribute = false; diff --git a/libs/qsynedit/qsynedit/exporter/synexporter.h b/libs/qsynedit/qsynedit/exporter/synexporter.h index e7f15a84..7d9f40fc 100644 --- a/libs/qsynedit/qsynedit/exporter/synexporter.h +++ b/libs/qsynedit/qsynedit/exporter/synexporter.h @@ -22,7 +22,7 @@ namespace QSynedit { using FormatTokenHandler = std::function; + PTokenAttribute& attr)>; class SynExporter { @@ -236,7 +236,7 @@ protected: * added to the output buffer. * @param Attri */ - virtual void SetTokenAttribute(PHighlighterAttribute Attri); + virtual void SetTokenAttribute(PTokenAttribute Attri); QTextCodec *getCodec(); private: diff --git a/libs/qsynedit/qsynedit/exporter/synhtmlexporter.cpp b/libs/qsynedit/qsynedit/exporter/synhtmlexporter.cpp index 97476879..09805f7d 100644 --- a/libs/qsynedit/qsynedit/exporter/synhtmlexporter.cpp +++ b/libs/qsynedit/qsynedit/exporter/synhtmlexporter.cpp @@ -45,7 +45,7 @@ void SynHTMLExporter::setCreateHTMLFragment(bool createHTMLFragment) mCreateHTMLFragment = createHTMLFragment; } -QString SynHTMLExporter::AttriToCSS(PHighlighterAttribute Attri, const QString &UniqueAttriName) +QString SynHTMLExporter::AttriToCSS(PTokenAttribute Attri, const QString &UniqueAttriName) { QString StyleName = MakeValidName(UniqueAttriName); @@ -67,7 +67,7 @@ QString SynHTMLExporter::AttriToCSS(PHighlighterAttribute Attri, const QString & return Result; } -bool SynHTMLExporter::AttriToCSSCallback(PHighlighter , PHighlighterAttribute Attri, const QString& UniqueAttriName, QList params) +bool SynHTMLExporter::AttriToCSSCallback(PHighlighter , PTokenAttribute Attri, const QString& UniqueAttriName, QList params) { QString& styles = *static_cast(params[0]); styles.append(AttriToCSS(Attri,UniqueAttriName) + lineBreak()); @@ -79,10 +79,10 @@ QString SynHTMLExporter::ColorToHTML(const QColor &AColor) return AColor.name(); } -QString SynHTMLExporter::GetStyleName(PHighlighter Highlighter, PHighlighterAttribute Attri) +QString SynHTMLExporter::GetStyleName(PHighlighter Highlighter, PTokenAttribute Attri) { QString result; - enumHighlighterAttributes(Highlighter,false, + enumTokenAttributes(Highlighter,false, std::bind( &SynHTMLExporter::StyleNameCallback,this, std::placeholders::_1, std::placeholders::_2, @@ -104,9 +104,9 @@ QString SynHTMLExporter::MakeValidName(const QString &Name) return Result; } -bool SynHTMLExporter::StyleNameCallback(PHighlighter /*Highlighter*/, PHighlighterAttribute Attri, const QString& UniqueAttriName, QList params) +bool SynHTMLExporter::StyleNameCallback(PHighlighter /*Highlighter*/, PTokenAttribute Attri, const QString& UniqueAttriName, QList params) { - PHighlighterAttribute& AttriToFind = *static_cast(params[0]); + PTokenAttribute& AttriToFind = *static_cast(params[0]); QString& StyleName = *static_cast(params[1]); if (Attri == AttriToFind) { @@ -164,7 +164,7 @@ QString SynHTMLExporter::GetHeader() { using namespace std::placeholders; QString Styles; - enumHighlighterAttributes(mHighlighter, true, + enumTokenAttributes(mHighlighter, true, std::bind(&SynHTMLExporter::AttriToCSSCallback, this, _1, _2, _3, _4), {&Styles}); @@ -222,7 +222,7 @@ QString SynHTMLExporter::GetHeader() return Result; } -void SynHTMLExporter::SetTokenAttribute(PHighlighterAttribute Attri) +void SynHTMLExporter::SetTokenAttribute(PTokenAttribute Attri) { mLastAttri = Attri; SynExporter::SetTokenAttribute(Attri); diff --git a/libs/qsynedit/qsynedit/exporter/synhtmlexporter.h b/libs/qsynedit/qsynedit/exporter/synhtmlexporter.h index d20b6f82..56e033fc 100644 --- a/libs/qsynedit/qsynedit/exporter/synhtmlexporter.h +++ b/libs/qsynedit/qsynedit/exporter/synhtmlexporter.h @@ -30,15 +30,15 @@ public: protected: bool mCreateHTMLFragment; private: - PHighlighterAttribute mLastAttri; - QString AttriToCSS(PHighlighterAttribute Attri, const QString& UniqueAttriName); - bool AttriToCSSCallback(PHighlighter Highlighter, PHighlighterAttribute Attri, + PTokenAttribute mLastAttri; + QString AttriToCSS(PTokenAttribute Attri, const QString& UniqueAttriName); + bool AttriToCSSCallback(PHighlighter Highlighter, PTokenAttribute Attri, const QString& UniqueAttriName, QList params); QString ColorToHTML(const QColor &AColor); QString GetStyleName(PHighlighter Highlighter, - PHighlighterAttribute Attri); + PTokenAttribute Attri); QString MakeValidName(const QString &Name); - bool StyleNameCallback(PHighlighter Highlighter, PHighlighterAttribute Attri, + bool StyleNameCallback(PHighlighter Highlighter, PTokenAttribute Attri, const QString& UniqueAttriName, QList params); // SynExporter interface @@ -51,7 +51,7 @@ protected: QString GetFooter(); QString GetFormatName(); QString GetHeader(); - void SetTokenAttribute(PHighlighterAttribute Attri); + void SetTokenAttribute(PTokenAttribute Attri); }; } #endif // SYNHTMLEXPORTER_H diff --git a/libs/qsynedit/qsynedit/highlighter/asm.cpp b/libs/qsynedit/qsynedit/highlighter/asm.cpp index a87c3455..354cfcac 100644 --- a/libs/qsynedit/qsynedit/highlighter/asm.cpp +++ b/libs/qsynedit/qsynedit/highlighter/asm.cpp @@ -108,12 +108,12 @@ ASMHighlighter::ASMHighlighter() addAttribute(mRegisterAttribute); } -const PHighlighterAttribute &ASMHighlighter::numberAttribute() const +const PTokenAttribute &ASMHighlighter::numberAttribute() const { return mNumberAttribute; } -const PHighlighterAttribute &ASMHighlighter::registerAttribute() const +const PTokenAttribute &ASMHighlighter::registerAttribute() const { return mRegisterAttribute; } @@ -308,7 +308,7 @@ QString ASMHighlighter::getToken() const return mLineString.mid(mTokenPos,mRun-mTokenPos); } -const PHighlighterAttribute &ASMHighlighter::getTokenAttribute() const +const PTokenAttribute &ASMHighlighter::getTokenAttribute() const { switch(mTokenID) { case TokenId::Comment: @@ -459,12 +459,12 @@ QSet ASMHighlighter::keywords() const return Keywords; } -const PHighlighterAttribute &ASMHighlighter::directiveAttribute() const +const PTokenAttribute &ASMHighlighter::directiveAttribute() const { return mDirectiveAttribute; } -const PHighlighterAttribute &ASMHighlighter::labelAttribute() const +const PTokenAttribute &ASMHighlighter::labelAttribute() const { return mLabelAttribute; } diff --git a/libs/qsynedit/qsynedit/highlighter/asm.h b/libs/qsynedit/qsynedit/highlighter/asm.h index 3db8b4cb..6c2fae63 100644 --- a/libs/qsynedit/qsynedit/highlighter/asm.h +++ b/libs/qsynedit/qsynedit/highlighter/asm.h @@ -45,10 +45,10 @@ class ASMHighlighter : public Highlighter public: explicit ASMHighlighter(); - const PHighlighterAttribute &numberAttribute() const; - const PHighlighterAttribute &directiveAttribute() const; - const PHighlighterAttribute &labelAttribute() const; - const PHighlighterAttribute ®isterAttribute() const; + const PTokenAttribute &numberAttribute() const; + const PTokenAttribute &directiveAttribute() const; + const PTokenAttribute &labelAttribute() const; + const PTokenAttribute ®isterAttribute() const; static const QSet Keywords; static const QSet Registers; @@ -61,10 +61,10 @@ private: QChar mToIdent; int mTokenPos; TokenId mTokenID; - PHighlighterAttribute mNumberAttribute; - PHighlighterAttribute mDirectiveAttribute; - PHighlighterAttribute mRegisterAttribute; - PHighlighterAttribute mLabelAttribute; + PTokenAttribute mNumberAttribute; + PTokenAttribute mDirectiveAttribute; + PTokenAttribute mRegisterAttribute; + PTokenAttribute mLabelAttribute; private: void CommentProc(); @@ -90,7 +90,7 @@ public: QString languageName() override; ProgrammingLanguage language() override; QString getToken() const override; - const PHighlighterAttribute &getTokenAttribute() const override; + const PTokenAttribute &getTokenAttribute() const override; int getTokenPos() override; void next() override; void setLine(const QString &newLine, int lineNumber) override; diff --git a/libs/qsynedit/qsynedit/highlighter/base.cpp b/libs/qsynedit/qsynedit/highlighter/base.cpp index 44bb6441..49ae32cb 100644 --- a/libs/qsynedit/qsynedit/highlighter/base.cpp +++ b/libs/qsynedit/qsynedit/highlighter/base.cpp @@ -42,7 +42,7 @@ Highlighter::Highlighter() : addAttribute(mSymbolAttribute); } -const QMap& Highlighter::attributes() const +const QMap& Highlighter::attributes() const { return mAttributes; } @@ -52,32 +52,32 @@ const QSet& Highlighter::wordBreakChars() const return mWordBreakChars; } -const PHighlighterAttribute& Highlighter::identifierAttribute() const +const PTokenAttribute& Highlighter::identifierAttribute() const { return mIdentifierAttribute; } -const PHighlighterAttribute &Highlighter::keywordAttribute() const +const PTokenAttribute &Highlighter::keywordAttribute() const { return mKeywordAttribute; } -const PHighlighterAttribute &Highlighter::commentAttribute() const +const PTokenAttribute &Highlighter::commentAttribute() const { return mCommentAttribute; } -const PHighlighterAttribute& Highlighter::stringAttribute() const +const PTokenAttribute& Highlighter::stringAttribute() const { return mStringAttribute; } -const PHighlighterAttribute& Highlighter::whitespaceAttribute() const +const PTokenAttribute& Highlighter::whitespaceAttribute() const { return mWhitespaceAttribute; } -const PHighlighterAttribute& Highlighter::symbolAttribute() const +const PTokenAttribute& Highlighter::symbolAttribute() const { return mSymbolAttribute; } @@ -164,7 +164,7 @@ bool Highlighter::isIdentChar(const QChar &ch) const return false; } -void Highlighter::addAttribute(PHighlighterAttribute attribute) +void Highlighter::addAttribute(PTokenAttribute attribute) { mAttributes[attribute->name()]=attribute; } @@ -179,9 +179,9 @@ int Highlighter::attributesCount() const return mAttributes.size(); } -PHighlighterAttribute Highlighter::getAttribute(const QString& name) const +PTokenAttribute Highlighter::getAttribute(const QString& name) const { - return mAttributes.value(name,PHighlighterAttribute()); + return mAttributes.value(name,PTokenAttribute()); } bool Highlighter::enabled() const diff --git a/libs/qsynedit/qsynedit/highlighter/base.h b/libs/qsynedit/qsynedit/highlighter/base.h index b1df2dae..86d421e6 100644 --- a/libs/qsynedit/qsynedit/highlighter/base.h +++ b/libs/qsynedit/qsynedit/highlighter/base.h @@ -113,28 +113,27 @@ private: TokenType mTokenType; }; -typedef std::shared_ptr PHighlighterAttribute; -using HighlighterAttributeList = QVector; +typedef std::shared_ptr PTokenAttribute; class Highlighter { public: explicit Highlighter(); - const QMap& attributes() const; + const QMap& attributes() const; const QSet& wordBreakChars() const; - const PHighlighterAttribute& identifierAttribute() const; + const PTokenAttribute& identifierAttribute() const; - const PHighlighterAttribute& keywordAttribute() const; + const PTokenAttribute& keywordAttribute() const; - const PHighlighterAttribute& commentAttribute() const; + const PTokenAttribute& commentAttribute() const; - const PHighlighterAttribute& stringAttribute() const; + const PTokenAttribute& stringAttribute() const; - const PHighlighterAttribute& whitespaceAttribute() const; + const PTokenAttribute& whitespaceAttribute() const; - const PHighlighterAttribute& symbolAttribute() const; + const PTokenAttribute& symbolAttribute() const; virtual bool isIdentChar(const QChar& ch) const; @@ -144,7 +143,7 @@ public: virtual bool eol() const = 0; virtual SyntaxerState getState() const = 0; virtual QString getToken() const=0; - virtual const PHighlighterAttribute &getTokenAttribute() const=0; + virtual const PTokenAttribute &getTokenAttribute() const=0; virtual int getTokenPos() = 0; virtual bool isKeyword(const QString& word); virtual void next() = 0; @@ -164,22 +163,22 @@ public: virtual bool isWordBreakChar(const QChar& ch); bool enabled() const; void setEnabled(bool value); - virtual PHighlighterAttribute getAttribute(const QString& name) const; + virtual PTokenAttribute getAttribute(const QString& name) const; protected: - PHighlighterAttribute mCommentAttribute; - PHighlighterAttribute mIdentifierAttribute; - PHighlighterAttribute mKeywordAttribute; - PHighlighterAttribute mStringAttribute; - PHighlighterAttribute mWhitespaceAttribute; - PHighlighterAttribute mSymbolAttribute; + PTokenAttribute mCommentAttribute; + PTokenAttribute mIdentifierAttribute; + PTokenAttribute mKeywordAttribute; + PTokenAttribute mStringAttribute; + PTokenAttribute mWhitespaceAttribute; + PTokenAttribute mSymbolAttribute; - void addAttribute(PHighlighterAttribute attribute); + void addAttribute(PTokenAttribute attribute); void clearAttributes(); virtual int attributesCount() const; private: - QMap mAttributes; + QMap mAttributes; bool mEnabled; QSet mWordBreakChars; }; diff --git a/libs/qsynedit/qsynedit/highlighter/composition.cpp b/libs/qsynedit/qsynedit/highlighter/composition.cpp index 5aae8811..1b243fd5 100644 --- a/libs/qsynedit/qsynedit/highlighter/composition.cpp +++ b/libs/qsynedit/qsynedit/highlighter/composition.cpp @@ -59,7 +59,7 @@ void HighlighterSchema::setHighlighter(const PHighlighter &highlighter) mHighlighter = highlighter; } -PHighlighterAttribute HighlighterSchema::getMarkerAttribute() const +PTokenAttribute HighlighterSchema::getMarkerAttribute() const { return mMarkerAttribute; } diff --git a/libs/qsynedit/qsynedit/highlighter/composition.h b/libs/qsynedit/qsynedit/highlighter/composition.h index 35716221..ae6a0f70 100644 --- a/libs/qsynedit/qsynedit/highlighter/composition.h +++ b/libs/qsynedit/qsynedit/highlighter/composition.h @@ -40,7 +40,7 @@ public: PHighlighter getHighlighter() const; void setHighlighter(const PHighlighter &highlighter); - PHighlighterAttribute getMarkerAttribute() const; + PTokenAttribute getMarkerAttribute() const; QString getSchemeName() const; void setSchemeName(const QString &schemeName); @@ -52,7 +52,7 @@ private: QString mEndExpr; QString StartExpr; PHighlighter mHighlighter; - PHighlighterAttribute mMarkerAttribute; + PTokenAttribute mMarkerAttribute; QString mSchemeName; int mCaseSensitive; // OnCheckMarker mOnCheckStartMarker; diff --git a/libs/qsynedit/qsynedit/highlighter/cpp.cpp b/libs/qsynedit/qsynedit/highlighter/cpp.cpp index 75cbda60..5eec859f 100644 --- a/libs/qsynedit/qsynedit/highlighter/cpp.cpp +++ b/libs/qsynedit/qsynedit/highlighter/cpp.cpp @@ -190,72 +190,72 @@ CppHighlighter::CppHighlighter(): Highlighter() resetState(); } -const PHighlighterAttribute &CppHighlighter::asmAttribute() const +const PTokenAttribute &CppHighlighter::asmAttribute() const { return mAsmAttribute; } -const PHighlighterAttribute &CppHighlighter::preprocessorAttribute() const +const PTokenAttribute &CppHighlighter::preprocessorAttribute() const { return mPreprocessorAttribute; } -const PHighlighterAttribute &CppHighlighter::invalidAttribute() const +const PTokenAttribute &CppHighlighter::invalidAttribute() const { return mInvalidAttribute; } -const PHighlighterAttribute &CppHighlighter::numberAttribute() const +const PTokenAttribute &CppHighlighter::numberAttribute() const { return mNumberAttribute; } -const PHighlighterAttribute &CppHighlighter::floatAttribute() const +const PTokenAttribute &CppHighlighter::floatAttribute() const { return mFloatAttribute; } -const PHighlighterAttribute &CppHighlighter::hexAttribute() const +const PTokenAttribute &CppHighlighter::hexAttribute() const { return mHexAttribute; } -const PHighlighterAttribute &CppHighlighter::octAttribute() const +const PTokenAttribute &CppHighlighter::octAttribute() const { return mOctAttribute; } -const PHighlighterAttribute &CppHighlighter::stringEscapeSequenceAttribute() const +const PTokenAttribute &CppHighlighter::stringEscapeSequenceAttribute() const { return mStringEscapeSequenceAttribute; } -const PHighlighterAttribute &CppHighlighter::charAttribute() const +const PTokenAttribute &CppHighlighter::charAttribute() const { return mCharAttribute; } -const PHighlighterAttribute &CppHighlighter::variableAttribute() const +const PTokenAttribute &CppHighlighter::variableAttribute() const { return mVariableAttribute; } -const PHighlighterAttribute &CppHighlighter::functionAttribute() const +const PTokenAttribute &CppHighlighter::functionAttribute() const { return mFunctionAttribute; } -const PHighlighterAttribute &CppHighlighter::classAttribute() const +const PTokenAttribute &CppHighlighter::classAttribute() const { return mClassAttribute; } -const PHighlighterAttribute &CppHighlighter::globalVarAttribute() const +const PTokenAttribute &CppHighlighter::globalVarAttribute() const { return mGlobalVarAttribute; } -const PHighlighterAttribute &CppHighlighter::localVarAttribute() const +const PTokenAttribute &CppHighlighter::localVarAttribute() const { return mLocalVarAttribute; } @@ -1442,7 +1442,7 @@ QString CppHighlighter::getToken() const return mLine.mid(mTokenPos,mRun-mTokenPos); } -const PHighlighterAttribute &CppHighlighter::getTokenAttribute() const +const PTokenAttribute &CppHighlighter::getTokenAttribute() const { switch (mTokenId) { case TokenId::Asm: diff --git a/libs/qsynedit/qsynedit/highlighter/cpp.h b/libs/qsynedit/qsynedit/highlighter/cpp.h index c42a3565..08a56fcc 100644 --- a/libs/qsynedit/qsynedit/highlighter/cpp.h +++ b/libs/qsynedit/qsynedit/highlighter/cpp.h @@ -56,33 +56,33 @@ class CppHighlighter: public Highlighter public: explicit CppHighlighter(); - const PHighlighterAttribute &asmAttribute() const; + const PTokenAttribute &asmAttribute() const; - const PHighlighterAttribute &preprocessorAttribute() const; + const PTokenAttribute &preprocessorAttribute() const; - const PHighlighterAttribute &invalidAttribute() const; + const PTokenAttribute &invalidAttribute() const; - const PHighlighterAttribute &numberAttribute() const; + const PTokenAttribute &numberAttribute() const; - const PHighlighterAttribute &floatAttribute() const; + const PTokenAttribute &floatAttribute() const; - const PHighlighterAttribute &hexAttribute() const; + const PTokenAttribute &hexAttribute() const; - const PHighlighterAttribute &octAttribute() const; + const PTokenAttribute &octAttribute() const; - const PHighlighterAttribute &stringEscapeSequenceAttribute() const; + const PTokenAttribute &stringEscapeSequenceAttribute() const; - const PHighlighterAttribute &charAttribute() const; + const PTokenAttribute &charAttribute() const; - const PHighlighterAttribute &variableAttribute() const; + const PTokenAttribute &variableAttribute() const; - const PHighlighterAttribute &functionAttribute() const; + const PTokenAttribute &functionAttribute() const; - const PHighlighterAttribute &classAttribute() const; + const PTokenAttribute &classAttribute() const; - const PHighlighterAttribute &globalVarAttribute() const; + const PTokenAttribute &globalVarAttribute() const; - const PHighlighterAttribute &localVarAttribute() const; + const PTokenAttribute &localVarAttribute() const; static const QSet Keywords; @@ -152,20 +152,20 @@ private: QSet mCustomTypeKeywords; - PHighlighterAttribute mAsmAttribute; - PHighlighterAttribute mPreprocessorAttribute; - PHighlighterAttribute mInvalidAttribute; - PHighlighterAttribute mNumberAttribute; - PHighlighterAttribute mFloatAttribute; - PHighlighterAttribute mHexAttribute; - PHighlighterAttribute mOctAttribute; - PHighlighterAttribute mStringEscapeSequenceAttribute; - PHighlighterAttribute mCharAttribute; - PHighlighterAttribute mVariableAttribute; - PHighlighterAttribute mFunctionAttribute; - PHighlighterAttribute mClassAttribute; - PHighlighterAttribute mGlobalVarAttribute; - PHighlighterAttribute mLocalVarAttribute; + PTokenAttribute mAsmAttribute; + PTokenAttribute mPreprocessorAttribute; + PTokenAttribute mInvalidAttribute; + PTokenAttribute mNumberAttribute; + PTokenAttribute mFloatAttribute; + PTokenAttribute mHexAttribute; + PTokenAttribute mOctAttribute; + PTokenAttribute mStringEscapeSequenceAttribute; + PTokenAttribute mCharAttribute; + PTokenAttribute mVariableAttribute; + PTokenAttribute mFunctionAttribute; + PTokenAttribute mClassAttribute; + PTokenAttribute mGlobalVarAttribute; + PTokenAttribute mLocalVarAttribute; // SynHighligterBase interface public: @@ -174,7 +174,7 @@ public: bool isLastLineStringNotFinished(int state) const override; bool eol() const override; QString getToken() const override; - const PHighlighterAttribute &getTokenAttribute() const override; + const PTokenAttribute &getTokenAttribute() const override; int getTokenPos() override; void next() override; void setLine(const QString &newLine, int lineNumber) override; diff --git a/libs/qsynedit/qsynedit/highlighter/customhighlighterv1.h b/libs/qsynedit/qsynedit/highlighter/customhighlighterv1.h index afec5866..42d342bd 100644 --- a/libs/qsynedit/qsynedit/highlighter/customhighlighterv1.h +++ b/libs/qsynedit/qsynedit/highlighter/customhighlighterv1.h @@ -61,9 +61,9 @@ protected: QSet mCustomTypeKeywords; - PHighlighterAttribute mInvalidAttribute; - PHighlighterAttribute mTypeKeywordAttribute; - PHighlighterAttribute mCallableAttribute; + PTokenAttribute mInvalidAttribute; + PTokenAttribute mTypeKeywordAttribute; + PTokenAttribute mCallableAttribute; }; } diff --git a/libs/qsynedit/qsynedit/highlighter/glsl.cpp b/libs/qsynedit/qsynedit/highlighter/glsl.cpp index b39a81d6..bd587560 100644 --- a/libs/qsynedit/qsynedit/highlighter/glsl.cpp +++ b/libs/qsynedit/qsynedit/highlighter/glsl.cpp @@ -131,72 +131,72 @@ GLSLHighlighter::GLSLHighlighter(): Highlighter() resetState(); } -const PHighlighterAttribute &GLSLHighlighter::asmAttribute() const +const PTokenAttribute &GLSLHighlighter::asmAttribute() const { return mAsmAttribute; } -const PHighlighterAttribute &GLSLHighlighter::preprocessorAttribute() const +const PTokenAttribute &GLSLHighlighter::preprocessorAttribute() const { return mPreprocessorAttribute; } -const PHighlighterAttribute &GLSLHighlighter::invalidAttribute() const +const PTokenAttribute &GLSLHighlighter::invalidAttribute() const { return mInvalidAttribute; } -const PHighlighterAttribute &GLSLHighlighter::numberAttribute() const +const PTokenAttribute &GLSLHighlighter::numberAttribute() const { return mNumberAttribute; } -const PHighlighterAttribute &GLSLHighlighter::floatAttribute() const +const PTokenAttribute &GLSLHighlighter::floatAttribute() const { return mFloatAttribute; } -const PHighlighterAttribute &GLSLHighlighter::hexAttribute() const +const PTokenAttribute &GLSLHighlighter::hexAttribute() const { return mHexAttribute; } -const PHighlighterAttribute &GLSLHighlighter::octAttribute() const +const PTokenAttribute &GLSLHighlighter::octAttribute() const { return mOctAttribute; } -const PHighlighterAttribute &GLSLHighlighter::stringEscapeSequenceAttribute() const +const PTokenAttribute &GLSLHighlighter::stringEscapeSequenceAttribute() const { return mStringEscapeSequenceAttribute; } -const PHighlighterAttribute &GLSLHighlighter::charAttribute() const +const PTokenAttribute &GLSLHighlighter::charAttribute() const { return mCharAttribute; } -const PHighlighterAttribute &GLSLHighlighter::variableAttribute() const +const PTokenAttribute &GLSLHighlighter::variableAttribute() const { return mVariableAttribute; } -const PHighlighterAttribute &GLSLHighlighter::functionAttribute() const +const PTokenAttribute &GLSLHighlighter::functionAttribute() const { return mFunctionAttribute; } -const PHighlighterAttribute &GLSLHighlighter::classAttribute() const +const PTokenAttribute &GLSLHighlighter::classAttribute() const { return mClassAttribute; } -const PHighlighterAttribute &GLSLHighlighter::globalVarAttribute() const +const PTokenAttribute &GLSLHighlighter::globalVarAttribute() const { return mGlobalVarAttribute; } -const PHighlighterAttribute &GLSLHighlighter::localVarAttribute() const +const PTokenAttribute &GLSLHighlighter::localVarAttribute() const { return mLocalVarAttribute; } @@ -1305,7 +1305,7 @@ QString GLSLHighlighter::getToken() const return mLineString.mid(mTokenPos,mRun-mTokenPos); } -const PHighlighterAttribute &GLSLHighlighter::getTokenAttribute() const +const PTokenAttribute &GLSLHighlighter::getTokenAttribute() const { switch (mTokenId) { case TokenId::Asm: diff --git a/libs/qsynedit/qsynedit/highlighter/glsl.h b/libs/qsynedit/qsynedit/highlighter/glsl.h index c746bc21..a9e1d897 100644 --- a/libs/qsynedit/qsynedit/highlighter/glsl.h +++ b/libs/qsynedit/qsynedit/highlighter/glsl.h @@ -56,33 +56,33 @@ class GLSLHighlighter: public Highlighter public: explicit GLSLHighlighter(); - const PHighlighterAttribute &asmAttribute() const; + const PTokenAttribute &asmAttribute() const; - const PHighlighterAttribute &preprocessorAttribute() const; + const PTokenAttribute &preprocessorAttribute() const; - const PHighlighterAttribute &invalidAttribute() const; + const PTokenAttribute &invalidAttribute() const; - const PHighlighterAttribute &numberAttribute() const; + const PTokenAttribute &numberAttribute() const; - const PHighlighterAttribute &floatAttribute() const; + const PTokenAttribute &floatAttribute() const; - const PHighlighterAttribute &hexAttribute() const; + const PTokenAttribute &hexAttribute() const; - const PHighlighterAttribute &octAttribute() const; + const PTokenAttribute &octAttribute() const; - const PHighlighterAttribute &stringEscapeSequenceAttribute() const; + const PTokenAttribute &stringEscapeSequenceAttribute() const; - const PHighlighterAttribute &charAttribute() const; + const PTokenAttribute &charAttribute() const; - const PHighlighterAttribute &variableAttribute() const; + const PTokenAttribute &variableAttribute() const; - const PHighlighterAttribute &functionAttribute() const; + const PTokenAttribute &functionAttribute() const; - const PHighlighterAttribute &classAttribute() const; + const PTokenAttribute &classAttribute() const; - const PHighlighterAttribute &globalVarAttribute() const; + const PTokenAttribute &globalVarAttribute() const; - const PHighlighterAttribute &localVarAttribute() const; + const PTokenAttribute &localVarAttribute() const; static const QSet Keywords; @@ -148,20 +148,20 @@ private: int mLeftBraces; int mRightBraces; - PHighlighterAttribute mAsmAttribute; - PHighlighterAttribute mPreprocessorAttribute; - PHighlighterAttribute mInvalidAttribute; - PHighlighterAttribute mNumberAttribute; - PHighlighterAttribute mFloatAttribute; - PHighlighterAttribute mHexAttribute; - PHighlighterAttribute mOctAttribute; - PHighlighterAttribute mStringEscapeSequenceAttribute; - PHighlighterAttribute mCharAttribute; - PHighlighterAttribute mVariableAttribute; - PHighlighterAttribute mFunctionAttribute; - PHighlighterAttribute mClassAttribute; - PHighlighterAttribute mGlobalVarAttribute; - PHighlighterAttribute mLocalVarAttribute; + PTokenAttribute mAsmAttribute; + PTokenAttribute mPreprocessorAttribute; + PTokenAttribute mInvalidAttribute; + PTokenAttribute mNumberAttribute; + PTokenAttribute mFloatAttribute; + PTokenAttribute mHexAttribute; + PTokenAttribute mOctAttribute; + PTokenAttribute mStringEscapeSequenceAttribute; + PTokenAttribute mCharAttribute; + PTokenAttribute mVariableAttribute; + PTokenAttribute mFunctionAttribute; + PTokenAttribute mClassAttribute; + PTokenAttribute mGlobalVarAttribute; + PTokenAttribute mLocalVarAttribute; // SynHighligterBase interface public: @@ -170,7 +170,7 @@ public: bool isLastLineStringNotFinished(int state) const override; bool eol() const override; QString getToken() const override; - const PHighlighterAttribute &getTokenAttribute() const override; + const PTokenAttribute &getTokenAttribute() const override; int getTokenPos() override; void next() override; void setLine(const QString &newLine, int lineNumber) override; diff --git a/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.cpp b/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.cpp index 54808bd4..28ecb9a5 100644 --- a/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.cpp +++ b/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.cpp @@ -431,7 +431,7 @@ QString MakefileHighlighter::getToken() const return mLineString.mid(mTokenPos,mRun-mTokenPos); } -const PHighlighterAttribute &MakefileHighlighter::getTokenAttribute() const +const PTokenAttribute &MakefileHighlighter::getTokenAttribute() const { /* Directive, diff --git a/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.h b/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.h index 49b3157b..9c440548 100644 --- a/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.h +++ b/libs/qsynedit/qsynedit/highlighter/makefilehighlighter.h @@ -80,12 +80,12 @@ private: RangeState mState; TokenId mTokenID; - PHighlighterAttribute mTargetAttribute; - PHighlighterAttribute mCommandAttribute; - PHighlighterAttribute mCommandParamAttribute; - PHighlighterAttribute mNumberAttribute; - PHighlighterAttribute mVariableAttribute; - PHighlighterAttribute mExpressionAttribute; + PTokenAttribute mTargetAttribute; + PTokenAttribute mCommandAttribute; + PTokenAttribute mCommandParamAttribute; + PTokenAttribute mNumberAttribute; + PTokenAttribute mVariableAttribute; + PTokenAttribute mExpressionAttribute; private: void procSpace(); @@ -135,7 +135,7 @@ public: QString languageName() override; ProgrammingLanguage language() override; QString getToken() const override; - const PHighlighterAttribute &getTokenAttribute() const override; + const PTokenAttribute &getTokenAttribute() const override; int getTokenPos() override; void next() override; void setLine(const QString &newLine, int lineNumber) override;