-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguage.h
More file actions
138 lines (123 loc) · 2.46 KB
/
Language.h
File metadata and controls
138 lines (123 loc) · 2.46 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#pragma once
class ByteLookup {
private:
wstring m_RefString;
const TCHAR *m_Chars;
size_t m_LastByte;
public:
ByteLookup(){
SetData(L" ");
}
void SetData(wstring RefString)
{
m_RefString = RefString;
m_Chars = m_RefString.c_str();
m_LastByte = max(0,m_RefString.length()-2);
}
bool Valid(TCHAR val)
{
return m_Chars[min((unsigned short)val, m_LastByte)] != ' ';
}
};
class WordLookup {
private:
public:
unordered_set<wstring>m_Words;
WordLookup() {}
//void SetData(unordered_set<TCHARString>Words)
//{
// m_Words = Words;
//}
bool Valid(wstring t)
{
return m_Words.count(t.c_str());
}
size_t ValidTCHAR(TCHAR* text)
{
//TCHARString ItemName;
for (auto item : m_Words) {
if (_wcsnicmp(item.c_str(), text, item.length()) == 0)
return item.length();
}
return 0;
}
};
class SingleWordLookup {
private:
wstring m_Word;
const TCHAR *m_Chars;
size_t m_Len;
public:
SingleWordLookup() {
m_Word = L"";
m_Chars = m_Word.c_str();
m_Len = m_Word.length();
}
void SetData(wstring Word)
{
m_Word = Word;
m_Chars = m_Word.c_str();
m_Len = m_Word.length();
}
bool Valid(TCHAR *t)
{
return _wcsnicmp(t, m_Chars, m_Len) == 0;
}
const TCHAR* GetValue()
{
return m_Chars;
}
size_t GetLength()
{
return m_Len;
}
};
class Language
{
private:
wstring m_LanguageFile;
public:
wstring m_LanguageName;
WordLookup KEYWORDS;
WordLookup LITERALS;
WordLookup FUNCTIONS;
WordLookup STATICCLASS;
WordLookup CLASSFUNCS;
WordLookup OCTPREFIXES;
WordLookup HEXPREFIXES;
WordLookup BINPREFIXES;
WordLookup NUMSUFFIXES;
WordLookup WORDBINDERS;
WordLookup BRACELESSWORDS;
SingleWordLookup SINGLELINECOMMENT;
SingleWordLookup MULTILINECOMMENTSTART;
SingleWordLookup MULTILINECOMMENTEND;
ByteLookup WHITESPACE;
ByteLookup QUOTES;
ByteLookup STRINGESCAPE;
ByteLookup VALIDNAMESTART;
ByteLookup VALIDNAMEEND;
ByteLookup COLORSET1CHARS;
ByteLookup COLORSET2CHARS;
ByteLookup COLORSET3CHARS;
ByteLookup COLORSET4CHARS;
ByteLookup SELECTBLOCKERS;
ByteLookup SELECTREVERSEBLOCKERS;
ByteLookup BASEBIN;
ByteLookup BASEOCT;
ByteLookup BASEDEC;
ByteLookup BASEHEX;
ByteLookup COMMENTCHARS;
ByteLookup BINDERSPRECHECK;
ByteLookup BINPRECHECK;
ByteLookup OCTPRECHECK;
ByteLookup HEXPRECHECK;
ByteLookup SPLITTERS;
ByteLookup NUMPRECHECK;
ByteLookup WORDLISTSPLIT;
ByteLookup BRACELESSWORDSPRECHECK;
public:
Language(const TCHAR* LanguageName, const TCHAR* LanguageFile);
~Language();
void LoadFile(LPCSTR filename);
};