1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | function ocaml(hljs) {
|
11 |
|
12 | return {
|
13 | name: 'OCaml',
|
14 | aliases: ['ml'],
|
15 | keywords: {
|
16 | $pattern: '[a-z_]\\w*!?',
|
17 | keyword:
|
18 | 'and as assert asr begin class constraint do done downto else end ' +
|
19 | 'exception external for fun function functor if in include ' +
|
20 | 'inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method ' +
|
21 | 'mod module mutable new object of open! open or private rec sig struct ' +
|
22 | 'then to try type val! val virtual when while with ' +
|
23 |
|
24 | 'parser value',
|
25 | built_in:
|
26 |
|
27 | 'array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit ' +
|
28 |
|
29 | 'in_channel out_channel ref',
|
30 | literal:
|
31 | 'true false'
|
32 | },
|
33 | illegal: /\/\/|>>/,
|
34 | contains: [
|
35 | {
|
36 | className: 'literal',
|
37 | begin: '\\[(\\|\\|)?\\]|\\(\\)',
|
38 | relevance: 0
|
39 | },
|
40 | hljs.COMMENT(
|
41 | '\\(\\*',
|
42 | '\\*\\)',
|
43 | {
|
44 | contains: ['self']
|
45 | }
|
46 | ),
|
47 | {
|
48 | className: 'symbol',
|
49 | begin: '\'[A-Za-z_](?!\')[\\w\']*'
|
50 |
|
51 | },
|
52 | {
|
53 | className: 'type',
|
54 | begin: '`[A-Z][\\w\']*'
|
55 | },
|
56 | {
|
57 | className: 'type',
|
58 | begin: '\\b[A-Z][\\w\']*',
|
59 | relevance: 0
|
60 | },
|
61 | {
|
62 | begin: '[a-z_]\\w*\'[\\w\']*', relevance: 0
|
63 | },
|
64 | hljs.inherit(hljs.APOS_STRING_MODE, {className: 'string', relevance: 0}),
|
65 | hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null}),
|
66 | {
|
67 | className: 'number',
|
68 | begin:
|
69 | '\\b(0[xX][a-fA-F0-9_]+[Lln]?|' +
|
70 | '0[oO][0-7_]+[Lln]?|' +
|
71 | '0[bB][01_]+[Lln]?|' +
|
72 | '[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)',
|
73 | relevance: 0
|
74 | },
|
75 | {
|
76 | begin: /->/
|
77 | }
|
78 | ]
|
79 | }
|
80 | }
|
81 |
|
82 | export { ocaml as default };
|