@codingame/monaco-vscode-standalone-languages 23.2.1 → 23.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_.contribution.js +48 -0
- package/abap/abap.contribution.js +8 -0
- package/abap/abap.js +1397 -0
- package/apex/apex.contribution.js +9 -0
- package/apex/apex.js +329 -0
- package/azcli/azcli.contribution.js +8 -0
- package/azcli/azcli.js +67 -0
- package/bat/bat.contribution.js +8 -0
- package/bat/bat.js +99 -0
- package/bicep/bicep.contribution.js +8 -0
- package/bicep/bicep.js +108 -0
- package/cameligo/cameligo.contribution.js +8 -0
- package/cameligo/cameligo.js +173 -0
- package/clojure/clojure.contribution.js +8 -0
- package/clojure/clojure.js +760 -0
- package/coffee/coffee.contribution.js +9 -0
- package/coffee/coffee.js +231 -0
- package/cpp/cpp.contribution.js +14 -0
- package/cpp/cpp.js +388 -0
- package/csharp/csharp.contribution.js +8 -0
- package/csharp/csharp.js +325 -0
- package/csp/csp.contribution.js +8 -0
- package/csp/csp.js +52 -0
- package/css/css.contribution.js +9 -0
- package/css/css.js +184 -0
- package/cypher/cypher.contribution.js +8 -0
- package/cypher/cypher.js +262 -0
- package/dart/dart.contribution.js +9 -0
- package/dart/dart.js +280 -0
- package/dockerfile/dockerfile.contribution.js +9 -0
- package/dockerfile/dockerfile.js +129 -0
- package/ecl/ecl.contribution.js +8 -0
- package/ecl/ecl.js +455 -0
- package/elixir/elixir.contribution.js +8 -0
- package/elixir/elixir.js +568 -0
- package/flow9/flow9.contribution.js +8 -0
- package/flow9/flow9.js +141 -0
- package/freemarker2/freemarker2.contribution.js +52 -0
- package/freemarker2/freemarker2.js +990 -0
- package/fsharp/fsharp.contribution.js +8 -0
- package/fsharp/fsharp.js +216 -0
- package/go/go.contribution.js +8 -0
- package/go/go.js +217 -0
- package/graphql/graphql.contribution.js +9 -0
- package/graphql/graphql.js +150 -0
- package/handlebars/handlebars.contribution.js +9 -0
- package/handlebars/handlebars.js +413 -0
- package/hcl/hcl.contribution.js +8 -0
- package/hcl/hcl.js +182 -0
- package/html/html.contribution.js +9 -0
- package/html/html.js +302 -0
- package/index.js +81 -48
- package/ini/ini.contribution.js +9 -0
- package/ini/ini.js +70 -0
- package/java/java.contribution.js +9 -0
- package/java/java.js +231 -0
- package/javascript/javascript.contribution.js +11 -0
- package/javascript/javascript.js +70 -0
- package/julia/julia.contribution.js +8 -0
- package/julia/julia.js +510 -0
- package/kotlin/kotlin.contribution.js +9 -0
- package/kotlin/kotlin.js +251 -0
- package/less/less.contribution.js +9 -0
- package/less/less.js +160 -0
- package/lexon/lexon.contribution.js +8 -0
- package/lexon/lexon.js +156 -0
- package/liquid/liquid.contribution.js +9 -0
- package/liquid/liquid.js +234 -0
- package/lua/lua.contribution.js +8 -0
- package/lua/lua.js +161 -0
- package/m3/m3.contribution.js +8 -0
- package/m3/m3.js +209 -0
- package/markdown/markdown.contribution.js +8 -0
- package/markdown/markdown.js +228 -0
- package/mdx/mdx.contribution.js +8 -0
- package/mdx/mdx.js +158 -0
- package/mips/mips.contribution.js +9 -0
- package/mips/mips.js +197 -0
- package/msdax/msdax.contribution.js +8 -0
- package/msdax/msdax.js +374 -0
- package/mysql/mysql.contribution.js +8 -0
- package/mysql/mysql.js +877 -0
- package/objective-c/objective-c.contribution.js +8 -0
- package/objective-c/objective-c.js +182 -0
- package/package.json +2 -2
- package/pascal/pascal.contribution.js +9 -0
- package/pascal/pascal.js +250 -0
- package/pascaligo/pascaligo.contribution.js +8 -0
- package/pascaligo/pascaligo.js +163 -0
- package/perl/perl.contribution.js +8 -0
- package/perl/perl.js +625 -0
- package/pgsql/pgsql.contribution.js +8 -0
- package/pgsql/pgsql.js +850 -0
- package/php/php.contribution.js +9 -0
- package/php/php.js +499 -0
- package/pla/pla.contribution.js +7 -0
- package/pla/pla.js +136 -0
- package/postiats/postiats.contribution.js +8 -0
- package/postiats/postiats.js +906 -0
- package/powerquery/powerquery.contribution.js +8 -0
- package/powerquery/powerquery.js +889 -0
- package/powershell/powershell.contribution.js +8 -0
- package/powershell/powershell.js +238 -0
- package/protobuf/protobuf.contribution.js +8 -0
- package/protobuf/protobuf.js +419 -0
- package/pug/pug.contribution.js +8 -0
- package/pug/pug.js +401 -0
- package/python/python.contribution.js +9 -0
- package/python/python.js +294 -0
- package/qsharp/qsharp.contribution.js +8 -0
- package/qsharp/qsharp.js +300 -0
- package/r/r.contribution.js +8 -0
- package/r/r.js +242 -0
- package/razor/razor.contribution.js +9 -0
- package/razor/razor.js +544 -0
- package/redis/redis.contribution.js +8 -0
- package/redis/redis.js +301 -0
- package/redshift/redshift.contribution.js +8 -0
- package/redshift/redshift.js +808 -0
- package/restructuredtext/restructuredtext.contribution.js +8 -0
- package/restructuredtext/restructuredtext.js +173 -0
- package/ruby/ruby.contribution.js +9 -0
- package/ruby/ruby.js +510 -0
- package/rust/rust.contribution.js +8 -0
- package/rust/rust.js +342 -0
- package/sb/sb.contribution.js +8 -0
- package/sb/sb.js +114 -0
- package/scala/scala.contribution.js +9 -0
- package/scala/scala.js +369 -0
- package/scheme/scheme.contribution.js +8 -0
- package/scheme/scheme.js +107 -0
- package/scss/scss.contribution.js +9 -0
- package/scss/scss.js +259 -0
- package/shell/shell.contribution.js +8 -0
- package/shell/shell.js +220 -0
- package/solidity/solidity.contribution.js +8 -0
- package/solidity/solidity.js +1366 -0
- package/sophia/sophia.contribution.js +8 -0
- package/sophia/sophia.js +198 -0
- package/sparql/sparql.contribution.js +8 -0
- package/sparql/sparql.js +200 -0
- package/sql/sql.contribution.js +8 -0
- package/sql/sql.js +852 -0
- package/st/st.contribution.js +8 -0
- package/st/st.js +415 -0
- package/swift/swift.contribution.js +9 -0
- package/swift/swift.js +311 -0
- package/systemverilog/systemverilog.contribution.js +14 -0
- package/systemverilog/systemverilog.js +575 -0
- package/tcl/tcl.contribution.js +8 -0
- package/tcl/tcl.js +231 -0
- package/twig/twig.contribution.js +9 -0
- package/twig/twig.js +391 -0
- package/typescript/typescript.contribution.js +11 -0
- package/typescript/typescript.js +336 -0
- package/typespec/typespec.contribution.js +8 -0
- package/typespec/typespec.js +126 -0
- package/vb/vb.contribution.js +8 -0
- package/vb/vb.js +371 -0
- package/wgsl/wgsl.contribution.js +8 -0
- package/wgsl/wgsl.js +452 -0
- package/xml/xml.contribution.js +28 -0
- package/xml/xml.js +88 -0
- package/yaml/yaml.contribution.js +9 -0
- package/yaml/yaml.js +199 -0
package/pug/pug.js
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
const conf = {
|
|
2
|
+
comments: {
|
|
3
|
+
lineComment: "//"
|
|
4
|
+
},
|
|
5
|
+
brackets: [
|
|
6
|
+
["{", "}"],
|
|
7
|
+
["[", "]"],
|
|
8
|
+
["(", ")"]
|
|
9
|
+
],
|
|
10
|
+
autoClosingPairs: [
|
|
11
|
+
{ open: '"', close: '"', notIn: ["string", "comment"] },
|
|
12
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] },
|
|
13
|
+
{ open: "{", close: "}", notIn: ["string", "comment"] },
|
|
14
|
+
{ open: "[", close: "]", notIn: ["string", "comment"] },
|
|
15
|
+
{ open: "(", close: ")", notIn: ["string", "comment"] }
|
|
16
|
+
],
|
|
17
|
+
folding: {
|
|
18
|
+
offSide: true
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const language = {
|
|
22
|
+
defaultToken: "",
|
|
23
|
+
tokenPostfix: ".pug",
|
|
24
|
+
ignoreCase: true,
|
|
25
|
+
brackets: [
|
|
26
|
+
{ token: "delimiter.curly", open: "{", close: "}" },
|
|
27
|
+
{ token: "delimiter.array", open: "[", close: "]" },
|
|
28
|
+
{ token: "delimiter.parenthesis", open: "(", close: ")" }
|
|
29
|
+
],
|
|
30
|
+
keywords: [
|
|
31
|
+
"append",
|
|
32
|
+
"block",
|
|
33
|
+
"case",
|
|
34
|
+
"default",
|
|
35
|
+
"doctype",
|
|
36
|
+
"each",
|
|
37
|
+
"else",
|
|
38
|
+
"extends",
|
|
39
|
+
"for",
|
|
40
|
+
"if",
|
|
41
|
+
"in",
|
|
42
|
+
"include",
|
|
43
|
+
"mixin",
|
|
44
|
+
"typeof",
|
|
45
|
+
"unless",
|
|
46
|
+
"var",
|
|
47
|
+
"when"
|
|
48
|
+
],
|
|
49
|
+
tags: [
|
|
50
|
+
"a",
|
|
51
|
+
"abbr",
|
|
52
|
+
"acronym",
|
|
53
|
+
"address",
|
|
54
|
+
"area",
|
|
55
|
+
"article",
|
|
56
|
+
"aside",
|
|
57
|
+
"audio",
|
|
58
|
+
"b",
|
|
59
|
+
"base",
|
|
60
|
+
"basefont",
|
|
61
|
+
"bdi",
|
|
62
|
+
"bdo",
|
|
63
|
+
"blockquote",
|
|
64
|
+
"body",
|
|
65
|
+
"br",
|
|
66
|
+
"button",
|
|
67
|
+
"canvas",
|
|
68
|
+
"caption",
|
|
69
|
+
"center",
|
|
70
|
+
"cite",
|
|
71
|
+
"code",
|
|
72
|
+
"col",
|
|
73
|
+
"colgroup",
|
|
74
|
+
"command",
|
|
75
|
+
"datalist",
|
|
76
|
+
"dd",
|
|
77
|
+
"del",
|
|
78
|
+
"details",
|
|
79
|
+
"dfn",
|
|
80
|
+
"div",
|
|
81
|
+
"dl",
|
|
82
|
+
"dt",
|
|
83
|
+
"em",
|
|
84
|
+
"embed",
|
|
85
|
+
"fieldset",
|
|
86
|
+
"figcaption",
|
|
87
|
+
"figure",
|
|
88
|
+
"font",
|
|
89
|
+
"footer",
|
|
90
|
+
"form",
|
|
91
|
+
"frame",
|
|
92
|
+
"frameset",
|
|
93
|
+
"h1",
|
|
94
|
+
"h2",
|
|
95
|
+
"h3",
|
|
96
|
+
"h4",
|
|
97
|
+
"h5",
|
|
98
|
+
"h6",
|
|
99
|
+
"head",
|
|
100
|
+
"header",
|
|
101
|
+
"hgroup",
|
|
102
|
+
"hr",
|
|
103
|
+
"html",
|
|
104
|
+
"i",
|
|
105
|
+
"iframe",
|
|
106
|
+
"img",
|
|
107
|
+
"input",
|
|
108
|
+
"ins",
|
|
109
|
+
"keygen",
|
|
110
|
+
"kbd",
|
|
111
|
+
"label",
|
|
112
|
+
"li",
|
|
113
|
+
"link",
|
|
114
|
+
"map",
|
|
115
|
+
"mark",
|
|
116
|
+
"menu",
|
|
117
|
+
"meta",
|
|
118
|
+
"meter",
|
|
119
|
+
"nav",
|
|
120
|
+
"noframes",
|
|
121
|
+
"noscript",
|
|
122
|
+
"object",
|
|
123
|
+
"ol",
|
|
124
|
+
"optgroup",
|
|
125
|
+
"option",
|
|
126
|
+
"output",
|
|
127
|
+
"p",
|
|
128
|
+
"param",
|
|
129
|
+
"pre",
|
|
130
|
+
"progress",
|
|
131
|
+
"q",
|
|
132
|
+
"rp",
|
|
133
|
+
"rt",
|
|
134
|
+
"ruby",
|
|
135
|
+
"s",
|
|
136
|
+
"samp",
|
|
137
|
+
"script",
|
|
138
|
+
"section",
|
|
139
|
+
"select",
|
|
140
|
+
"small",
|
|
141
|
+
"source",
|
|
142
|
+
"span",
|
|
143
|
+
"strike",
|
|
144
|
+
"strong",
|
|
145
|
+
"style",
|
|
146
|
+
"sub",
|
|
147
|
+
"summary",
|
|
148
|
+
"sup",
|
|
149
|
+
"table",
|
|
150
|
+
"tbody",
|
|
151
|
+
"td",
|
|
152
|
+
"textarea",
|
|
153
|
+
"tfoot",
|
|
154
|
+
"th",
|
|
155
|
+
"thead",
|
|
156
|
+
"time",
|
|
157
|
+
"title",
|
|
158
|
+
"tr",
|
|
159
|
+
"tracks",
|
|
160
|
+
"tt",
|
|
161
|
+
"u",
|
|
162
|
+
"ul",
|
|
163
|
+
"video",
|
|
164
|
+
"wbr"
|
|
165
|
+
],
|
|
166
|
+
// we include these common regular expressions
|
|
167
|
+
symbols: /[\+\-\*\%\&\|\!\=\/\.\,\:]+/,
|
|
168
|
+
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
169
|
+
tokenizer: {
|
|
170
|
+
root: [
|
|
171
|
+
// Tag or a keyword at start
|
|
172
|
+
[
|
|
173
|
+
/^(\s*)([a-zA-Z_-][\w-]*)/,
|
|
174
|
+
{
|
|
175
|
+
cases: {
|
|
176
|
+
"$2@tags": {
|
|
177
|
+
cases: {
|
|
178
|
+
"@eos": ["", "tag"],
|
|
179
|
+
"@default": ["", { token: "tag", next: "@tag.$1" }]
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"$2@keywords": ["", { token: "keyword.$2" }],
|
|
183
|
+
"@default": ["", ""]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
// id
|
|
188
|
+
[
|
|
189
|
+
/^(\s*)(#[a-zA-Z_-][\w-]*)/,
|
|
190
|
+
{
|
|
191
|
+
cases: {
|
|
192
|
+
"@eos": ["", "tag.id"],
|
|
193
|
+
"@default": ["", { token: "tag.id", next: "@tag.$1" }]
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
],
|
|
197
|
+
// class
|
|
198
|
+
[
|
|
199
|
+
/^(\s*)(\.[a-zA-Z_-][\w-]*)/,
|
|
200
|
+
{
|
|
201
|
+
cases: {
|
|
202
|
+
"@eos": ["", "tag.class"],
|
|
203
|
+
"@default": ["", { token: "tag.class", next: "@tag.$1" }]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
// plain text with pipe
|
|
208
|
+
[/^(\s*)(\|.*)$/, ""],
|
|
209
|
+
{ include: "@whitespace" },
|
|
210
|
+
// keywords
|
|
211
|
+
[
|
|
212
|
+
/[a-zA-Z_$][\w$]*/,
|
|
213
|
+
{
|
|
214
|
+
cases: {
|
|
215
|
+
"@keywords": { token: "keyword.$0" },
|
|
216
|
+
"@default": ""
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
// delimiters and operators
|
|
221
|
+
[/[{}()\[\]]/, "@brackets"],
|
|
222
|
+
[/@symbols/, "delimiter"],
|
|
223
|
+
// numbers
|
|
224
|
+
[/\d+\.\d+([eE][\-+]?\d+)?/, "number.float"],
|
|
225
|
+
[/\d+/, "number"],
|
|
226
|
+
// strings:
|
|
227
|
+
[/"/, "string", '@string."'],
|
|
228
|
+
[/'/, "string", "@string.'"]
|
|
229
|
+
],
|
|
230
|
+
tag: [
|
|
231
|
+
[/(\.)(\s*$)/, [{ token: "delimiter", next: "@blockText.$S2." }, ""]],
|
|
232
|
+
[/\s+/, { token: "", next: "@simpleText" }],
|
|
233
|
+
// id
|
|
234
|
+
[
|
|
235
|
+
/#[a-zA-Z_-][\w-]*/,
|
|
236
|
+
{
|
|
237
|
+
cases: {
|
|
238
|
+
"@eos": { token: "tag.id", next: "@pop" },
|
|
239
|
+
"@default": "tag.id"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
// class
|
|
244
|
+
[
|
|
245
|
+
/\.[a-zA-Z_-][\w-]*/,
|
|
246
|
+
{
|
|
247
|
+
cases: {
|
|
248
|
+
"@eos": { token: "tag.class", next: "@pop" },
|
|
249
|
+
"@default": "tag.class"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
],
|
|
253
|
+
// attributes
|
|
254
|
+
[/\(/, { token: "delimiter.parenthesis", next: "@attributeList" }]
|
|
255
|
+
],
|
|
256
|
+
simpleText: [
|
|
257
|
+
[/[^#]+$/, { token: "", next: "@popall" }],
|
|
258
|
+
[/[^#]+/, { token: "" }],
|
|
259
|
+
// interpolation
|
|
260
|
+
[
|
|
261
|
+
/(#{)([^}]*)(})/,
|
|
262
|
+
{
|
|
263
|
+
cases: {
|
|
264
|
+
"@eos": [
|
|
265
|
+
"interpolation.delimiter",
|
|
266
|
+
"interpolation",
|
|
267
|
+
{
|
|
268
|
+
token: "interpolation.delimiter",
|
|
269
|
+
next: "@popall"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"@default": ["interpolation.delimiter", "interpolation", "interpolation.delimiter"]
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
[/#$/, { token: "", next: "@popall" }],
|
|
277
|
+
[/#/, ""]
|
|
278
|
+
],
|
|
279
|
+
attributeList: [
|
|
280
|
+
[/\s+/, ""],
|
|
281
|
+
[
|
|
282
|
+
/(\w+)(\s*=\s*)("|')/,
|
|
283
|
+
["attribute.name", "delimiter", { token: "attribute.value", next: "@value.$3" }]
|
|
284
|
+
],
|
|
285
|
+
[/\w+/, "attribute.name"],
|
|
286
|
+
[
|
|
287
|
+
/,/,
|
|
288
|
+
{
|
|
289
|
+
cases: {
|
|
290
|
+
"@eos": {
|
|
291
|
+
token: "attribute.delimiter",
|
|
292
|
+
next: "@popall"
|
|
293
|
+
},
|
|
294
|
+
"@default": "attribute.delimiter"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
[/\)$/, { token: "delimiter.parenthesis", next: "@popall" }],
|
|
299
|
+
[/\)/, { token: "delimiter.parenthesis", next: "@pop" }]
|
|
300
|
+
],
|
|
301
|
+
whitespace: [
|
|
302
|
+
[/^(\s*)(\/\/.*)$/, { token: "comment", next: "@blockText.$1.comment" }],
|
|
303
|
+
[/[ \t\r\n]+/, ""],
|
|
304
|
+
[/<!--/, { token: "comment", next: "@comment" }]
|
|
305
|
+
],
|
|
306
|
+
blockText: [
|
|
307
|
+
[
|
|
308
|
+
/^\s+.*$/,
|
|
309
|
+
{
|
|
310
|
+
cases: {
|
|
311
|
+
"($S2\\s+.*$)": { token: "$S3" },
|
|
312
|
+
"@default": { token: "@rematch", next: "@popall" }
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
[/./, { token: "@rematch", next: "@popall" }]
|
|
317
|
+
],
|
|
318
|
+
comment: [
|
|
319
|
+
[/[^<\-]+/, "comment.content"],
|
|
320
|
+
[/-->/, { token: "comment", next: "@pop" }],
|
|
321
|
+
[/<!--/, "comment.content.invalid"],
|
|
322
|
+
[/[<\-]/, "comment.content"]
|
|
323
|
+
],
|
|
324
|
+
string: [
|
|
325
|
+
[
|
|
326
|
+
/[^\\"'#]+/,
|
|
327
|
+
{
|
|
328
|
+
cases: {
|
|
329
|
+
"@eos": { token: "string", next: "@popall" },
|
|
330
|
+
"@default": "string"
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
],
|
|
334
|
+
[
|
|
335
|
+
/@escapes/,
|
|
336
|
+
{
|
|
337
|
+
cases: {
|
|
338
|
+
"@eos": { token: "string.escape", next: "@popall" },
|
|
339
|
+
"@default": "string.escape"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
[
|
|
344
|
+
/\\./,
|
|
345
|
+
{
|
|
346
|
+
cases: {
|
|
347
|
+
"@eos": {
|
|
348
|
+
token: "string.escape.invalid",
|
|
349
|
+
next: "@popall"
|
|
350
|
+
},
|
|
351
|
+
"@default": "string.escape.invalid"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
// interpolation
|
|
356
|
+
[/(#{)([^}]*)(})/, ["interpolation.delimiter", "interpolation", "interpolation.delimiter"]],
|
|
357
|
+
[/#/, "string"],
|
|
358
|
+
[
|
|
359
|
+
/["']/,
|
|
360
|
+
{
|
|
361
|
+
cases: {
|
|
362
|
+
"$#==$S2": { token: "string", next: "@pop" },
|
|
363
|
+
"@default": { token: "string" }
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
],
|
|
368
|
+
// Almost identical to above, except for escapes and the output token
|
|
369
|
+
value: [
|
|
370
|
+
[
|
|
371
|
+
/[^\\"']+/,
|
|
372
|
+
{
|
|
373
|
+
cases: {
|
|
374
|
+
"@eos": { token: "attribute.value", next: "@popall" },
|
|
375
|
+
"@default": "attribute.value"
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
[
|
|
380
|
+
/\\./,
|
|
381
|
+
{
|
|
382
|
+
cases: {
|
|
383
|
+
"@eos": { token: "attribute.value", next: "@popall" },
|
|
384
|
+
"@default": "attribute.value"
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
/["']/,
|
|
390
|
+
{
|
|
391
|
+
cases: {
|
|
392
|
+
"$#==$S2": { token: "attribute.value", next: "@pop" },
|
|
393
|
+
"@default": { token: "attribute.value" }
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
]
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export { conf, language };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { registerLanguage } from '../_.contribution.js';
|
|
2
|
+
|
|
3
|
+
registerLanguage({
|
|
4
|
+
id: "python",
|
|
5
|
+
extensions: [".py", ".rpy", ".pyw", ".cpy", ".gyp", ".gypi"],
|
|
6
|
+
aliases: ["Python", "py"],
|
|
7
|
+
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
8
|
+
loader: () => import('./python.js')
|
|
9
|
+
});
|
package/python/python.js
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { languages } from 'monaco-editor';
|
|
2
|
+
|
|
3
|
+
const conf = {
|
|
4
|
+
comments: {
|
|
5
|
+
lineComment: "#",
|
|
6
|
+
blockComment: ["'''", "'''"]
|
|
7
|
+
},
|
|
8
|
+
brackets: [
|
|
9
|
+
["{", "}"],
|
|
10
|
+
["[", "]"],
|
|
11
|
+
["(", ")"]
|
|
12
|
+
],
|
|
13
|
+
autoClosingPairs: [
|
|
14
|
+
{ open: "{", close: "}" },
|
|
15
|
+
{ open: "[", close: "]" },
|
|
16
|
+
{ open: "(", close: ")" },
|
|
17
|
+
{ open: '"', close: '"', notIn: ["string"] },
|
|
18
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] }
|
|
19
|
+
],
|
|
20
|
+
surroundingPairs: [
|
|
21
|
+
{ open: "{", close: "}" },
|
|
22
|
+
{ open: "[", close: "]" },
|
|
23
|
+
{ open: "(", close: ")" },
|
|
24
|
+
{ open: '"', close: '"' },
|
|
25
|
+
{ open: "'", close: "'" }
|
|
26
|
+
],
|
|
27
|
+
onEnterRules: [
|
|
28
|
+
{
|
|
29
|
+
beforeText: new RegExp(
|
|
30
|
+
"^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$"
|
|
31
|
+
),
|
|
32
|
+
action: { indentAction: languages.IndentAction.Indent }
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
folding: {
|
|
36
|
+
offSide: true,
|
|
37
|
+
markers: {
|
|
38
|
+
start: new RegExp("^\\s*#region\\b"),
|
|
39
|
+
end: new RegExp("^\\s*#endregion\\b")
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const language = {
|
|
44
|
+
defaultToken: "",
|
|
45
|
+
tokenPostfix: ".python",
|
|
46
|
+
keywords: [
|
|
47
|
+
// This section is the result of running
|
|
48
|
+
// `import keyword; for k in sorted(keyword.kwlist + keyword.softkwlist): print(" '" + k + "',")`
|
|
49
|
+
// in a Python REPL,
|
|
50
|
+
// though note that the output from Python 3 is not a strict superset of the
|
|
51
|
+
// output from Python 2.
|
|
52
|
+
"False",
|
|
53
|
+
// promoted to keyword.kwlist in Python 3
|
|
54
|
+
"None",
|
|
55
|
+
// promoted to keyword.kwlist in Python 3
|
|
56
|
+
"True",
|
|
57
|
+
// promoted to keyword.kwlist in Python 3
|
|
58
|
+
"_",
|
|
59
|
+
// new in Python 3.10
|
|
60
|
+
"and",
|
|
61
|
+
"as",
|
|
62
|
+
"assert",
|
|
63
|
+
"async",
|
|
64
|
+
// new in Python 3
|
|
65
|
+
"await",
|
|
66
|
+
// new in Python 3
|
|
67
|
+
"break",
|
|
68
|
+
"case",
|
|
69
|
+
// new in Python 3.10
|
|
70
|
+
"class",
|
|
71
|
+
"continue",
|
|
72
|
+
"def",
|
|
73
|
+
"del",
|
|
74
|
+
"elif",
|
|
75
|
+
"else",
|
|
76
|
+
"except",
|
|
77
|
+
"exec",
|
|
78
|
+
// Python 2, but not 3.
|
|
79
|
+
"finally",
|
|
80
|
+
"for",
|
|
81
|
+
"from",
|
|
82
|
+
"global",
|
|
83
|
+
"if",
|
|
84
|
+
"import",
|
|
85
|
+
"in",
|
|
86
|
+
"is",
|
|
87
|
+
"lambda",
|
|
88
|
+
"match",
|
|
89
|
+
// new in Python 3.10
|
|
90
|
+
"nonlocal",
|
|
91
|
+
// new in Python 3
|
|
92
|
+
"not",
|
|
93
|
+
"or",
|
|
94
|
+
"pass",
|
|
95
|
+
"print",
|
|
96
|
+
// Python 2, but not 3.
|
|
97
|
+
"raise",
|
|
98
|
+
"return",
|
|
99
|
+
"try",
|
|
100
|
+
"type",
|
|
101
|
+
// new in Python 3.12
|
|
102
|
+
"while",
|
|
103
|
+
"with",
|
|
104
|
+
"yield",
|
|
105
|
+
"int",
|
|
106
|
+
"float",
|
|
107
|
+
"long",
|
|
108
|
+
"complex",
|
|
109
|
+
"hex",
|
|
110
|
+
"abs",
|
|
111
|
+
"all",
|
|
112
|
+
"any",
|
|
113
|
+
"apply",
|
|
114
|
+
"basestring",
|
|
115
|
+
"bin",
|
|
116
|
+
"bool",
|
|
117
|
+
"buffer",
|
|
118
|
+
"bytearray",
|
|
119
|
+
"callable",
|
|
120
|
+
"chr",
|
|
121
|
+
"classmethod",
|
|
122
|
+
"cmp",
|
|
123
|
+
"coerce",
|
|
124
|
+
"compile",
|
|
125
|
+
"complex",
|
|
126
|
+
"delattr",
|
|
127
|
+
"dict",
|
|
128
|
+
"dir",
|
|
129
|
+
"divmod",
|
|
130
|
+
"enumerate",
|
|
131
|
+
"eval",
|
|
132
|
+
"execfile",
|
|
133
|
+
"file",
|
|
134
|
+
"filter",
|
|
135
|
+
"format",
|
|
136
|
+
"frozenset",
|
|
137
|
+
"getattr",
|
|
138
|
+
"globals",
|
|
139
|
+
"hasattr",
|
|
140
|
+
"hash",
|
|
141
|
+
"help",
|
|
142
|
+
"id",
|
|
143
|
+
"input",
|
|
144
|
+
"intern",
|
|
145
|
+
"isinstance",
|
|
146
|
+
"issubclass",
|
|
147
|
+
"iter",
|
|
148
|
+
"len",
|
|
149
|
+
"locals",
|
|
150
|
+
"list",
|
|
151
|
+
"map",
|
|
152
|
+
"max",
|
|
153
|
+
"memoryview",
|
|
154
|
+
"min",
|
|
155
|
+
"next",
|
|
156
|
+
"object",
|
|
157
|
+
"oct",
|
|
158
|
+
"open",
|
|
159
|
+
"ord",
|
|
160
|
+
"pow",
|
|
161
|
+
"print",
|
|
162
|
+
"property",
|
|
163
|
+
"reversed",
|
|
164
|
+
"range",
|
|
165
|
+
"raw_input",
|
|
166
|
+
"reduce",
|
|
167
|
+
"reload",
|
|
168
|
+
"repr",
|
|
169
|
+
"reversed",
|
|
170
|
+
"round",
|
|
171
|
+
"self",
|
|
172
|
+
"set",
|
|
173
|
+
"setattr",
|
|
174
|
+
"slice",
|
|
175
|
+
"sorted",
|
|
176
|
+
"staticmethod",
|
|
177
|
+
"str",
|
|
178
|
+
"sum",
|
|
179
|
+
"super",
|
|
180
|
+
"tuple",
|
|
181
|
+
"type",
|
|
182
|
+
"unichr",
|
|
183
|
+
"unicode",
|
|
184
|
+
"vars",
|
|
185
|
+
"xrange",
|
|
186
|
+
"zip",
|
|
187
|
+
"__dict__",
|
|
188
|
+
"__methods__",
|
|
189
|
+
"__members__",
|
|
190
|
+
"__class__",
|
|
191
|
+
"__bases__",
|
|
192
|
+
"__name__",
|
|
193
|
+
"__mro__",
|
|
194
|
+
"__subclasses__",
|
|
195
|
+
"__init__",
|
|
196
|
+
"__import__"
|
|
197
|
+
],
|
|
198
|
+
brackets: [
|
|
199
|
+
{ open: "{", close: "}", token: "delimiter.curly" },
|
|
200
|
+
{ open: "[", close: "]", token: "delimiter.bracket" },
|
|
201
|
+
{ open: "(", close: ")", token: "delimiter.parenthesis" }
|
|
202
|
+
],
|
|
203
|
+
tokenizer: {
|
|
204
|
+
root: [
|
|
205
|
+
{ include: "@whitespace" },
|
|
206
|
+
{ include: "@numbers" },
|
|
207
|
+
{ include: "@strings" },
|
|
208
|
+
[/[,:;]/, "delimiter"],
|
|
209
|
+
[/[{}\[\]()]/, "@brackets"],
|
|
210
|
+
[/@[a-zA-Z_]\w*/, "tag"],
|
|
211
|
+
[
|
|
212
|
+
/[a-zA-Z_]\w*/,
|
|
213
|
+
{
|
|
214
|
+
cases: {
|
|
215
|
+
"@keywords": "keyword",
|
|
216
|
+
"@default": "identifier"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
],
|
|
221
|
+
// Deal with white space, including single and multi-line comments
|
|
222
|
+
whitespace: [
|
|
223
|
+
[/\s+/, "white"],
|
|
224
|
+
[/(^#.*$)/, "comment"],
|
|
225
|
+
[/'''/, "string", "@endDocString"],
|
|
226
|
+
[/"""/, "string", "@endDblDocString"]
|
|
227
|
+
],
|
|
228
|
+
endDocString: [
|
|
229
|
+
[/[^']+/, "string"],
|
|
230
|
+
[/\\'/, "string"],
|
|
231
|
+
[/'''/, "string", "@popall"],
|
|
232
|
+
[/'/, "string"]
|
|
233
|
+
],
|
|
234
|
+
endDblDocString: [
|
|
235
|
+
[/[^"]+/, "string"],
|
|
236
|
+
[/\\"/, "string"],
|
|
237
|
+
[/"""/, "string", "@popall"],
|
|
238
|
+
[/"/, "string"]
|
|
239
|
+
],
|
|
240
|
+
// Recognize hex, negatives, decimals, imaginaries, longs, and scientific notation
|
|
241
|
+
numbers: [
|
|
242
|
+
[/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/, "number.hex"],
|
|
243
|
+
[/-?(\d*\.)?\d+([eE][+\-]?\d+)?[jJ]?[lL]?/, "number"]
|
|
244
|
+
],
|
|
245
|
+
// Recognize strings, including those broken across lines with \ (but not without)
|
|
246
|
+
strings: [
|
|
247
|
+
[/'$/, "string.escape", "@popall"],
|
|
248
|
+
[/f'{1,3}/, "string.escape", "@fStringBody"],
|
|
249
|
+
[/'/, "string.escape", "@stringBody"],
|
|
250
|
+
[/"$/, "string.escape", "@popall"],
|
|
251
|
+
[/f"{1,3}/, "string.escape", "@fDblStringBody"],
|
|
252
|
+
[/"/, "string.escape", "@dblStringBody"]
|
|
253
|
+
],
|
|
254
|
+
fStringBody: [
|
|
255
|
+
[/[^\\'\{\}]+$/, "string", "@popall"],
|
|
256
|
+
[/[^\\'\{\}]+/, "string"],
|
|
257
|
+
[/\{[^\}':!=]+/, "identifier", "@fStringDetail"],
|
|
258
|
+
[/\\./, "string"],
|
|
259
|
+
[/'/, "string.escape", "@popall"],
|
|
260
|
+
[/\\$/, "string"]
|
|
261
|
+
],
|
|
262
|
+
stringBody: [
|
|
263
|
+
[/[^\\']+$/, "string", "@popall"],
|
|
264
|
+
[/[^\\']+/, "string"],
|
|
265
|
+
[/\\./, "string"],
|
|
266
|
+
[/'/, "string.escape", "@popall"],
|
|
267
|
+
[/\\$/, "string"]
|
|
268
|
+
],
|
|
269
|
+
fDblStringBody: [
|
|
270
|
+
[/[^\\"\{\}]+$/, "string", "@popall"],
|
|
271
|
+
[/[^\\"\{\}]+/, "string"],
|
|
272
|
+
[/\{[^\}':!=]+/, "identifier", "@fStringDetail"],
|
|
273
|
+
[/\\./, "string"],
|
|
274
|
+
[/"/, "string.escape", "@popall"],
|
|
275
|
+
[/\\$/, "string"]
|
|
276
|
+
],
|
|
277
|
+
dblStringBody: [
|
|
278
|
+
[/[^\\"]+$/, "string", "@popall"],
|
|
279
|
+
[/[^\\"]+/, "string"],
|
|
280
|
+
[/\\./, "string"],
|
|
281
|
+
[/"/, "string.escape", "@popall"],
|
|
282
|
+
[/\\$/, "string"]
|
|
283
|
+
],
|
|
284
|
+
fStringDetail: [
|
|
285
|
+
[/[:][^}]+/, "string"],
|
|
286
|
+
[/[!][ars]/, "string"],
|
|
287
|
+
// only !a, !r, !s are supported by f-strings: https://docs.python.org/3/tutorial/inputoutput.html#formatted-string-literals
|
|
288
|
+
[/=/, "string"],
|
|
289
|
+
[/\}/, "identifier", "@pop"]
|
|
290
|
+
]
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
export { conf, language };
|