aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h')
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
index f834e275..ba4c211a 100644
--- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
+++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h
@@ -13,10 +13,15 @@
#include <QString>
#include <QSettings>
#include <QDebug>
+#include <QDateTime>
+#include <QJsonObject>
+#include <QPlainTextEdit>
+
//Simple syntax rules
struct SyntaxRule{
- QRegExp pattern;
+ QRegExp pattern; //single-line rule
+ QRegExp startPattern, endPattern; //multi-line rules
QTextCharFormat format;
};
//Complicated/multi-line rules
@@ -25,6 +30,32 @@ struct SyntaxRuleSplit{
QTextCharFormat format;
};
+class SyntaxFile{
+private:
+ QJsonObject metaObj;
+ QJsonObject formatObj;
+
+ QColor colorFromOption(QString opt, QSettings *settings);
+
+public:
+ QVector<SyntaxRule> rules;
+ QDateTime lastLoaded;
+ QString fileLoaded;
+
+ SyntaxFile(){}
+
+ QString name();
+ int char_limit();
+ bool highlight_excess_whitespace();
+
+ void SetupDocument(QPlainTextEdit *editor);
+ bool supportsFile(QString file); //does this syntax set support the file?
+
+ //Main Loading routine (run this before other functions)
+ bool LoadFile(QString file, QSettings *settings);
+
+};
+
class Custom_Syntax : public QSyntaxHighlighter{
Q_OBJECT
private:
bgstack15