Skip to content

Commit 8e2f906

Browse files
authored
Merge pull request #1 from unisonweb/syntaxes
Add syntax
2 parents fa1e827 + 94f072b commit 8e2f906

File tree

1 file changed

+249
-31
lines changed

1 file changed

+249
-31
lines changed

syntaxes/unison.tmLanguage.json

Lines changed: 249 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,250 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3-
"name": "Unison",
4-
"patterns": [
5-
{
6-
"include": "#keywords"
7-
},
8-
{
9-
"include": "#strings"
10-
}
11-
],
12-
"repository": {
13-
"keywords": {
14-
"patterns": [{
15-
"name": "keyword.control.unison",
16-
"match": "\\b(if|while|for|return)\\b"
17-
}]
18-
},
19-
"strings": {
20-
"name": "string.quoted.double.unison",
21-
"begin": "\"",
22-
"end": "\"",
23-
"patterns": [
24-
{
25-
"name": "constant.character.escape.unison",
26-
"match": "\\\\."
27-
}
28-
]
29-
}
30-
},
31-
"scopeName": "source.unison"
32-
}
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "Unison",
4+
"patterns": [{
5+
"include": "#comment"
6+
},{
7+
"include": "#boolean"
8+
},{
9+
"include": "#numeric"
10+
},{
11+
"include": "#text"
12+
},{
13+
"include": "#match_with"
14+
},{
15+
"include": "#control"
16+
},{
17+
"include": "#annotation"
18+
},{
19+
"include": "#forall"
20+
},{
21+
"include": "#arrow"
22+
},{
23+
"include": "#watch"
24+
},{
25+
"include": "#test_watch"
26+
},{
27+
"include": "#unsorted_reserved_chars"
28+
},{
29+
"include": "#unsorted_keywords"
30+
}],
31+
"repository": {
32+
"annotation": {
33+
"name": "meta.function.type-declaration.unison",
34+
"match": "([^\\r\\n\\t\\f\\v \"]+)\\s*(:)(?=\\s)",
35+
"captures": {
36+
"1": {
37+
"name": "entity.name.function.unison"
38+
},
39+
"2": {
40+
"name": "keyword.other.colon.unison"
41+
}
42+
}
43+
},
44+
"boolean": {
45+
"patterns": [{
46+
"include": "#true"
47+
},{
48+
"include": "#false"
49+
}]
50+
},
51+
"true": {
52+
"match": "true",
53+
"name": "constant.language.boolean.true.unison"
54+
},
55+
"false": {
56+
"match": "false",
57+
"name": "constant.language.boolean.false.unison"
58+
},
59+
"match_with": {
60+
"match": "(\\s|^)(match|with|->)(?=\\s|$)",
61+
"captures": {
62+
"2": {
63+
"name": "keyword.control.case.unison"
64+
}
65+
}
66+
},
67+
"comment": {
68+
"patterns": [{
69+
"include": "#eof_comment"
70+
},{
71+
"include": "#line_comment"
72+
}]
73+
},
74+
"eof_comment": {
75+
"name": "comment.block.eof.unison",
76+
"begin": "^---",
77+
"end": "\\z"
78+
},
79+
"block_comment": {
80+
"name": "comment.block.unison",
81+
"begin": "{-",
82+
"end": "-}",
83+
"beginCaptures": {
84+
"0": {
85+
"name": "punctuation.definition.comment.begin.unison"
86+
}
87+
},
88+
"endCaptures": {
89+
"0": {
90+
"name": "punctuation.definition.comment.end.unison"
91+
}
92+
}
93+
},
94+
"line_comment": {
95+
"patterns": [{
96+
"begin": "(^\\s+)?(?=--)",
97+
"beginCaptures": {
98+
"1": {
99+
"name": "punctuation.whitespace.comment.leading.unison"
100+
}
101+
},
102+
"end": "(?=$)",
103+
"patterns": [{
104+
"name": "comment.line.double-dash.unison",
105+
"begin": "(?<!-)--(?:(?!-)|(?=--))",
106+
"beginCaptures": {
107+
"0": {
108+
"name": "punctuation.definition.comment.unison"
109+
}
110+
},
111+
"end": "(?=$)"
112+
}]
113+
}]
114+
},
115+
"control": {
116+
"match": "\\b(if|then|else|and|or)\\b",
117+
"captures": {
118+
"1": {
119+
"name": "keyword.control.unison"
120+
}
121+
}
122+
},
123+
"numeric": {
124+
"patterns": [{
125+
"include": "#float"
126+
},{
127+
"include": "#int"
128+
},{
129+
"#include": "#nat"
130+
}]
131+
},
132+
"float": {
133+
"match": "([^+\\-\\w\\d]|^)([+-]?\\d+\\.\\d*)",
134+
"captures": {
135+
"2": {
136+
"name": "constant.numeric.decimal.unison"
137+
}
138+
}
139+
},
140+
"int": {
141+
"match": "([^\\w\\d]|^)([+-]\\d+)",
142+
"captures": {
143+
"2": {
144+
"name": "constant.numeric.integer.signed.unison"
145+
}
146+
}
147+
},
148+
"nat": {
149+
"match": "([^+\\-\\w\\d]|^)(\\d+)",
150+
"captures": {
151+
"2": {
152+
"name": "constant.numeric.integer.unsigned.unison"
153+
}
154+
}
155+
},
156+
"text": {
157+
"name": "string.quoted.double.unison",
158+
"match": "(\")(.*?)(\")",
159+
"captures": {
160+
"1": {
161+
"name": "punctuation.definition.string.begin.unison"
162+
},
163+
"3": {
164+
"name": "punctuation.definition.string.end.unison"
165+
}
166+
}
167+
},
168+
"forall": {
169+
"match": "(\\s|^)(forall|∀)(?=\\s|^)",
170+
"captures": {
171+
"2": {
172+
"name": "keyword.other.forall.unison"
173+
}
174+
}
175+
},
176+
"arrow": {
177+
"match": "(->)",
178+
"captures": {
179+
"1": {
180+
"name": "keyword.other.arrow.unison"
181+
}
182+
}
183+
},
184+
"watch": {
185+
"match": "^(>)",
186+
"captures": {
187+
"1": {
188+
"name": "keyword.other.watch.expression.unison"
189+
}
190+
}
191+
},
192+
"test_watch": {
193+
"match": "^(test>)",
194+
"captures": {
195+
"1": {
196+
"name": "keyword.other.test.watch.expression.unison"
197+
}
198+
}
199+
},
200+
"use": {
201+
"match": "(\\s|^)(use)(?=\\s|$)",
202+
"captures": {
203+
"2": {
204+
"name": "keyword.control.import.unison"
205+
}
206+
}
207+
},
208+
"unsorted_keywords": {
209+
"match": "(\\s|^)(let|alias|handle|in|namespace|type|ability|where|unique|use|with)(?=\\s|$)",
210+
"captures": {
211+
"2": {
212+
"name": "keyword.control.unison"
213+
}
214+
}
215+
},
216+
"unsorted_reserved_chars": {
217+
"match": "(,)|('|!)|(\\[)|(\\])|({)|(})|(@)|(\\|)|(#)",
218+
"captures": {
219+
"1": {
220+
"name": "punctuation.separator.delimiter.unison"
221+
},
222+
"2": {
223+
"name": "punctuation.definition.delayed.unison"
224+
},
225+
"3": {
226+
"name": "punctuation.definition.list.begin.unison"
227+
},
228+
"4": {
229+
"name": "punctuation.definition.list.end.unison"
230+
},
231+
"5": {
232+
"name": "punctuation.definition.ability.begin.unison"
233+
},
234+
"6": {
235+
"name": "punctuation.definition.ability.end.unison"
236+
},
237+
"7": {
238+
"name": "punctuation.operator.assignment.as.unison"
239+
},
240+
"8": {
241+
"name": "punctuation.separator.pipe.unison"
242+
},
243+
"9": {
244+
"name": "punctuation.definition.hash.unison"
245+
}
246+
}
247+
}
248+
},
249+
"scopeName": "source.u"
250+
}

0 commit comments

Comments
 (0)