ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
cpp.php
Go to the documentation of this file.
1 <?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.9.0
11  * Date Started: 2004/09/27
12  *
13  * C++ language file for GeSHi.
14  *
15  * CHANGES
16  * -------
17  * 2013/11/06
18  * - Added nullptr from c++11 & others
19  * 2008/05/23 (1.0.7.22)
20  * - Added description of extra language features (SF#1970248)
21  * 2004/XX/XX (1.0.2)
22  * - Added several new keywords (Jack Lloyd)
23  * 2004/11/27 (1.0.1)
24  * - Added StdCLib function and constant names, changed color scheme to
25  * a cleaner one. (M. Uli Kusterer)
26  * - Added support for multiple object splitters
27  * 2004/10/27 (1.0.0)
28  * - First Release
29  *
30  * TODO (updated 2004/11/27)
31  * -------------------------
32  *
33  *************************************************************************************
34  *
35  * This file is part of GeSHi.
36  *
37  * GeSHi is free software; you can redistribute it and/or modify
38  * it under the terms of the GNU General Public License as published by
39  * the Free Software Foundation; either version 2 of the License, or
40  * (at your option) any later version.
41  *
42  * GeSHi is distributed in the hope that it will be useful,
43  * but WITHOUT ANY WARRANTY; without even the implied warranty of
44  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  * GNU General Public License for more details.
46  *
47  * You should have received a copy of the GNU General Public License
48  * along with GeSHi; if not, write to the Free Software
49  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
50  *
51  ************************************************************************************/
52 
54  'LANG_NAME' => 'C++',
55  'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
56  'COMMENT_MULTI' => array('/*' => '*/'),
57  'COMMENT_REGEXP' => array(
58  //Multiline-continued single-line comments
59  1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m',
60  //Multiline-continued preprocessor define
61  2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m',
62  //C++ 11 string literal extensions
63  3 => '/(?:L|u8?|U)(?=")/',
64  //C++ 11 string literal extensions (raw)
65  4 => '/R"([^()\s\\\\]*)\((?:(?!\)\\1").)*\)\\1"/ms'
66  ),
67  'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
68  'QUOTEMARKS' => array("'", '"'),
69  'ESCAPE_CHAR' => '',
70  'ESCAPE_REGEXP' => array(
71  //Simple Single Char Escapes
72  1 => "#\\\\[abfnrtv\\\'\"?\n]#",
73  //Hexadecimal Char Specs
74  2 => "#\\\\x[\da-fA-F]{2}#",
75  //Hexadecimal Char Specs
76  3 => "#\\\\u[\da-fA-F]{4}#",
77  //Hexadecimal Char Specs
78  4 => "#\\\\U[\da-fA-F]{8}#",
79  //Octal Char Specs
80  5 => "#\\\\[0-7]{1,3}#"
81  ),
82  'NUMBERS' =>
86  'KEYWORDS' => array(
87  1 => array(
88  'break', 'case', 'continue', 'default', 'do', 'else', 'for', 'goto', 'if', 'return',
89  'switch', 'throw', 'while'
90  ),
91  2 => array(
92  'NULL', 'false', 'true', 'enum', 'errno', 'EDOM',
93  'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG',
94  'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG',
95  'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP',
96  'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP',
97  'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN',
98  'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN',
99  'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT',
100  'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR',
101  'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam',
102  'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr',
103  'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC',
104  'virtual', 'public', 'private', 'protected', 'template', 'using', 'namespace',
105  'try', 'catch', 'inline', 'dynamic_cast', 'const_cast', 'reinterpret_cast',
106  'static_cast', 'explicit', 'friend', 'typename', 'typeid', 'class', 'nullptr',
107  'decltype', 'override', 'final', 'noexcept', 'alignas', 'alignof', 'noreturn',
108  'constexpr', 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'thread_local',
109  'static_assert', 'compl', 'or', 'or_eq', 'xor', 'xor_eq', 'not', 'not_eq'
110  ),
111  3 => array(
112  'cin', 'cerr', 'clog', 'cout', 'delete', 'new', 'this', 'export',
113  'printf', 'fprintf', 'snprintf', 'sprintf', 'assert',
114  'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint',
115  'ispunct', 'isspace', 'isupper', 'isxdigit', 'tolower', 'toupper',
116  'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp',
117  'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2',
118  'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp',
119  'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen',
120  'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf',
121  'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf',
122  'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc',
123  'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind',
124  'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs',
125  'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc',
126  'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv',
127  'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat',
128  'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn',
129  'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy',
130  'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime',
131  'asctime', 'ctime', 'gmtime', 'localtime', 'strftime'
132  ),
133  4 => array(
134  'auto', 'bool', 'char', 'char16_t', 'char32_t', 'const', 'double', 'float',
135  'int', 'long', 'longint','register', 'short', 'shortint', 'signed',
136  'static', 'struct', 'typedef', 'union', 'unsigned', 'void', 'volatile',
137  'extern', 'jmp_buf','signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t',
138  'FILE', 'fpos_t', 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', 'wchar_t',
139  'mutable',
140 
141  'int8', 'int16', 'int32', 'int64',
142  'uint8', 'uint16', 'uint32', 'uint64',
143 
144  'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t',
145  'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
146 
147  'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t',
148  'uint_least8_t', 'uint_least16_t', 'uint_least32_t', 'uint_least64_t',
149 
150  'int8_t', 'int16_t', 'int32_t', 'int64_t',
151  'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
152 
153  'intmax_t', 'uintmax_t', 'intptr_t', 'uintptr_t'
154  ),
155  ),
156  'SYMBOLS' => array(
157  0 => array('(', ')', '{', '}', '[', ']'),
158  1 => array('<', '>','='),
159  2 => array('+', '-', '*', '/', '%'),
160  3 => array('!', '^', '&', '|'),
161  4 => array('?', ':', ';')
162  ),
163  'CASE_SENSITIVE' => array(
164  GESHI_COMMENTS => false,
165  1 => true,
166  2 => true,
167  3 => true,
168  4 => true,
169  ),
170  'STYLES' => array(
171  'KEYWORDS' => array(
172  1 => 'color: #0000ff;',
173  2 => 'color: #0000ff;',
174  3 => 'color: #0000dd;',
175  4 => 'color: #0000ff;'
176  ),
177  'COMMENTS' => array(
178  1 => 'color: #666666;',
179  2 => 'color: #339900;',
180  3 => 'color: #FF0000;',
181  4 => 'color: #FF0000;',
182  'MULTI' => 'color: #ff0000; font-style: italic;'
183  ),
184  'ESCAPE_CHAR' => array(
185  0 => 'color: #000099; font-weight: bold;',
186  1 => 'color: #000099; font-weight: bold;',
187  2 => 'color: #660099; font-weight: bold;',
188  3 => 'color: #660099; font-weight: bold;',
189  4 => 'color: #660099; font-weight: bold;',
190  5 => 'color: #006699; font-weight: bold;',
191  'HARD' => '',
192  ),
193  'BRACKETS' => array(
194  0 => 'color: #008000;'
195  ),
196  'STRINGS' => array(
197  0 => 'color: #FF0000;'
198  ),
199  'NUMBERS' => array(
200  0 => 'color: #0000dd;',
201  GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;',
202  GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
203  GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
204  GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;',
205  GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
206  GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;',
207  GESHI_NUMBER_FLT_NONSCI => 'color:#800080;'
208  ),
209  'METHODS' => array(
210  1 => 'color: #007788;',
211  2 => 'color: #007788;'
212  ),
213  'SYMBOLS' => array(
214  0 => 'color: #008000;',
215  1 => 'color: #000080;',
216  2 => 'color: #000040;',
217  3 => 'color: #000040;',
218  4 => 'color: #008080;'
219  ),
220  'REGEXPS' => array(
221  ),
222  'SCRIPT' => array(
223  )
224  ),
225  'URLS' => array(
226  1 => '',
227  2 => '',
228  3 => '',
229  4 => ''
230  ),
231  'OOLANG' => true,
232  'OBJECT_SPLITTERS' => array(
233  1 => '.',
234  2 => '::'
235  ),
236  'REGEXPS' => array(
237  ),
238  'STRICT_MODE_APPLIES' => GESHI_NEVER,
239  'SCRIPT_DELIMITERS' => array(
240  ),
241  'HIGHLIGHT_STRICT_BLOCK' => array(
242  ),
243  'TAB_WIDTH' => 4,
244  'PARSER_CONTROL' => array(
245  'KEYWORDS' => array(
246  'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#])",
247  'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_\|%\\-])"
248  )
249  )
250 );
$language_data
Definition: cpp.php:53
const GESHI_NUMBER_INT_CSTYLE
Enhanced number format for integers like seen in C.
Definition: geshi.php:167
const GESHI_NUMBER_FLT_SCI_ZERO
Number format to highlight floating-point numbers with support for scientific notation (E) and requir...
Definition: geshi.php:195
const GESHI_NUMBER_FLT_NONSCI_F
Number format to highlight floating-point numbers without support for scientific notation.
Definition: geshi.php:191
const GESHI_COMMENTS
Used in language files to mark comments.
Definition: geshi.php:149
const GESHI_NUMBER_HEX_PREFIX
Number format to highlight hex numbers with a prefix 0x.
Definition: geshi.php:183
const GESHI_NUMBER_BIN_PREFIX_0B
Number format to highlight binary numbers with a prefix 0b (C)
Definition: geshi.php:173
const GESHI_NUMBER_FLT_NONSCI
Number format to highlight floating-point numbers without support for scientific notation.
Definition: geshi.php:189
Create styles array
The data for the language used.
const GESHI_NUMBER_FLT_SCI_SHORT
Number format to highlight floating-point numbers with support for scientific notation (E) and option...
Definition: geshi.php:193
const GESHI_NEVER
#+ private
Definition: geshi.php:123
const GESHI_NUMBER_INT_BASIC
Basic number format for integers.
Definition: geshi.php:165
const GESHI_CAPS_NO_CHANGE
Lowercase keywords found.
Definition: geshi.php:94
const GESHI_NUMBER_OCT_PREFIX
Number format to highlight octal numbers with a leading zero.
Definition: geshi.php:175