Elffuss BraidHub

kikocis/continue public

71fd2e7d4456 · 10.7 KiBRawPermalink
1{
2 "scopeName": "source.swift",
3 "fileTypes": [
4 "swift"
5 ],
6 "name": "Swift",
7 "firstLineMatch": "^#!\\s*/.*\\bswift",
8 "patterns": [
9 {
10 "name": "keyword.declaration.swift",
11 "match": "\\b(class|deinit|enum|extension|import|init|inout|internal|let|operator|private|protocol|public|static|struct|subscript|typealias|var)\\b"
12 },
13 {
14 "name": "keyword.statement.swift",
15 "match": "\\b(break|case|continue|default|defer|do|else|fallthrough|for|guard|if|in|repeat|return|switch|where|while)\\b"
16 },
17 {
18 "name": "keyword.expressions-and-types.swift",
19 "match": "\\b(as|catch|dynamicType|false|is|nil|rethrows|super|self|Self|throw|throws|true|try|__COLUMN__|__FILE__|__FUNCTION__|__LINE__)\\b"
20 },
21 {
22 "name": "keyword.patterns.swift",
23 "match": "\\b(_)\\b"
24 },
25 {
26 "name": "keyword.primitive-datatypes.swift",
27 "match": "\\b(Int|UInt|String|Bool|Character|Optional|Float|Double)\\b"
28 },
29 {
30 "name": "keyword.reserved.swift",
31 "match": "\\b(associativity|convenience|dynamic|didSet|final|get|infix|lazy|left|mutating|none|nonmutating|optional|override|postfix|precedence|prefix|Protocol|required|right|set|Type|unowned|weak|willSet)\\b"
32 },
33 {
34 "include": "#comment"
35 },
36 {
37 "include": "#literal"
38 },
39 {
40 "include": "#function"
41 },
42 {
43 "include": "#operator"
44 },
45 {
46 "include": "#attribute"
47 }
48 ],
49 "repository": {
50 "comment": {
51 "patterns": [
52 {
53 "name": "comment.block.swift",
54 "begin": "/\\*",
55 "beginCaptures": {
56 "0": {
57 "name": "punctuation.definition.comment.begin.swift"
58 }
59 },
60 "end": "\\*/",
61 "endCaptures": {
62 "0": {
63 "name": "punctuation.definition.comment.end.swift"
64 }
65 },
66 "patterns": [
67 {
68 "include": "#comment"
69 }
70 ]
71 },
72 {
73 "begin": "(^[ \\t]+)?(?=//)",
74 "beginCaptures": {
75 "1": {
76 "name": "punctuation.whitespace.comment.leading.swift"
77 }
78 },
79 "end": "(?!\\G)",
80 "patterns": [
81 {
82 "name": "comment.line.double-slash.swift",
83 "begin": "//",
84 "beginCaptures": {
85 "0": {
86 "name": "punctuation.definition.comment.swift"
87 }
88 },
89 "end": "\\n",
90 "patterns": [
91 {
92 "name": "punctuation.separator.continuation.swift",
93 "match": "(?>\\\\\\s*\\n)"
94 }
95 ]
96 }
97 ]
98 }
99 ]
100 },
101 "escaped-char": {
102 "patterns": [
103 {
104 "name": "constant.character.escape.swift",
105 "match": "\\\\[0\\\\tnr\"']"
106 },
107 {
108 "name": "constant.character.escape.swift",
109 "match": "\\\\(x\\h{2}|u\\h{4}|U\\h{8})"
110 },
111 {
112 "name": "invalid.illegal.constant.character.escape.swift",
113 "match": "\\\\[^uxU]"
114 }
115 ]
116 },
117 "identifier": {
118 "match": "(?x) (?<identifier> \\g<identifier-head> \\g<identifier-characters>? | ` \\g<identifier-head> \\g<identifier-characters>? ` ){0} (?<identifier-head> [ a-z A-Z ] | [ \\u00A8 \\u00AA \\u00AD \\u00AF \\u00B2-\\u00B5 \\u00B7-\\u00BA ] | [ \\u00BC-\\u00BE \\u00C0-\\u00D6 \\u00D8-\\u00F6 \\u00F8-\\u00FF ] | [ \\u0100-\\u02FF \\u0370-\\u167F \\u1681-\\u180D \\u180F-\\u1DBF ] | [ \\u1E00-\\u1FFF ] | [ \\u200B-\\u200D \\u202A-\\u202E \\u203F-\\u2040 \\u2054 \\u2060-\\u206F ] | [ \\u2070-\\u20CF \\u2100-\\u218F \\u2460-\\u24FF \\u2776-\\u2793 ] | [ \\u2C00-\\u2DFF \\u2E80-\\u2FFF ] | [ \\u3004-\\u3007 \\u3021-\\u302F \\u3031-\\u303F \\u3040-\\uD7FF ] | [ \\uF900-\\uFD3D \\uFD40-\\uFDCF \\uFDF0-\\uFE1F \\uFE30-\\uFE44 ] | [ \\uFE47-\\uFFFD ] | [ \\u10000-\\u1FFFD \\u20000-\\u2FFFD \\u30000-\\u3FFFD \\u40000-\\u4FFFD ] | [ \\u50000-\\u5FFFD \\u60000-\\u6FFFD \\u70000-\\u7FFFD \\u80000-\\u8FFFD ] | [ \\u90000-\\u9FFFD \\uA0000-\\uAFFFD \\uB0000-\\uBFFFD \\uC0000-\\uCFFFD ] | [ \\uD0000-\\uDFFFD \\uE0000-\\uEFFFD ] ){0} (?<identifier-character> \\d | [ \\u0300-\\u036F \\u1DC0-\\u1DFF \\u20D0-\\u20FF \\uFE20-\\uFE2F ] | \\g<identifier-head> ){0} (?<identifier-characters> \\g<identifier-character> \\g<identifier-characters>? ){0} (?<implicit-parameter-name> (?<!\\g<identifier-head>) \\$ \\d+ (?!\\g<identifier-head>) (?# FIXME) ){0} \\g<identifier> | \\g<implicit-parameter-name>",
119 "captures": {
120 "5": {
121 "name": "variable.other.positional.swift"
122 }
123 }
124 },
125 "literal": {
126 "patterns": [
127 {
128 "include": "#literal-number"
129 },
130 {
131 "include": "#literal-string"
132 },
133 {
134 "include": "#literal-boolean"
135 }
136 ]
137 },
138 "literal-number": {
139 "name": "constant.numeric.swift",
140 "match": "(?x) (?### INTEGER ###) (?<integer-literal> \\g<binary-literal> | \\g<octal-literal> | \\g<hexadecimal-literal> | \\g<decimal-literal> ){0} (?### BINARY ###) (?<binary-literal> 0b \\g<binary-digit> \\g<binary-literal-characters>? ){0} (?<binary-digit> [0-1] ){0} (?<binary-literal-character> \\g<binary-digit> | _ ){0} (?<binary-literal-characters> \\g<binary-literal-character> \\g<binary-literal-characters>? ){0} (?### OCTAL ###) (?<octal-literal> 0o \\g<octal-digit> \\g<octal-literal-characters>? ){0} (?<octal-digit> [0-7] ){0} (?<octal-literal-character> \\g<octal-digit> | _ ){0} (?<octal-literal-characters> \\g<octal-literal-character> \\g<octal-literal-characters>? ){0} (?### DECIMAL ###) (?<decimal-literal> \\g<decimal-digit> \\g<decimal-literal-characters>? ){0} (?<decimal-digit> \\d ){0} (?<decimal-literal-character> \\g<decimal-digit> | _ ){0} (?<decimal-literal-characters> \\g<decimal-literal-character> \\g<decimal-literal-characters>? ){0} (?### HEXADECIMAL ###) (?<hexadecimal-literal> 0x \\g<hexadecimal-digit> \\g<hexadecimal-literal-characters>? ){0} (?<hexadecimal-digit> \\h ){0} (?<hexadecimal-literal-character> \\g<hexadecimal-digit> | _ ){0} (?<hexadecimal-literal-characters> \\g<hexadecimal-literal-character> \\g<hexadecimal-literal-characters>? ){0} (?### FLOATING POINT ###) (?<floating-point-literal> \\g<decimal-literal> \\g<decimal-fraction>? \\g<decimal-exponent>? | \\g<hexadecimal-literal> \\g<hexadecimal-fraction>? \\g<hexadecimal-exponent> ){0} (?<decimal-fraction> \\. \\g<decimal-literal> ){0} (?<decimal-exponent> \\g<floating-point-e> \\g<sign>? \\g<decimal-literal> ){0} (?<hexadecimal-fraction> \\. \\g<hexadecimal-literal>? ){0} (?<hexadecimal-exponent> \\g<floating-point-p> \\g<sign>? \\g<hexadecimal-literal> ){0} (?<floating-point-e> [eE] ){0} (?<floating-point-p> [pP] ){0} (?<sign> [+-] ){0} (?!0[box]) \\g<floating-point-literal> | \\g<integer-literal>"
141 },
142 "literal-string": {
143 "name": "string.quoted.double.swift",
144 "begin": "\"",
145 "end": "\"",
146 "beginCaptures": {
147 "0": {
148 "name": "punctuation.definition.string.begin.swift"
149 }
150 },
151 "endCaptures": {
152 "0": {
153 "name": "punctuation.definition.string.end.swift"
154 }
155 },
156 "patterns": [
157 {
158 "include": "#quoted-text"
159 }
160 ]
161 },
162 "literal-boolean": {
163 "match": "\\b(true|false)\\b(?![?!])",
164 "name": "constant.language.boolean.swift"
165 },
166 "operator": {
167 "patterns": [
168 {
169 "include": "#operator-character"
170 }
171 ]
172 },
173 "operator-character": {
174 "name": "keyword.operator.swift",
175 "match": "[\\/=\\-+!*%<>&|^~.]"
176 },
177 "quoted-text": {
178 "patterns": [
179 {
180 "name": "meta.embedded.line.swift",
181 "contentName": "source.swift",
182 "begin": "\\\\\\(",
183 "end": "\\)",
184 "beginCaptures": {
185 "0": {
186 "name": "punctuation.section.embedded.begin.swift"
187 }
188 },
189 "endCaptures": {
190 "0": {
191 "name": "punctuation.section.embedded.end.swift"
192 }
193 },
194 "patterns": [
195 {
196 "include": "$self"
197 }
198 ]
199 },
200 {
201 "include": "#escaped-char"
202 }
203 ]
204 },
205 "function": {
206 "name": "meta.function.swift",
207 "begin": "(func) \\s*",
208 "end": "(?=\\{|#)|;|$",
209 "beginCaptures": {
210 "1": {
211 "name": "storage.type.function.swift"
212 }
213 },
214 "comment": "match regular function like: func myFunc(...)",
215 "patterns": [
216 {
217 "begin": "([a-zA-Z_0-9]+)\\s*(\\()",
218 "beginCaptures": {
219 "1": {
220 "name": "entity.name.function.swift"
221 },
222 "2": {
223 "name": "punctuation.definition.parameters.begin.swift"
224 }
225 },
226 "comment": "match regular function like: func myFunc(...)",
227 "end": "(\\))",
228 "endCaptures": {
229 "1": {
230 "name": "punctuation.definition.parameters.end.swift"
231 }
232 }
233 },
234 {
235 "name": "meta.return-type.swift",
236 "match": "((->)\\s*([^\\{]+))",
237 "captures": {
238 "2": {
239 "name": "punctuation.function.swift"
240 },
241 "3": {
242 "name": "entity.name.type.class.swift"
243 }
244 }
245 }
246 ]
247 },
248 "whitespace": {
249 "match": "(?x) [ \\u0020 (?# space) \\u000A (?# line-feed) \\u000D (?# carriage-return) \\u0009 (?# horizontal-tab) \\u000B (?# vertical-tab) \\u000C (?# form-feed) \\u0000 (?# null) ]"
250 },
251 "attribute": {
252 "name": "storage.type.attribute.swift",
253 "begin": "@",
254 "end": " "
255 }
256 }
257}