-
Notifications
You must be signed in to change notification settings - Fork 9
/
Reason.JSON-tmLanguage
213 lines (213 loc) · 7.93 KB
/
Reason.JSON-tmLanguage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
{ "name": "Reason",
"scopeName": "source.reason",
"fileTypes": ["re", "rei"],
"foldingStartMarker": "^.*\\bfun\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$",
"foldingStopMarker": "^\\s*\\}",
"patterns": [
{"include": "#reason_comment_doc_block"},
{"include": "#reason_comment_block"},
{"include": "#reason_comment"},
{"include": "#reason_named_arg"},
{"include": "#reason_module"},
{"include": "#reason_lifetime"},
{"include": "#reason_self"},
{"include": "#reason_string"},
{"include": "#reason_raw_string"},
{
"name": "string.quoted.single.source.reason",
"match": "\\'([^\\'\\\\]|\\\\(x[0-9A-Fa-f]{2}|u\\{[0-9A-Fa-f]{1,6}\\}|.))\\'"
},
{"name": "meta.function.source.reason",
"match": "\\b(fun)\\s+([a-zA-Z_][a-zA-Z0-9_]?[\\w\\:,+ \\'<>?]*)\\s*(?:\\()",
"captures": {
"1": {"name": "keyword.source.reason"},
"2": {"name": "entity.name.function.source.reason"}
}
},
{
"name": "meta.initialization.reason",
"match": "(let|and)\\s+(module\\s+)(rec\\s+)?([[:alpha:]_][[:alnum:]_]*)\\s*(:[^=]*)?(=?)",
"captures": {
"1": {"name": "keyword.source.reason"},
"2": {"name": "keyword.source.reason"},
"3": {"name": "keyword.source.reason"},
"4": {"name": "variable.other.reason"},
"5": {"name": "storage.type.source.reason"},
"6": {"name": "keyword.operator.reason"}
},
"comment": "This matches the 'let x = val' style of variable intitialization."
},
{
"name": "meta.initialization.reason",
"match": "(let)\\s+(rec\\s+)?([[:alpha:]_][[:alnum:]_]*)\\s*(:[^=]*)?(=?)",
"captures": {
"1": {"name": "keyword.source.reason"},
"2": {"name": "keyword.source.reason"},
"4": {"name": "storage.type.source.reason"},
"5": {"name": "keyword.operator.reason"}
},
"comment": "This matches the 'let x = val' style of variable intitialization."
},
{
"name": "meta.import.reason",
"match": "(extern\\s+crate)\\s+(\\w+)",
"captures": {
"1": {"name": "keyword.source.reason"},
"2": {"name": "support"}
}
},
{
"name": "meta.macro.source.reason",
"match": "\\b(macro_rules!)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*(?:\\{)",
"captures": {
"1": {"name": "keyword.source.reason"},
"2": {"name": "entity.name.macro.source.reason"}
}
},
{"name": "keyword.source.reason",
"match": "\\b(as|box|break|claim|const|continue|copy|Copy|crate|do|drop|then|else|extern|for|if|impl|in|let|and|loop|switch|fun|open|include|mod|move|mutable|Owned|priv|pub|pure|ref|return|unsafe|use|while|mod|Send|static|trait|struct|enum|exception|type|module|rec|where)\\b"
},
{"name": "storage.type.source.reason",
"match": "\\b(Self|m32|m64|m128|f80|f16|f128|int|uint|isize|usize|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|Option|Either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b"
},
{"name": "variable.language.source.reason",
"match": "\\bself\\b"
},
{"name": "constant.language.source.reason",
"match": "\\b(true|false|Some|None|Ok|Err)\\b"
},
{"name": "support.constant.source.reason",
"match": "\\b(EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b"
},
{"name": "comment.block.attribute.reason",
"begin": "#!?\\[",
"end": "\\]",
"patterns": [
{"include": "#reason_string"},
{"include": "#reason_raw_string"}
]
},
{"name": "constant.numeric.integer.source.reason",
"match": "\\b(([0-9][0-9_]*)|([0-9][0-9_]*(usize|u8|u16|u32|u64))|([0-9][0-9_]*(isize|i8|i16|i32|i64)))\\b"
},
{"name": "constant.numeric.hex.source.reason",
"match": "\\b((0x[a-fA-F0-9_]+)|(0x[a-fA-F0-9_]+(usize|u8|u16|u32|u64))|(0x[a-fA-F0-9_]+(isize|i8|i16|i32|i64)))\\b"
},
{"name": "constant.numeric.binary.source.reason",
"match": "\\b((0b[01_]+)|(0b[01_]+(usize|u8|u16|u32|u64))|(0b[01_]+(isize|i8|i16|i32|i64)))\\b"
},
{"name": "constant.numeric.float.source.reason",
"match": "\\b(([0-9][0-9_]*(f32|f64|f))|([0-9][0-9_]*([eE][+-]=[0-9_]+))|([0-9][0-9_]*([eE][+-]=[0-9_]+)(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+)|([0-9][0-9_]*\\.[0-9_]+(f32|f64|f))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+))|([0-9][0-9_]*\\.[0-9_]+%([eE][+-]=[0-9_]+)(f32|f64|f)))\\b"
},
{"name": "keyword.operator.reason",
"match": "(=>)|(->)|[-:=*,!.+|%/&~@<>;]"
},
{"name": "support.function.reason",
"match": "\\b_\\b"
},
{"name": "support.function.reason",
"match": "\\b(\\w+)\\b(?=\\()"
},
{"name": "support.macro.reason",
"match": "\\b(\\w+!)(?=\\()"
},
{"name": "meta.namespace-block.reason",
"match": "\\b(\\w+)::"
},
{
"name": "meta.macro.source.reason",
"match": "\\b(\\w+!)\\s*[({\\[]",
"captures": {
"1": { "name": "meta.preprocessor.reason" }
}
},
{"match": "(\\[|\\]|{|}|\\(|\\))",
"name": "punctuation.definition.bracket.reason"
},
{
"match": "\\b(Box|Vec|StrBuf|Path|Option|Result|Reader|Writer|Stream|Seek|Buffer|IoError|IoResult|Sender|SyncSender|Receiver|Cell|RefCell|Any)\\b",
"name": "support.class.std.source.reason"
},
{
"match": "\\b(Send|Sized|Copy|Share)\\b",
"name": "support.type.kind.source.reason"
},
{
"match": "\\bbox\\b",
"name": "storage.modifier.box.source.reason"
},
{
"match": "\\brec\\b",
"name": "storage.modifier.rec.source.reason"
},
{
"match": "\\bmodule\\b",
"name": "storage.modifier.module.source.reason"
}
],
"repository": {
"reason_escaped_character": {
"name": "constant.character.escape.source.reason",
"match": "\\\\(x[0-9A-Fa-f]{2}|u\\{[0-9A-Fa-f]{1,6}\\}|.)"
},
"reason_string": {
"name": "string.quoted.double.source.reason",
"begin": "\"",
"end": "\"",
"patterns": [
{"include": "#reason_escaped_character"}
]
},
"reason_raw_string": {
"name": "string.quoted.double.raw.source.reason",
"begin": "r(#*)\"",
"end": "\"(\\1)"
},
"reason_comment_block": {
"name": "comment.block.source.reason",
"begin": "/\\*",
"end": "\\*/",
"patterns": [
{"include": "#reason_comment_block"}
]
},
"reason_comment": {
"name": "comment.source.reason",
"begin": "//",
"end": "(?=^)"
},
"reason_comment_doc_block": {
"name": "comment.block.documentation.source.reason",
"begin": "/\\*[!\\*][^\\*]",
"end": "\\*/",
"patterns": [
{"include": "#reason_comment_doc_block"}
]
},
"reason_module": {
"match": "\\b([A-Z][a-zA-Z0-9_]*)\\b",
"captures": {
"1": {"name": "variable.other.reason"}
}
},
"reason_named_arg": {
"match": "(@([a-zA-Z_][a-zA-Z0-9_]*))\\b",
"captures": {
"1": { "name": "storage.modifier.lifetime.source.reason" },
"2": { "name": "entity.name.lifetime.source.reason" }
}
},
"reason_lifetime": {
"name": "storage.modifier.lifetime.source.reason",
"match": "\\'([a-zA-Z_][a-zA-Z0-9_]*)(?!\\')\\b",
"captures": {
"1": { "name": "entity.name.lifetime.source.reason" }
}
},
"reason_self": {
"name": "variable.language.source.reason",
"match": "\\bself\\b"
}
},
"uuid": "4339386b-4d67-4f0e-9e78-09ecbcddf71d"
}