]> luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/reasonml.js
Initial commit.
[flow-web.git] / static / highlight / es / languages / reasonml.js
1 /*! `reasonml` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar = (function () {
3 'use strict';
4
5 /*
6 Language: ReasonML
7 Description: Reason lets you write simple, fast and quality type safe code while leveraging both the JavaScript & OCaml ecosystems.
8 Website: https://reasonml.github.io
9 Author: Gidi Meir Morris <oss@gidi.io>
10 Category: functional
11 */
12 function reasonml(hljs) {
13 const BUILT_IN_TYPES = [
14 "array",
15 "bool",
16 "bytes",
17 "char",
18 "exn|5",
19 "float",
20 "int",
21 "int32",
22 "int64",
23 "list",
24 "lazy_t|5",
25 "nativeint|5",
26 "ref",
27 "string",
28 "unit",
29 ];
30 return {
31 name: 'ReasonML',
32 aliases: [ 're' ],
33 keywords: {
34 $pattern: /[a-z_]\w*!?/,
35 keyword: [
36 "and",
37 "as",
38 "asr",
39 "assert",
40 "begin",
41 "class",
42 "constraint",
43 "do",
44 "done",
45 "downto",
46 "else",
47 "end",
48 "esfun",
49 "exception",
50 "external",
51 "for",
52 "fun",
53 "function",
54 "functor",
55 "if",
56 "in",
57 "include",
58 "inherit",
59 "initializer",
60 "land",
61 "lazy",
62 "let",
63 "lor",
64 "lsl",
65 "lsr",
66 "lxor",
67 "mod",
68 "module",
69 "mutable",
70 "new",
71 "nonrec",
72 "object",
73 "of",
74 "open",
75 "or",
76 "pri",
77 "pub",
78 "rec",
79 "sig",
80 "struct",
81 "switch",
82 "then",
83 "to",
84 "try",
85 "type",
86 "val",
87 "virtual",
88 "when",
89 "while",
90 "with",
91 ],
92 built_in: BUILT_IN_TYPES,
93 literal: ["true", "false"],
94 },
95 illegal: /(:-|:=|\$\{|\+=)/,
96 contains: [
97 {
98 scope: 'literal',
99 match: /\[(\|\|)?\]|\(\)/,
100 relevance: 0
101 },
102 hljs.C_LINE_COMMENT_MODE,
103 hljs.COMMENT(/\/\*/, /\*\//, { illegal: /^(#,\/\/)/ }),
104 { /* type variable */
105 scope: 'symbol',
106 match: /\'[A-Za-z_](?!\')[\w\']*/
107 /* the grammar is ambiguous on how 'a'b should be interpreted but not the compiler */
108 },
109 { /* polymorphic variant */
110 scope: 'type',
111 match: /`[A-Z][\w\']*/
112 },
113 { /* module or constructor */
114 scope: 'type',
115 match: /\b[A-Z][\w\']*/,
116 relevance: 0
117 },
118 { /* don't color identifiers, but safely catch all identifiers with ' */
119 match: /[a-z_]\w*\'[\w\']*/,
120 relevance: 0
121 },
122 {
123 scope: 'operator',
124 match: /\s+(\|\||\+[\+\.]?|\*[\*\/\.]?|\/[\.]?|\.\.\.|\|>|&&|===?)\s+/,
125 relevance: 0
126 },
127 hljs.inherit(hljs.APOS_STRING_MODE, {
128 scope: 'string',
129 relevance: 0
130 }),
131 hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }),
132 {
133 scope: 'number',
134 variants: [
135 { match: /\b0[xX][a-fA-F0-9_]+[Lln]?/ },
136 { match: /\b0[oO][0-7_]+[Lln]?/ },
137 { match: /\b0[bB][01_]+[Lln]?/ },
138 { match: /\b[0-9][0-9_]*([Lln]|(\.[0-9_]*)?([eE][-+]?[0-9_]+)?)/ },
139 ],
140 relevance: 0
141 },
142 ]
143 };
144 }
145
146 return reasonml;
147
148 })();
149 ;
150 export default hljsGrammar;