1 | Prism.languages.ocaml = {
|
2 | 'comment': /\(\*[\s\S]*?\*\)/,
|
3 | 'string': [
|
4 | {
|
5 | pattern: /"(?:\\.|[^\\\r\n"])*"/,
|
6 | greedy: true
|
7 | },
|
8 | {
|
9 | pattern: /(['`])(?:\\(?:\d+|x[\da-f]+|.)|(?!\1)[^\\\r\n])\1/i,
|
10 | greedy: true
|
11 | }
|
12 | ],
|
13 | 'number': /\b(?:0x[\da-f][\da-f_]+|(?:0[bo])?\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?[\d_]+)?)/i,
|
14 | 'directive': {
|
15 | pattern: /\B#\w+/,
|
16 | alias: 'important'
|
17 | },
|
18 | 'label': {
|
19 | pattern: /\B~\w+/,
|
20 | alias: 'function'
|
21 | },
|
22 | 'type-variable': {
|
23 | pattern: /\B'\w+/,
|
24 | alias: 'function'
|
25 | },
|
26 | 'variant': {
|
27 | pattern: /`\w+/,
|
28 | alias: 'variable'
|
29 | },
|
30 | 'module': {
|
31 | pattern: /\b[A-Z]\w+/,
|
32 | alias: 'variable'
|
33 | },
|
34 |
|
35 |
|
36 | 'keyword': /\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,
|
37 | 'boolean': /\b(?:false|true)\b/,
|
38 |
|
39 | 'operator': /:=|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,
|
40 | 'punctuation': /[(){}\[\]|.,:;]|\b_\b/
|
41 | };
|