Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Егор Галкин
LR3-4_Notepad
Commits
f19bc6da
Commit
f19bc6da
authored
4 years ago
by
Егор Галкин
Browse files
Options
Download
Patches
Plain Diff
Add new file
parent
2f24a5d5
master
No related merge requests found
Pipeline
#1181
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
highlighter.h
+50
-0
highlighter.h
with
50 additions
and
0 deletions
+50
-0
highlighter.h
0 → 100644
+
50
−
0
View file @
f19bc6da
#ifndef HIGHLIGHTER_H
#define HIGHLIGHTER_H
#include
<QSyntaxHighlighter>
#include
<QTextDocument>
#include
<QString>
#include
<QVector>
#include
<QRegExp>
#include
<QTextCharFormat>
#include
<QDomDocument>
#include
<QHash>
class
Highlighter
:
public
QSyntaxHighlighter
{
public:
explicit
Highlighter
(
QString
,
QObject
*
parent
=
0
);
bool
setExtension
(
const
QString
&
);
//protected:
void
highlightBlock
(
const
QString
&
)
override
;
private:
QString
xml_filename
;
QRegExp
current_extension
;
struct
HighlightingRule
{
QRegExp
pattern
;
QTextCharFormat
format
;
};
struct
HighlightLanguage
{
QVector
<
HighlightingRule
>
highlightingRules
;
QRegExp
commentStartExpression
;
QRegExp
commentEndExpression
;
QTextCharFormat
keywordFormat
;
QTextCharFormat
classFormat
;
QTextCharFormat
singleLineCommentFormat
;
QTextCharFormat
multiLineCommentFormat
;
QTextCharFormat
quotationFormat
;
QTextCharFormat
functionFormat
;
QTextCharFormat
preprocFormat
;
};
QHash
<
QRegExp
,
HighlightLanguage
>
languagesContainer
;
};
#endif // HIGHLIGHTER_H
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets