Commit | Line | Data |
---|---|---|
dcc2332d MW |
1 | <?php |
2 | namespace wcf\system\bbcode\highlighter; | |
3 | ||
4 | /** | |
5 | * Highlights syntax of c / c++ source code. | |
6 | * | |
7 | * @author Tim Duesterhus | |
c839bd49 | 8 | * @copyright 2001-2018 WoltLab GmbH |
dcc2332d | 9 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
e71525e4 | 10 | * @package WoltLabSuite\Core\System\Bbcode\Highlighter |
dcc2332d MW |
11 | */ |
12 | class CHighlighter extends Highlighter { | |
13 | /** | |
0fcfe5f6 | 14 | * @inheritDoc |
dcc2332d | 15 | */ |
058cbd6a | 16 | protected $separators = ['(', ')', '{', '}', '[', ']', ';', '.', ',']; |
dcc2332d MW |
17 | |
18 | /** | |
0fcfe5f6 | 19 | * @inheritDoc |
dcc2332d | 20 | */ |
058cbd6a | 21 | protected $operators = ['=', '>', '<', '!', '~', '?', ':', '==', '<=', '>=', '!=', |
dcc2332d | 22 | '&&', '||', '++', '--', '+', '-', '*', '/', '&', '|', '^', '%', '<<', '>>', '>>>', '+=', '-=', '*=', |
058cbd6a | 23 | '/=', '&=', '|=', '^=', '%=', '<<=', '>>=', '>>>=']; |
dcc2332d MW |
24 | |
25 | /** | |
0fcfe5f6 | 26 | * @inheritDoc |
dcc2332d | 27 | */ |
058cbd6a | 28 | protected $keywords1 = [ |
dcc2332d MW |
29 | 'and', |
30 | 'and_eq', | |
31 | 'asm', | |
32 | 'bitand', | |
33 | 'bitor', | |
34 | 'break', | |
35 | 'case', | |
36 | 'catch', | |
37 | 'compl', | |
38 | 'const_cast', | |
39 | 'continue', | |
40 | 'default', | |
41 | 'delete', | |
42 | 'do', | |
43 | 'dynamic_cast', | |
44 | 'else', | |
45 | 'for', | |
46 | 'fortran', | |
47 | 'friend', | |
48 | 'goto', | |
49 | 'if', | |
50 | 'new', | |
51 | 'not', | |
52 | 'not_eq', | |
53 | 'operator', | |
54 | 'or', | |
55 | 'or_eq', | |
56 | 'private', | |
57 | 'protected', | |
58 | 'public', | |
59 | 'reinterpret_cast', | |
60 | 'return', | |
61 | 'sizeof', | |
62 | 'static_cast', | |
63 | 'switch', | |
64 | 'this', | |
65 | 'throw', | |
66 | 'try', | |
67 | 'typeid', | |
68 | 'using', | |
69 | 'while', | |
70 | 'xor', | |
71 | 'xor_eq' | |
058cbd6a | 72 | ]; |
dcc2332d MW |
73 | |
74 | /** | |
0fcfe5f6 | 75 | * @inheritDoc |
dcc2332d | 76 | */ |
058cbd6a | 77 | protected $keywords2 = [ |
dcc2332d MW |
78 | 'auto', |
79 | 'bool', | |
80 | 'char', | |
81 | 'class', | |
82 | 'const', | |
83 | 'double', | |
84 | 'enum', | |
85 | 'explicit', | |
86 | 'export', | |
87 | 'extern', | |
88 | 'float', | |
89 | 'inline', | |
90 | 'int', | |
91 | 'long', | |
92 | 'mutable', | |
93 | 'namespace', | |
94 | 'register', | |
95 | 'short', | |
96 | 'signed', | |
97 | 'static', | |
98 | 'struct', | |
99 | 'template', | |
100 | 'typedef', | |
101 | 'typename', | |
102 | 'union', | |
103 | 'unsigned', | |
104 | 'virtual', | |
105 | 'void', | |
106 | 'volatile', | |
107 | 'wchar_t' | |
058cbd6a | 108 | ]; |
dcc2332d MW |
109 | |
110 | /** | |
0fcfe5f6 | 111 | * @inheritDoc |
dcc2332d | 112 | */ |
058cbd6a | 113 | protected $keywords3 = [ |
dcc2332d MW |
114 | '#include', |
115 | '#define', | |
116 | '#if', | |
117 | '#else', | |
118 | '#ifdef', | |
119 | '#endif' | |
058cbd6a | 120 | ]; |
dcc2332d | 121 | } |