ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
fsharp.php
Go to the documentation of this file.
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.9.0
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
44 'LANG_NAME' => 'F#',
45 'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
46 'COMMENT_MULTI' => array('/*' => '*/'),
47 'COMMENT_REGEXP' => array(3 => '/\‍(\*(?!\‍)).*?\*\‍)/s'),
48 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
49 'QUOTEMARKS' => array("'", '"'),
50 'HARDQUOTE' => array('@"', '"'),
51 'HARDESCAPE' => array('"'),
52 'HARDCHAR' => '"',
53 'ESCAPE_CHAR' => '\\',
54 'KEYWORDS' => array(
55 /* main F# keywords */
56 /* section 3.4 */
57 1 => array(
58 'abstract', 'and', 'as', 'assert', 'base', 'begin', 'class', 'default', 'delegate', 'do', 'done',
59 'downcast', 'downto', 'elif', 'else', 'end', 'exception', 'extern', 'false', 'finally', 'for',
60 'fun', 'function', 'if', 'in', 'inherit', 'inline', 'interface', 'internal', 'lazy', 'let',
61 'match', 'member', 'module', 'mutable', 'namespace', 'new', 'not', 'null', 'of', 'open', 'or',
62 'override', 'private', 'public', 'rec', 'return', 'sig', 'static', 'struct', 'then', 'to',
63 'true', 'try', 'type', 'upcast', 'use', 'val', 'void', 'when', 'while', 'with', 'yield',
64 'asr', 'land', 'lor', 'lsl', 'lsr', 'lxor', 'mod',
65 /* identifiers are reserved for future use by F# */
66 'atomic', 'break', 'checked', 'component', 'const', 'constraint', 'constructor',
67 'continue', 'eager', 'fixed', 'fori', 'functor', 'global', 'include', 'method', 'mixin',
68 'object', 'parallel', 'params', 'process', 'protected', 'pure', 'sealed', 'tailcall',
69 'trait', 'virtual', 'volatile',
70 /* take monads into account */
71 'let!', 'yield!'
72 ),
73 /* define names of main libraries in F# Core, so we can link to it
74 * http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html
75 */
76 2 => array(
77 'Array', 'Array2D', 'Array3D', 'Array4D', 'ComparisonIdentity', 'HashIdentity', 'List',
78 'Map', 'Seq', 'SequenceExpressionHelpers', 'Set', 'CommonExtensions', 'Event',
79 'ExtraTopLevelOperators', 'LanguagePrimitives', 'NumericLiterals', 'Operators',
80 'OptimizedClosures', 'Option', 'String', 'NativePtr', 'Printf'
81 ),
82 /* 17.2 & 17.3 */
83 3 => array(
84 'abs', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', 'cosh', 'exp',
85 'floor', 'log', 'log10', 'pown', 'round', 'sign', 'sin', 'sinh', 'sqrt',
86 'tan', 'tanh',
87 'ignore',
88 'fst', 'snd',
89 'stdin', 'stdout', 'stderr',
90 'KeyValue',
91 'max', 'min'
92 ),
93 /* Pervasives Types & Overloaded Conversion Functions */
94 4 => array(
95 'bool', 'byref', 'byte', 'char', 'decimal', 'double', 'exn', 'float', 'float32',
96 'FuncConvert', 'ilsigptr', 'int', 'int16', 'int32', 'int64', 'int8',
97 'nativeint', 'nativeptr', 'obj', 'option', 'ref', 'sbyte', 'single', 'string', 'uint16',
98 'uint32', 'uint64', 'uint8', 'unativeint', 'unit',
99 'enum',
100 'async', 'seq', 'dict'
101 ),
102 /* 17.2 Exceptions */
103 5 => array (
104 'failwith', 'invalidArg', 'raise', 'rethrow'
105 ),
106 /* 3.3 Conditional compilation & 13.3 Compiler Directives + light / light off */
107 6 => array(
108 '(*IF-FSHARP', 'ENDIF-FSHARP*)', '(*F#', 'F#*)', '(*IF-OCAML', 'ENDIF-OCAML*)',
109 '#light',
110 '#if', '#else', '#endif', '#indent', '#nowarn', '#r', '#reference',
111 '#I', '#Include', '#load', '#time', '#help', '#q', '#quit',
112 ),
113 /* 3.11 Pre-processor Declarations / Identifier Replacements */
114 7 => array(
115 '__SOURCE_DIRECTORY__', '__SOURCE_FILE__', '__LINE__'
116 ),
117 /* 17.2 Object Transformation Operators */
118 8 => array(
119 'box', 'hash', 'sizeof', 'typeof', 'typedefof', 'unbox'
120 )
121 ),
122 /* 17.2 basic operators + the yield and yield! arrows */
123 'SYMBOLS' => array(
124 1 => array('+', '-', '/', '*', '**', '%', '~-'),
125 2 => array('<', '<=', '>', '<=', '=', '<>'),
126 3 => array('<<<', '>>>', '^^^', '&&&', '|||', '~~~'),
127 4 => array('|>', '>>', '<|', '<<'),
128 5 => array('!', '->', '->>'),
129 6 => array('[',']','(',')','{','}', '[|', '|]', '(|', '|)'),
130 7 => array(':=', ';', ';;')
131 ),
132 'CASE_SENSITIVE' => array(
133 GESHI_COMMENTS => false,
134 1 => true, /* keywords */
135 2 => true, /* modules */
136 3 => true, /* pervasives functions */
137 4 => true, /* types and overloaded conversion operators */
138 5 => true, /* exceptions */
139 6 => true, /* conditional compilation & compiler Directives */
140 7 => true, /* pre-processor declarations / identifier replacements */
141 8 => true /* object transformation operators */
142 ),
143 'STYLES' => array(
144 'KEYWORDS' => array(
145 1 => 'color: #06c; font-weight: bold;', /* nice blue */
146 2 => 'color: #06c; font-weight: bold;', /* nice blue */
147 3 => 'color: #06c; font-weight: bold;', /* nice blue */
148 4 => 'color: #06c; font-weight: bold;', /* nice blue */
149 5 => 'color: #06c; font-weight: bold;', /* nice blue */
150 6 => 'color: #06c; font-weight: bold;', /* nice blue */
151 7 => 'color: #06c; font-weight: bold;', /* nice blue */
152 8 => 'color: #06c; font-weight: bold;' /* nice blue */
153 ),
154 'COMMENTS' => array(
155 'MULTI' => 'color: #5d478b; font-style: italic;', /* light purple */
156 1 => 'color: #5d478b; font-style: italic;',
157 2 => 'color: #5d478b; font-style: italic;', /* light purple */
158 3 => 'color: #5d478b; font-style: italic;' /* light purple */
159 ),
160 'ESCAPE_CHAR' => array(
161 ),
162 'BRACKETS' => array(
163 0 => 'color: #6c6;'
164 ),
165 'STRINGS' => array(
166 0 => 'color: #3cb371;' /* nice green */
167 ),
168 'NUMBERS' => array(
169 0 => 'color: #c6c;' /* pink */
170 ),
171 'METHODS' => array(
172 1 => 'color: #060;' /* dark green */
173 ),
174 'REGEXPS' => array(
175 ),
176 'SYMBOLS' => array(
177 0 => 'color: #a52a2a;' /* maroon */
178 ),
179 'SCRIPT' => array(
180 )
181 ),
182 'URLS' => array(
183 /* some of keywords are Pervasives functions (land, lxor, asr, ...) */
184 1 => '',
185 2 => 'http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/namespaces.html',
186 3 => '',
187 4 => '',
188 5 => '',
189 6 => '',
190 7 => '',
191 8 => ''
192 ),
193 'OOLANG' => true,
194 'OBJECT_SPLITTERS' => array(
195 1 => '.'
196 ),
197 'REGEXPS' => array(
198 ),
199 'STRICT_MODE_APPLIES' => GESHI_NEVER,
200 'SCRIPT_DELIMITERS' => array(
201 ),
202 'HIGHLIGHT_STRICT_BLOCK' => array(
203 ),
204 'TAB_WIDTH' => 4,
205 'PARSER_CONTROL' => array(
206 'KEYWORDS' => array(
207 'DISALLOWED_BEFORE' => "(?<![a-zA-Z0-9\$_\|\#>|^])",
208 'DISALLOWED_AFTER' => "(?![a-zA-Z0-9_<\|%\\-])"
209 )
210 )
211);
An exception for terminatinating execution or to throw for unit testing.
$language_data
Definition: fsharp.php:43
const GESHI_CAPS_NO_CHANGE
Lowercase keywords found.
Definition: geshi.php:94
const GESHI_COMMENTS
Used in language files to mark comments.
Definition: geshi.php:149
const GESHI_NEVER
#+ @access private
Definition: geshi.php:123