KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
9.9KB

  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.8.11
  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. $language_data = array (
  51. 'LANG_NAME' => 'C++',
  52. 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
  53. 'COMMENT_MULTI' => array('/*' => '*/'),
  54. 'COMMENT_REGEXP' => array(
  55. //Multiline-continued single-line comments
  56. 1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m',
  57. //Multiline-continued preprocessor define
  58. 2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m'
  59. ),
  60. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  61. 'QUOTEMARKS' => array("'", '"'),
  62. 'ESCAPE_CHAR' => '',
  63. 'ESCAPE_REGEXP' => array(
  64. //Simple Single Char Escapes
  65. 1 => "#\\\\[abfnrtv\\\'\"?\n]#i",
  66. //Hexadecimal Char Specs
  67. 2 => "#\\\\x[\da-fA-F]{2}#",
  68. //Hexadecimal Char Specs
  69. 3 => "#\\\\u[\da-fA-F]{4}#",
  70. //Hexadecimal Char Specs
  71. 4 => "#\\\\U[\da-fA-F]{8}#",
  72. //Octal Char Specs
  73. 5 => "#\\\\[0-7]{1,3}#"
  74. ),
  75. 'NUMBERS' =>
  76. GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B |
  77. GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI |
  78. GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO,
  79. 'KEYWORDS' => array(
  80. 1 => array(
  81. 'break', 'case', 'continue', 'default', 'do', 'else', 'for', 'goto', 'if', 'return',
  82. 'switch', 'throw', 'while'
  83. ),
  84. 2 => array(
  85. 'NULL', 'false', 'true', 'enum', 'errno', 'EDOM',
  86. 'ERANGE', 'FLT_RADIX', 'FLT_ROUNDS', 'FLT_DIG', 'DBL_DIG', 'LDBL_DIG',
  87. 'FLT_EPSILON', 'DBL_EPSILON', 'LDBL_EPSILON', 'FLT_MANT_DIG', 'DBL_MANT_DIG',
  88. 'LDBL_MANT_DIG', 'FLT_MAX', 'DBL_MAX', 'LDBL_MAX', 'FLT_MAX_EXP', 'DBL_MAX_EXP',
  89. 'LDBL_MAX_EXP', 'FLT_MIN', 'DBL_MIN', 'LDBL_MIN', 'FLT_MIN_EXP', 'DBL_MIN_EXP',
  90. 'LDBL_MIN_EXP', 'CHAR_BIT', 'CHAR_MAX', 'CHAR_MIN', 'SCHAR_MAX', 'SCHAR_MIN',
  91. 'UCHAR_MAX', 'SHRT_MAX', 'SHRT_MIN', 'USHRT_MAX', 'INT_MAX', 'INT_MIN',
  92. 'UINT_MAX', 'LONG_MAX', 'LONG_MIN', 'ULONG_MAX', 'HUGE_VAL', 'SIGABRT',
  93. 'SIGFPE', 'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_ERR',
  94. 'SIG_IGN', 'BUFSIZ', 'EOF', 'FILENAME_MAX', 'FOPEN_MAX', 'L_tmpnam',
  95. 'SEEK_CUR', 'SEEK_END', 'SEEK_SET', 'TMP_MAX', 'stdin', 'stdout', 'stderr',
  96. 'EXIT_FAILURE', 'EXIT_SUCCESS', 'RAND_MAX', 'CLOCKS_PER_SEC',
  97. 'virtual', 'public', 'private', 'protected', 'template', 'using', 'namespace',
  98. 'try', 'catch', 'inline', 'dynamic_cast', 'const_cast', 'reinterpret_cast',
  99. 'static_cast', 'explicit', 'friend', 'typename', 'typeid', 'class'
  100. ),
  101. 3 => array(
  102. 'cin', 'cerr', 'clog', 'cout', 'delete', 'new', 'this',
  103. 'printf', 'fprintf', 'snprintf', 'sprintf', 'assert',
  104. 'isalnum', 'isalpha', 'isdigit', 'iscntrl', 'isgraph', 'islower', 'isprint',
  105. 'ispunct', 'isspace', 'isupper', 'isxdigit', 'tolower', 'toupper',
  106. 'exp', 'log', 'log10', 'pow', 'sqrt', 'ceil', 'floor', 'fabs', 'ldexp',
  107. 'frexp', 'modf', 'fmod', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', 'atan2',
  108. 'sinh', 'cosh', 'tanh', 'setjmp', 'longjmp',
  109. 'va_start', 'va_arg', 'va_end', 'offsetof', 'sizeof', 'fopen', 'freopen',
  110. 'fflush', 'fclose', 'remove', 'rename', 'tmpfile', 'tmpname', 'setvbuf',
  111. 'setbuf', 'vfprintf', 'vprintf', 'vsprintf', 'fscanf', 'scanf', 'sscanf',
  112. 'fgetc', 'fgets', 'fputc', 'fputs', 'getc', 'getchar', 'gets', 'putc',
  113. 'putchar', 'puts', 'ungetc', 'fread', 'fwrite', 'fseek', 'ftell', 'rewind',
  114. 'fgetpos', 'fsetpos', 'clearerr', 'feof', 'ferror', 'perror', 'abs', 'labs',
  115. 'div', 'ldiv', 'atof', 'atoi', 'atol', 'strtod', 'strtol', 'strtoul', 'calloc',
  116. 'malloc', 'realloc', 'free', 'abort', 'exit', 'atexit', 'system', 'getenv',
  117. 'bsearch', 'qsort', 'rand', 'srand', 'strcpy', 'strncpy', 'strcat', 'strncat',
  118. 'strcmp', 'strncmp', 'strcoll', 'strchr', 'strrchr', 'strspn', 'strcspn',
  119. 'strpbrk', 'strstr', 'strlen', 'strerror', 'strtok', 'strxfrm', 'memcpy',
  120. 'memmove', 'memcmp', 'memchr', 'memset', 'clock', 'time', 'difftime', 'mktime',
  121. 'asctime', 'ctime', 'gmtime', 'localtime', 'strftime'
  122. ),
  123. 4 => array(
  124. 'auto', 'bool', 'char', 'const', 'double', 'float', 'int', 'long', 'longint',
  125. 'register', 'short', 'shortint', 'signed', 'static', 'struct',
  126. 'typedef', 'union', 'unsigned', 'void', 'volatile', 'extern', 'jmp_buf',
  127. 'signal', 'raise', 'va_list', 'ptrdiff_t', 'size_t', 'FILE', 'fpos_t',
  128. 'div_t', 'ldiv_t', 'clock_t', 'time_t', 'tm', 'wchar_t',
  129. 'int8', 'int16', 'int32', 'int64',
  130. 'uint8', 'uint16', 'uint32', 'uint64',
  131. 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 'int_fast64_t',
  132. 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
  133. 'int_least8_t', 'int_least16_t', 'int_least32_t', 'int_least64_t',
  134. 'uint_least8_t', 'uint_least16_t', 'uint_least32_t', 'uint_least64_t',
  135. 'int8_t', 'int16_t', 'int32_t', 'int64_t',
  136. 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
  137. 'intmax_t', 'uintmax_t', 'intptr_t', 'uintptr_t'
  138. ),
  139. ),
  140. 'SYMBOLS' => array(
  141. 0 => array('(', ')', '{', '}', '[', ']'),
  142. 1 => array('<', '>','='),
  143. 2 => array('+', '-', '*', '/', '%'),
  144. 3 => array('!', '^', '&', '|'),
  145. 4 => array('?', ':', ';')
  146. ),
  147. 'CASE_SENSITIVE' => array(
  148. GESHI_COMMENTS => false,
  149. 1 => true,
  150. 2 => true,
  151. 3 => true,
  152. 4 => true,
  153. ),
  154. 'STYLES' => array(
  155. 'KEYWORDS' => array(
  156. 1 => 'color: #0000ff;',
  157. 2 => 'color: #0000ff;',
  158. 3 => 'color: #0000dd;',
  159. 4 => 'color: #0000ff;'
  160. ),
  161. 'COMMENTS' => array(
  162. 1 => 'color: #666666;',
  163. 2 => 'color: #339900;',
  164. 'MULTI' => 'color: #ff0000; font-style: italic;'
  165. ),
  166. 'ESCAPE_CHAR' => array(
  167. 0 => 'color: #000099; font-weight: bold;',
  168. 1 => 'color: #000099; font-weight: bold;',
  169. 2 => 'color: #660099; font-weight: bold;',
  170. 3 => 'color: #660099; font-weight: bold;',
  171. 4 => 'color: #660099; font-weight: bold;',
  172. 5 => 'color: #006699; font-weight: bold;',
  173. 'HARD' => '',
  174. ),
  175. 'BRACKETS' => array(
  176. 0 => 'color: #008000;'
  177. ),
  178. 'STRINGS' => array(
  179. 0 => 'color: #FF0000;'
  180. ),
  181. 'NUMBERS' => array(
  182. 0 => 'color: #0000dd;',
  183. GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;',
  184. GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
  185. GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
  186. GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;',
  187. GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
  188. GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;',
  189. GESHI_NUMBER_FLT_NONSCI => 'color:#800080;'
  190. ),
  191. 'METHODS' => array(
  192. 1 => 'color: #007788;',
  193. 2 => 'color: #007788;'
  194. ),
  195. 'SYMBOLS' => array(
  196. 0 => 'color: #008000;',
  197. 1 => 'color: #000080;',
  198. 2 => 'color: #000040;',
  199. 3 => 'color: #000040;',
  200. 4 => 'color: #008080;'
  201. ),
  202. 'REGEXPS' => array(
  203. ),
  204. 'SCRIPT' => array(
  205. )
  206. ),
  207. 'URLS' => array(
  208. 1 => '',
  209. 2 => '',
  210. 3 => '',
  211. 4 => ''
  212. ),
  213. 'OOLANG' => true,
  214. 'OBJECT_SPLITTERS' => array(
  215. 1 => '.',
  216. 2 => '::'
  217. ),
  218. 'REGEXPS' => array(
  219. ),
  220. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  221. 'SCRIPT_DELIMITERS' => array(
  222. ),
  223. 'HIGHLIGHT_STRICT_BLOCK' => array(
  224. ),
  225. 'TAB_WIDTH' => 4,
  226. 'PARSER_CONTROL' => array(
  227. 'KEYWORDS' => array(
  228. 'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#])",
  229. 'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_\|%\\-])"
  230. )
  231. )
  232. );
  233. ?>