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.

213 lines
8.6KB

  1. <?php
  2. /*************************************************************************************
  3. * fsharp.php
  4. * ----------
  5. * Author: julien ortin (jo_spam-divers@yahoo.fr)
  6. * Copyright: (c) 2009 julien ortin
  7. * Release Version: 1.0.8.11
  8. * Date Started: 2009/09/20
  9. *
  10. * F# language file for GeSHi.
  11. *
  12. * CHANGES
  13. * -------
  14. * 2009/09/22 (1.0.1)
  15. * - added rules for single char handling (generics ['a] vs char ['x'])
  16. * - added symbols and keywords
  17. * 2009/09/20 (1.0.0)
  18. * - Initial release
  19. *
  20. * TODO
  21. * -------------------------
  22. *
  23. *************************************************************************************
  24. *
  25. * This file is part of GeSHi.
  26. *
  27. * GeSHi is free software; you can redistribute it and/or modify
  28. * it under the terms of the GNU General Public License as published by
  29. * the Free Software Foundation; either version 2 of the License, or
  30. * (at your option) any later version.
  31. *
  32. * GeSHi is distributed in the hope that it will be useful,
  33. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  35. * GNU General Public License for more details.
  36. *
  37. * You should have received a copy of the GNU General Public License
  38. * along with GeSHi; if not, write to the Free Software
  39. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  40. *
  41. ************************************************************************************/
  42. $language_data = array(
  43. 'LANG_NAME' => 'F#',
  44. 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
  45. 'COMMENT_MULTI' => array('/*' => '*/'),
  46. 'COMMENT_REGEXP' => array(3 => '/\(\*(?!\)).*?\*\)/s'),
  47. 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
  48. 'QUOTEMARKS' => array("'", '"'),
  49. 'HARDQUOTE' => array('@"', '"'),
  50. 'HARDESCAPE' => array('"'),
  51. 'HARDCHAR' => '"',
  52. 'ESCAPE_CHAR' => '\\',
  53. 'KEYWORDS' => array(
  54. /* main F# keywords */
  55. /* section 3.4 */
  56. 1 => array(
  57. 'abstract', 'and', 'as', 'assert', 'base', 'begin', 'class', 'default', 'delegate', 'do', 'done',
  58. 'downcast', 'downto', 'elif', 'else', 'end', 'exception', 'extern', 'false', 'finally', 'for',
  59. 'fun', 'function', 'if', 'in', 'inherit', 'inline', 'interface', 'internal', 'lazy', 'let',
  60. 'match', 'member', 'module', 'mutable', 'namespace', 'new', 'not', 'null', 'of', 'open', 'or',
  61. 'override', 'private', 'public', 'rec', 'return', 'sig', 'static', 'struct', 'then', 'to',
  62. 'true', 'try', 'type', 'upcast', 'use', 'val', 'void', 'when', 'while', 'with', 'yield',
  63. 'asr', 'land', 'lor', 'lsl', 'lsr', 'lxor', 'mod',
  64. /* identifiers are reserved for future use by F# */
  65. 'atomic', 'break', 'checked', 'component', 'const', 'constraint', 'constructor',
  66. 'continue', 'eager', 'fixed', 'fori', 'functor', 'global', 'include', 'method', 'mixin',
  67. 'object', 'parallel', 'params', 'process', 'protected', 'pure', 'sealed', 'tailcall',
  68. 'trait', 'virtual', 'volatile',
  69. /* take monads into account */
  70. 'let!', 'yield!'
  71. ),
  72. /* define names of main libraries in F# Core, so we can link to it
  73. * http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
  74. */
  75. 2 => array(
  76. 'Array', 'Array2D', 'Array3D', 'Array4D', 'ComparisonIdentity', 'HashIdentity', 'List',
  77. 'Map', 'Seq', 'SequenceExpressionHelpers', 'Set', 'CommonExtensions', 'Event',
  78. 'ExtraTopLevelOperators', 'LanguagePrimitives', 'NumericLiterals', 'Operators',
  79. 'OptimizedClosures', 'Option', 'String', 'NativePtr', 'Printf'
  80. ),
  81. /* 17.2 & 17.3 */
  82. 3 => array(
  83. 'abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'exp',
  84. 'floor', 'log', 'log10', 'pown', 'round', 'sign', 'sin', 'sinh', 'sqrt',
  85. 'tan', 'tanh',
  86. 'ignore',
  87. 'fst', 'snd',
  88. 'stdin', 'stdout', 'stderr',
  89. 'KeyValue',
  90. 'max', 'min'
  91. ),
  92. /* Pervasives Types & Overloaded Conversion Functions */
  93. 4 => array(
  94. 'bool', 'byref', 'byte', 'char', 'decimal', 'double', 'exn', 'float', 'float32',
  95. 'FuncConvert', 'ilsigptr', 'int', 'int16', 'int32', 'int64', 'int8',
  96. 'nativeint', 'nativeptr', 'obj', 'option', 'ref', 'sbyte', 'single', 'string', 'uint16',
  97. 'uint32', 'uint64', 'uint8', 'unativeint', 'unit',
  98. 'enum',
  99. 'async', 'seq', 'dict'
  100. ),
  101. /* 17.2 Exceptions */
  102. 5 => array (
  103. 'failwith', 'invalidArg', 'raise', 'rethrow'
  104. ),
  105. /* 3.3 Conditional compilation & 13.3 Compiler Directives + light / light off */
  106. 6 => array(
  107. '(*IF-FSHARP', 'ENDIF-FSHARP*)', '(*F#', 'F#*)', '(*IF-OCAML', 'ENDIF-OCAML*)',
  108. '#light',
  109. '#if', '#else', '#endif', '#indent', '#nowarn', '#r', '#reference',
  110. '#I', '#Include', '#load', '#time', '#help', '#q', '#quit',
  111. ),
  112. /* 3.11 Pre-processor Declarations / Identifier Replacements */
  113. 7 => array(
  114. '__SOURCE_DIRECTORY__', '__SOURCE_FILE__', '__LINE__'
  115. ),
  116. /* 17.2 Object Transformation Operators */
  117. 8 => array(
  118. 'box', 'hash', 'sizeof', 'typeof', 'typedefof', 'unbox'
  119. )
  120. ),
  121. /* 17.2 basic operators + the yield and yield! arrows */
  122. 'SYMBOLS' => array(
  123. 1 => array('+', '-', '/', '*', '**', '%', '~-'),
  124. 2 => array('<', '<=', '>', '<=', '=', '<>'),
  125. 3 => array('<<<', '>>>', '^^^', '&&&', '|||', '~~~'),
  126. 4 => array('|>', '>>', '<|', '<<'),
  127. 5 => array('!', '->', '->>'),
  128. 6 => array('[',']','(',')','{','}', '[|', '|]', '(|', '|)'),
  129. 7 => array(':=', ';', ';;')
  130. ),
  131. 'CASE_SENSITIVE' => array(
  132. GESHI_COMMENTS => false,
  133. 1 => true, /* keywords */
  134. 2 => true, /* modules */
  135. 3 => true, /* pervasives functions */
  136. 4 => true, /* types and overloaded conversion operators */
  137. 5 => true, /* exceptions */
  138. 6 => true, /* conditional compilation & compiler Directives */
  139. 7 => true, /* pre-processor declarations / identifier replacements */
  140. 8 => true /* object transformation operators */
  141. ),
  142. 'STYLES' => array(
  143. 'KEYWORDS' => array(
  144. 1 => 'color: #06c; font-weight: bold;', /* nice blue */
  145. 2 => 'color: #06c; font-weight: bold;', /* nice blue */
  146. 3 => 'color: #06c; font-weight: bold;', /* nice blue */
  147. 4 => 'color: #06c; font-weight: bold;', /* nice blue */
  148. 5 => 'color: #06c; font-weight: bold;', /* nice blue */
  149. 6 => 'color: #06c; font-weight: bold;', /* nice blue */
  150. 7 => 'color: #06c; font-weight: bold;', /* nice blue */
  151. 8 => 'color: #06c; font-weight: bold;' /* nice blue */
  152. ),
  153. 'COMMENTS' => array(
  154. 'MULTI' => 'color: #5d478b; font-style: italic;', /* light purple */
  155. 1 => 'color: #5d478b; font-style: italic;',
  156. 2 => 'color: #5d478b; font-style: italic;', /* light purple */
  157. 3 => 'color: #5d478b; font-style: italic;' /* light purple */
  158. ),
  159. 'ESCAPE_CHAR' => array(
  160. ),
  161. 'BRACKETS' => array(
  162. 0 => 'color: #6c6;'
  163. ),
  164. 'STRINGS' => array(
  165. 0 => 'color: #3cb371;' /* nice green */
  166. ),
  167. 'NUMBERS' => array(
  168. 0 => 'color: #c6c;' /* pink */
  169. ),
  170. 'METHODS' => array(
  171. 1 => 'color: #060;' /* dark green */
  172. ),
  173. 'REGEXPS' => array(
  174. ),
  175. 'SYMBOLS' => array(
  176. 0 => 'color: #a52a2a;' /* maroon */
  177. ),
  178. 'SCRIPT' => array(
  179. )
  180. ),
  181. 'URLS' => array(
  182. /* some of keywords are Pervasives functions (land, lxor, asr, ...) */
  183. 1 => '',
  184. 2 => 'http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html',
  185. 3 => '',
  186. 4 => '',
  187. 5 => '',
  188. 6 => '',
  189. 7 => '',
  190. 8 => ''
  191. ),
  192. 'OOLANG' => true,
  193. 'OBJECT_SPLITTERS' => array(
  194. 1 => '.'
  195. ),
  196. 'REGEXPS' => array(
  197. ),
  198. 'STRICT_MODE_APPLIES' => GESHI_NEVER,
  199. 'SCRIPT_DELIMITERS' => array(
  200. ),
  201. 'HIGHLIGHT_STRICT_BLOCK' => array(
  202. ),
  203. 'TAB_WIDTH' => 4,
  204. 'PARSER_CONTROL' => array(
  205. 'KEYWORDS' => array(
  206. 'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#>|^])",
  207. 'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_<\|%\\-])"
  208. )
  209. )
  210. );
  211. ?>