-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlexersel.h
69 lines (58 loc) · 1.32 KB
/
lexersel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef LEXERSEL_H
#define LEXERSEL_H
class QsciLexer;
enum LexerID {
LexerNone = 0,
LexerCPP,
LexerJava,
LexerJavaScript,
LexerBash,
LexerMakefile,
LexerCMake,
LexerPython,
LexerDiff,
LexerTCL,
LexerPerl,
LexerHTML,
LexerCSS,
LexerAsciiDoc,
LexerTex,
LexerMib,
};
class LexerData {
public:
QString pattern;
LexerID id;
LexerData(QString s, LexerID i)
:pattern(s),id(i)
{
};
};
class LexerSelector {
public:
static QsciLexer* getLexerForFile(const QString &fileName,
QString *lineCommentString,
QString *blockCommentStartString,
QString *blockCommentMiddleString,
QString *blockCommentEndString);
static QsciLexer* getLexerForText(const QString &text,
QString *lineCommentString,
QString *blockCommentStartString,
QString *blockCommentMiddleString,
QString *blockCommentEndString);
static QsciLexer* getLexerById(int id,
QString *lineCommentString,
QString *blockCommentStartString,
QString *blockCommentMiddleString,
QString *blockCommentEndString);
static void saveLexerSettings();
static void loadLexerSettings();
static LexerID lexerStringToId(QString);
static QString lexerIdToString(LexerID);
private:
static QList<LexerData> lexerInfo;
static QList<LexerData> lexerTextInfo;
static QMap<QString,LexerID> stringToIdMap;
static QMap<LexerID,QString> idToStringMap;
};
#endif