2023-02-28 12:19:45 +00:00
|
|
|
#include "keywordshighlighter.h"
|
2022-11-17 08:26:05 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
|
|
|
using namespace Enhancement;
|
|
|
|
|
2023-08-15 14:14:00 +00:00
|
|
|
// KeywordsHighlighter::KeywordsHighlighter(QObject *parent)
|
|
|
|
// : QSyntaxHighlighter(parent), parse_core(nullptr)
|
|
|
|
//{
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
// void KeywordsHighlighter::reset(Parse::Result::DocCore *base)
|
|
|
|
//{
|
|
|
|
// this->parse_core = base;
|
|
|
|
//}
|
|
|
|
|
|
|
|
// void KeywordsHighlighter::highlightBlock(const QString &text)
|
|
|
|
//{
|
|
|
|
// if(parse_core == nullptr)
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// QTextCharFormat unknowns;
|
|
|
|
// unknowns.setForeground(QBrush(Qt::gray));
|
|
|
|
|
|
|
|
// QTextCharFormat generate;
|
|
|
|
// generate.setForeground(QBrush(Qt::blue));
|
|
|
|
|
|
|
|
// QTextCharFormat error;
|
|
|
|
// error.setForeground(QBrush(Qt::red));
|
|
|
|
|
|
|
|
// auto block = currentBlock();
|
|
|
|
// auto words = parse_core->getWords(block.blockNumber());
|
|
|
|
// for(auto &w : words){
|
|
|
|
// QList<ErrorMessage> xerrors;
|
|
|
|
|
|
|
|
// if(w->host() == parse_core->unknowns()){
|
|
|
|
// unknowns.setUnderlineStyle(QTextCharFormat::UnderlineStyle::WaveUnderline);
|
|
|
|
// unknowns.setUnderlineColor(QColor(Qt::red));
|
|
|
|
|
|
|
|
// setFormat(w->column()-1, w->toString().length(), unknowns);
|
|
|
|
// }
|
|
|
|
// else if(!w->host()->check(xerrors)){
|
|
|
|
// setFormat(w->column()-1, w->toString().length(), error);
|
|
|
|
// }
|
|
|
|
// else{
|
|
|
|
// setFormat(w->column()-1, w->toString().length(), generate);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|