1 | 1 | simandl | <?php |
2 | | | /************************************************************************************* |
3 | | | * cpp.php |
4 | | | * ------- |
5 | | | * Author: Dennis Bayer (Dennis.Bayer@mnifh-giessen.de) |
6 | | | * Contributors: |
7 | | | * - M. Uli Kusterer (witness.of.teachtext@gmx.net) |
8 | | | * - Jack Lloyd (lloyd@randombit.net) |
9 | | | * Copyright: (c) 2004 Dennis Bayer, Nigel McNie (http://qbnz.com/highlighter) |
10 | | | * Release Version: 1.0.8.1 |
11 | | | * Date Started: 2004/09/27 |
12 | | | * |
13 | | | * C++ language file for GeSHi. |
14 | | | * |
15 | | | * CHANGES |
16 | | | * ------- |
17 | | | * 2008/05/23 (1.0.7.22) |
18 | | | * - Added description of extra language features (SF#1970248) |
19 | | | * 2004/XX/XX (1.0.2) |
20 | | | * - Added several new keywords (Jack Lloyd) |
21 | | | * 2004/11/27 (1.0.1) |
22 | | | * - Added StdCLib function and constant names, changed color scheme to |
23 | | | * a cleaner one. (M. Uli Kusterer) |
24 | | | * - Added support for multiple object splitters |
25 | | | * 2004/10/27 (1.0.0) |
26 | | | * - First Release |
27 | | | * |
28 | | | * TODO (updated 2004/11/27) |
29 | | | * ------------------------- |
30 | | | * |
31 | | | ************************************************************************************* |
32 | | | * |
33 | | | * This file is part of GeSHi. |
34 | | | * |
35 | | | * GeSHi is free software; you can redistribute it and/or modify |
36 | | | * it under the terms of the GNU General Public License as published by |
37 | | | * the Free Software Foundation; either version 2 of the License, or |
38 | | | * (at your option) any later version. |
39 | | | * |
40 | | | * GeSHi is distributed in the hope that it will be useful, |
41 | | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
42 | | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
43 | | | * GNU General Public License for more details. |
44 | | | * |
45 | | | * You should have received a copy of the GNU General Public License |
46 | | | * along with GeSHi; if not, write to the Free Software |
47 | | | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
48 | | | * |
49 | | | ************************************************************************************/ |
50 | | | |
51 | | | $language_data = array ( |
52 | | | 'LANG_NAME' => 'C++', |
53 | | | 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'), |
54 | | | 'COMMENT_MULTI' => array('/*' => '*/'), |
55 | | | //Multiline-continued single-line comments |
56 | | | 'COMMENT_REGEXP' => array(1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m'), |
57 | | | 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, |
58 | | | 'QUOTEMARKS' => array("'", '"'), |
59 | | | 'ESCAPE_CHAR' => '\\', |
60 | | | 'NUMBERS' => |
61 | | | GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B | |
62 | | | GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI | |
63 | | | GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO, |
64 | | | 'KEYWORDS' => array( |
65 | | | 1 => array( |
66 | | | 'break', 'case', 'continue', 'default', 'do', 'else', 'for', 'goto', 'if', 'return', |
67 | | | 'switch', 'throw', 'while' |
68 | | | ), |
69 | | | 2 => array( |
70 | | | 'NULL', 'false', 'true', 'enum', 'errno', 'EDOM', |
71 | | | 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG', |
72 | | | 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG', |
73 | | | 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP', |
74 | | | 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP', |
75 | | | 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN', |
76 | | | 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN', |
77 | | | 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT', |
78 | | | 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR', |
79 | | | 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam', |
80 | | | 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr', |
81 | | | 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC', |
82 | | | 'virtual', 'public', 'private', 'protected', 'template', 'using', 'namespace', |
83 | | | 'try', 'catch', 'inline', 'dynamic_cast', 'const_cast', 'reinterpret_cast', |
84 | | | 'static_cast', 'explicit', 'friend', 'wchar_t', 'typename', 'typeid', 'class' |
85 | | | ), |
86 | | | 3 => array( |
87 | | | 'cin', 'cerr', 'clog', 'cout', 'delete', 'new', 'this', |
88 | | | 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert', |
89 | | | 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint', |
90 | | | 'ispunct', 'isspace', 'isupper', 'isxdigit', 'tolower', 'toupper', |
91 | | | 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp', |
92 | | | 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2', |
93 | | | 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp', |
94 | | | 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen', |
95 | | | 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf', |
96 | | | 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf', |
97 | | | 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc', |
98 | | | 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind', |
99 | | | 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs', |
100 | | | 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc', |
101 | | | 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv', |
102 | | | 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat', |
103 | | | 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn', |
104 | | | 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy', |
105 | | | 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime', |
106 | | | 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime' |
107 | | | ), |
108 | | | 4 => array( |
109 | | | 'auto', 'bool', 'char', 'const', 'double', 'float', 'int', 'long', 'longint', |
110 | | | 'register', 'short', 'shortint', 'signed', 'static', 'struct', |
111 | | | 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf', |
112 | | | 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t', |
113 | | | 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', |
114 | | | ), |
115 | | | ), |
116 | | | 'SYMBOLS' => array( |
117 | | | |
118 | | | 1 => array('<', '>','='), |
119 | | | 2 => array('+', '-', '*', '/', '%'), |
120 | | | 3 => array('!', '^', '&', '|'), |
121 | | | 4 => array('?', ':', ';') |
122 | | | ), |
123 | | | 'CASE_SENSITIVE' => array( |
124 | | | GESHI_COMMENTS => false, |
125 | | | 1 => false, |
126 | | | 2 => false, |
127 | | | 3 => false, |
128 | | | 4 => false, |
129 | | | ), |
130 | | | 'STYLES' => array( |
131 | | | 'KEYWORDS' => array( |
132 | | | 1 => 'color: #0000ff;', |
133 | | | 2 => 'color: #0000ff;', |
134 | | | 3 => 'color: #0000dd;', |
135 | | | 4 => 'color: #0000ff;' |
136 | | | ), |
137 | | | 'COMMENTS' => array( |
138 | | | 1 => 'color: #666666;', |
139 | | | 2 => 'color: #339900;', |
140 | | | 'MULTI' => 'color: #ff0000; font-style: italic;' |
141 | | | ), |
142 | | | 'ESCAPE_CHAR' => array( |
143 | | | |
144 | | | ), |
145 | | | 'BRACKETS' => array( |
146 | | | |
147 | | | ), |
148 | | | 'STRINGS' => array( |
149 | | | |
150 | | | ), |
151 | | | 'NUMBERS' => array( |
152 | | | |
153 | | | GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;', |
154 | | | GESHI_NUMBER_OCT_PREFIX => 'color: #208080;', |
155 | | | GESHI_NUMBER_HEX_PREFIX => 'color: #208080;', |
156 | | | GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;', |
157 | | | GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;', |
158 | | | GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;', |
159 | | | GESHI_NUMBER_FLT_NONSCI => 'color:#800080;' |
160 | | | ), |
161 | | | 'METHODS' => array( |
162 | | | 1 => 'color: #007788;', |
163 | | | 2 => 'color: #007788;' |
164 | | | ), |
165 | | | 'SYMBOLS' => array( |
166 | | | |
167 | | | 1 => 'color: #000080;', |
168 | | | 2 => 'color: #000040;', |
169 | | | 3 => 'color: #000040;', |
170 | | | 4 => 'color: #008080;' |
171 | | | ), |
172 | | | 'REGEXPS' => array( |
173 | | | ), |
174 | | | 'SCRIPT' => array( |
175 | | | ) |
176 | | | ), |
177 | | | 'URLS' => array( |
178 | | | 1 => '', |
179 | | | 2 => '', |
180 | | | 3 => '', |
181 | | | 4 => '' |
182 | | | ), |
183 | | | 'OOLANG' => true, |
184 | | | 'OBJECT_SPLITTERS' => array( |
185 | | | 1 => '.', |
186 | | | 2 => '::' |
187 | | | ), |
188 | | | 'REGEXPS' => array( |
189 | | | ), |
190 | | | 'STRICT_MODE_APPLIES' => GESHI_NEVER, |
191 | | | 'SCRIPT_DELIMITERS' => array( |
192 | | | ), |
193 | | | 'HIGHLIGHT_STRICT_BLOCK' => array( |
194 | | | ), |
195 | | | 'TAB_WIDTH' => 4, |
196 | | | 'PARSER_CONTROL' => array( |
197 | | | 'KEYWORDS' => array( |
198 | | | 'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#])", |
199 | | | 'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_\|%\\-])" |
200 | | | ) |
201 | | | ) |
202 | | | ); |
203 | | | |
204 | | | ?> |