37 lines
2.4 KiB
C
37 lines
2.4 KiB
C
|
static void highlight_cpp (void) {
|
||
|
char * separators = ".,:;<=>+-*/%!&~^?|()[]{}'\" \t\r\n";
|
||
|
|
||
|
char * keywords [] = {
|
||
|
"alignas", "alignof", "and", "asm", "auto", "bool", "break", "case",
|
||
|
"catch", "char", "class", "compl", "concept", "const", "consteval", "constexpr",
|
||
|
"constinit", "continue", "decltype", "default", "delete", "do", "double", "else",
|
||
|
"enum", "explicit", "export", "extern", "false", "float", "for", "friend",
|
||
|
"goto", "if", "inline", "int", "long", "mutable", "namespace", "new",
|
||
|
"noexcept", "not", "nullptr", "operator", "or", "private", "protected", "public",
|
||
|
"reflexpr", "register", "requires", "return", "short", "signed", "sizeof", "static",
|
||
|
"struct", "switch", "synchronized", "template", "this", "throw", "true", "try",
|
||
|
"typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void",
|
||
|
"volatile", "while", "xor", "final", "override", "import", "module"
|
||
|
};
|
||
|
|
||
|
int word;
|
||
|
|
||
|
syntax_define (false, false, "/*", "*/", '\0', (int) 0xff777777, 0);
|
||
|
syntax_define (false, false, "//", "\n", '\0', (int) 0xff777777, 0);
|
||
|
syntax_define (false, false, "#", "\n", '\\', (int) 0xff3377aa, 0);
|
||
|
syntax_define (false, false, "'", "'", '\\', (int) 0xff7733cc, 0);
|
||
|
syntax_define (false, false, "\"", "\"", '\\', (int) 0xffcc3377, 0);
|
||
|
|
||
|
for (word = 0; word != (int) (sizeof (keywords) / sizeof (keywords [0])); ++word) {
|
||
|
syntax_define (false, true, keywords [word], separators, '\0', (int) 0xff33ccee, 0);
|
||
|
}
|
||
|
|
||
|
syntax_define (true, false, "()[]{}", "", '\0', (int) 0xffee5533, 0);
|
||
|
syntax_define (true, false, ".,:;<=>+*-/%!&~^?|", "", '\0', (int) 0xffeeaa33, 0);
|
||
|
|
||
|
syntax_define (true, true, "0123456789", separators, '\0', (int) 0xffee33aa, 0);
|
||
|
syntax_define (true, true, "abcdefghijklmnopqrstuvwxyz", separators, '\0', (int) 0xffcccccc, 0);
|
||
|
syntax_define (true, true, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", separators, '\0', (int) 0xffeeeeee, 0);
|
||
|
syntax_define (true, true, "_", separators, '\0', (int) 0xffaaaaaa, 0);
|
||
|
}
|