@codingame/monaco-vscode-standalone-languages 23.2.0 → 23.2.2
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
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { languages } from 'monaco-editor';
|
|
2
|
+
|
|
3
|
+
const conf = {
|
|
4
|
+
wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
|
|
5
|
+
comments: {
|
|
6
|
+
lineComment: "//",
|
|
7
|
+
blockComment: ["/*", "*/"]
|
|
8
|
+
},
|
|
9
|
+
brackets: [
|
|
10
|
+
["{", "}"],
|
|
11
|
+
["[", "]"],
|
|
12
|
+
["(", ")"]
|
|
13
|
+
],
|
|
14
|
+
onEnterRules: [
|
|
15
|
+
{
|
|
16
|
+
// e.g. /** | */
|
|
17
|
+
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
18
|
+
afterText: /^\s*\*\/$/,
|
|
19
|
+
action: {
|
|
20
|
+
indentAction: languages.IndentAction.IndentOutdent,
|
|
21
|
+
appendText: " * "
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
// e.g. /** ...|
|
|
26
|
+
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
|
|
27
|
+
action: {
|
|
28
|
+
indentAction: languages.IndentAction.None,
|
|
29
|
+
appendText: " * "
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
// e.g. * ...|
|
|
34
|
+
beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
|
|
35
|
+
action: {
|
|
36
|
+
indentAction: languages.IndentAction.None,
|
|
37
|
+
appendText: "* "
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
// e.g. */|
|
|
42
|
+
beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
|
|
43
|
+
action: {
|
|
44
|
+
indentAction: languages.IndentAction.None,
|
|
45
|
+
removeText: 1
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
autoClosingPairs: [
|
|
50
|
+
{ open: "{", close: "}" },
|
|
51
|
+
{ open: "[", close: "]" },
|
|
52
|
+
{ open: "(", close: ")" },
|
|
53
|
+
{ open: '"', close: '"', notIn: ["string"] },
|
|
54
|
+
{ open: "'", close: "'", notIn: ["string", "comment"] },
|
|
55
|
+
{ open: "`", close: "`", notIn: ["string", "comment"] },
|
|
56
|
+
{ open: "/**", close: " */", notIn: ["string"] }
|
|
57
|
+
],
|
|
58
|
+
folding: {
|
|
59
|
+
markers: {
|
|
60
|
+
start: new RegExp("^\\s*//\\s*#?region\\b"),
|
|
61
|
+
end: new RegExp("^\\s*//\\s*#?endregion\\b")
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const language = {
|
|
66
|
+
// Set defaultToken to invalid to see what you do not tokenize yet
|
|
67
|
+
defaultToken: "invalid",
|
|
68
|
+
tokenPostfix: ".ts",
|
|
69
|
+
keywords: [
|
|
70
|
+
// Should match the keys of textToKeywordObj in
|
|
71
|
+
// https://github.com/microsoft/TypeScript/blob/master/src/compiler/scanner.ts
|
|
72
|
+
"abstract",
|
|
73
|
+
"any",
|
|
74
|
+
"as",
|
|
75
|
+
"asserts",
|
|
76
|
+
"bigint",
|
|
77
|
+
"boolean",
|
|
78
|
+
"break",
|
|
79
|
+
"case",
|
|
80
|
+
"catch",
|
|
81
|
+
"class",
|
|
82
|
+
"continue",
|
|
83
|
+
"const",
|
|
84
|
+
"constructor",
|
|
85
|
+
"debugger",
|
|
86
|
+
"declare",
|
|
87
|
+
"default",
|
|
88
|
+
"delete",
|
|
89
|
+
"do",
|
|
90
|
+
"else",
|
|
91
|
+
"enum",
|
|
92
|
+
"export",
|
|
93
|
+
"extends",
|
|
94
|
+
"false",
|
|
95
|
+
"finally",
|
|
96
|
+
"for",
|
|
97
|
+
"from",
|
|
98
|
+
"function",
|
|
99
|
+
"get",
|
|
100
|
+
"if",
|
|
101
|
+
"implements",
|
|
102
|
+
"import",
|
|
103
|
+
"in",
|
|
104
|
+
"infer",
|
|
105
|
+
"instanceof",
|
|
106
|
+
"interface",
|
|
107
|
+
"is",
|
|
108
|
+
"keyof",
|
|
109
|
+
"let",
|
|
110
|
+
"module",
|
|
111
|
+
"namespace",
|
|
112
|
+
"never",
|
|
113
|
+
"new",
|
|
114
|
+
"null",
|
|
115
|
+
"number",
|
|
116
|
+
"object",
|
|
117
|
+
"out",
|
|
118
|
+
"package",
|
|
119
|
+
"private",
|
|
120
|
+
"protected",
|
|
121
|
+
"public",
|
|
122
|
+
"override",
|
|
123
|
+
"readonly",
|
|
124
|
+
"require",
|
|
125
|
+
"global",
|
|
126
|
+
"return",
|
|
127
|
+
"satisfies",
|
|
128
|
+
"set",
|
|
129
|
+
"static",
|
|
130
|
+
"string",
|
|
131
|
+
"super",
|
|
132
|
+
"switch",
|
|
133
|
+
"symbol",
|
|
134
|
+
"this",
|
|
135
|
+
"throw",
|
|
136
|
+
"true",
|
|
137
|
+
"try",
|
|
138
|
+
"type",
|
|
139
|
+
"typeof",
|
|
140
|
+
"undefined",
|
|
141
|
+
"unique",
|
|
142
|
+
"unknown",
|
|
143
|
+
"var",
|
|
144
|
+
"void",
|
|
145
|
+
"while",
|
|
146
|
+
"with",
|
|
147
|
+
"yield",
|
|
148
|
+
"async",
|
|
149
|
+
"await",
|
|
150
|
+
"of"
|
|
151
|
+
],
|
|
152
|
+
operators: [
|
|
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
|
+
// we include these common regular expressions
|
|
198
|
+
symbols: /[=><!~?:&|+\-*\/\^%]+/,
|
|
199
|
+
escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
|
|
200
|
+
digits: /\d+(_+\d+)*/,
|
|
201
|
+
octaldigits: /[0-7]+(_+[0-7]+)*/,
|
|
202
|
+
binarydigits: /[0-1]+(_+[0-1]+)*/,
|
|
203
|
+
hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
|
|
204
|
+
regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
|
|
205
|
+
regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
|
|
206
|
+
// The main tokenizer for our languages
|
|
207
|
+
tokenizer: {
|
|
208
|
+
root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
|
|
209
|
+
common: [
|
|
210
|
+
// identifiers and keywords
|
|
211
|
+
[
|
|
212
|
+
/#?[a-z_$][\w$]*/,
|
|
213
|
+
{
|
|
214
|
+
cases: {
|
|
215
|
+
"@keywords": "keyword",
|
|
216
|
+
"@default": "identifier"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
[/[A-Z][\w\$]*/, "type.identifier"],
|
|
221
|
+
// to show class names nicely
|
|
222
|
+
// [/[A-Z][\w\$]*/, 'identifier'],
|
|
223
|
+
// whitespace
|
|
224
|
+
{ include: "@whitespace" },
|
|
225
|
+
// regular expression: ensure it is terminated before beginning (otherwise it is an opeator)
|
|
226
|
+
[
|
|
227
|
+
/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
|
|
228
|
+
{ token: "regexp", bracket: "@open", next: "@regexp" }
|
|
229
|
+
],
|
|
230
|
+
// delimiters and operators
|
|
231
|
+
[/[()\[\]]/, "@brackets"],
|
|
232
|
+
[/[<>](?!@symbols)/, "@brackets"],
|
|
233
|
+
[/!(?=([^=]|$))/, "delimiter"],
|
|
234
|
+
[
|
|
235
|
+
/@symbols/,
|
|
236
|
+
{
|
|
237
|
+
cases: {
|
|
238
|
+
"@operators": "delimiter",
|
|
239
|
+
"@default": ""
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
// numbers
|
|
244
|
+
[/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
|
|
245
|
+
[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
|
|
246
|
+
[/0[xX](@hexdigits)n?/, "number.hex"],
|
|
247
|
+
[/0[oO]?(@octaldigits)n?/, "number.octal"],
|
|
248
|
+
[/0[bB](@binarydigits)n?/, "number.binary"],
|
|
249
|
+
[/(@digits)n?/, "number"],
|
|
250
|
+
// delimiter: after number because of .\d floats
|
|
251
|
+
[/[;,.]/, "delimiter"],
|
|
252
|
+
// strings
|
|
253
|
+
[/"([^"\\]|\\.)*$/, "string.invalid"],
|
|
254
|
+
// non-teminated string
|
|
255
|
+
[/'([^'\\]|\\.)*$/, "string.invalid"],
|
|
256
|
+
// non-teminated string
|
|
257
|
+
[/"/, "string", "@string_double"],
|
|
258
|
+
[/'/, "string", "@string_single"],
|
|
259
|
+
[/`/, "string", "@string_backtick"]
|
|
260
|
+
],
|
|
261
|
+
whitespace: [
|
|
262
|
+
[/[ \t\r\n]+/, ""],
|
|
263
|
+
[/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
|
|
264
|
+
[/\/\*/, "comment", "@comment"],
|
|
265
|
+
[/\/\/.*$/, "comment"]
|
|
266
|
+
],
|
|
267
|
+
comment: [
|
|
268
|
+
[/[^\/*]+/, "comment"],
|
|
269
|
+
[/\*\//, "comment", "@pop"],
|
|
270
|
+
[/[\/*]/, "comment"]
|
|
271
|
+
],
|
|
272
|
+
jsdoc: [
|
|
273
|
+
[/[^\/*]+/, "comment.doc"],
|
|
274
|
+
[/\*\//, "comment.doc", "@pop"],
|
|
275
|
+
[/[\/*]/, "comment.doc"]
|
|
276
|
+
],
|
|
277
|
+
// We match regular expression quite precisely
|
|
278
|
+
regexp: [
|
|
279
|
+
[
|
|
280
|
+
/(\{)(\d+(?:,\d*)?)(\})/,
|
|
281
|
+
["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
|
|
282
|
+
],
|
|
283
|
+
[
|
|
284
|
+
/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
|
|
285
|
+
["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
|
|
286
|
+
],
|
|
287
|
+
[/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
|
|
288
|
+
[/[()]/, "regexp.escape.control"],
|
|
289
|
+
[/@regexpctl/, "regexp.escape.control"],
|
|
290
|
+
[/[^\\\/]/, "regexp"],
|
|
291
|
+
[/@regexpesc/, "regexp.escape"],
|
|
292
|
+
[/\\\./, "regexp.invalid"],
|
|
293
|
+
[/(\/)([dgimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
|
|
294
|
+
],
|
|
295
|
+
regexrange: [
|
|
296
|
+
[/-/, "regexp.escape.control"],
|
|
297
|
+
[/\^/, "regexp.invalid"],
|
|
298
|
+
[/@regexpesc/, "regexp.escape"],
|
|
299
|
+
[/[^\]]/, "regexp"],
|
|
300
|
+
[
|
|
301
|
+
/\]/,
|
|
302
|
+
{
|
|
303
|
+
token: "regexp.escape.control",
|
|
304
|
+
next: "@pop",
|
|
305
|
+
bracket: "@close"
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
],
|
|
309
|
+
string_double: [
|
|
310
|
+
[/[^\\"]+/, "string"],
|
|
311
|
+
[/@escapes/, "string.escape"],
|
|
312
|
+
[/\\./, "string.escape.invalid"],
|
|
313
|
+
[/"/, "string", "@pop"]
|
|
314
|
+
],
|
|
315
|
+
string_single: [
|
|
316
|
+
[/[^\\']+/, "string"],
|
|
317
|
+
[/@escapes/, "string.escape"],
|
|
318
|
+
[/\\./, "string.escape.invalid"],
|
|
319
|
+
[/'/, "string", "@pop"]
|
|
320
|
+
],
|
|
321
|
+
string_backtick: [
|
|
322
|
+
[/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
|
|
323
|
+
[/[^\\`$]+/, "string"],
|
|
324
|
+
[/@escapes/, "string.escape"],
|
|
325
|
+
[/\\./, "string.escape.invalid"],
|
|
326
|
+
[/`/, "string", "@pop"]
|
|
327
|
+
],
|
|
328
|
+
bracketCounting: [
|
|
329
|
+
[/\{/, "delimiter.bracket", "@bracketCounting"],
|
|
330
|
+
[/\}/, "delimiter.bracket", "@pop"],
|
|
331
|
+
{ include: "common" }
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export { conf, language };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const bounded = (text) => `\\b${text}\\b`;
|
|
2
|
+
const notBefore = (regex) => `(?!${regex})`;
|
|
3
|
+
const identifierStart = "[_a-zA-Z]";
|
|
4
|
+
const identifierContinue = "[_a-zA-Z0-9]";
|
|
5
|
+
const identifier = bounded(`${identifierStart}${identifierContinue}*`);
|
|
6
|
+
const directive = bounded(`[_a-zA-Z-0-9]+`);
|
|
7
|
+
const keywords = [
|
|
8
|
+
"import",
|
|
9
|
+
"model",
|
|
10
|
+
"scalar",
|
|
11
|
+
"namespace",
|
|
12
|
+
"op",
|
|
13
|
+
"interface",
|
|
14
|
+
"union",
|
|
15
|
+
"using",
|
|
16
|
+
"is",
|
|
17
|
+
"extends",
|
|
18
|
+
"enum",
|
|
19
|
+
"alias",
|
|
20
|
+
"return",
|
|
21
|
+
"void",
|
|
22
|
+
"if",
|
|
23
|
+
"else",
|
|
24
|
+
"projection",
|
|
25
|
+
"dec",
|
|
26
|
+
"extern",
|
|
27
|
+
"fn"
|
|
28
|
+
];
|
|
29
|
+
const namedLiterals = ["true", "false", "null", "unknown", "never"];
|
|
30
|
+
const nonCommentWs = `[ \\t\\r\\n]`;
|
|
31
|
+
const numericLiteral = `[0-9]+`;
|
|
32
|
+
const conf = {
|
|
33
|
+
comments: {
|
|
34
|
+
lineComment: "//",
|
|
35
|
+
blockComment: ["/*", "*/"]
|
|
36
|
+
},
|
|
37
|
+
brackets: [
|
|
38
|
+
["{", "}"],
|
|
39
|
+
["[", "]"],
|
|
40
|
+
["(", ")"]
|
|
41
|
+
],
|
|
42
|
+
autoClosingPairs: [
|
|
43
|
+
{ open: "{", close: "}" },
|
|
44
|
+
{ open: "[", close: "]" },
|
|
45
|
+
{ open: "(", close: ")" },
|
|
46
|
+
{ open: '"', close: '"' },
|
|
47
|
+
{ open: "/**", close: " */", notIn: ["string"] }
|
|
48
|
+
],
|
|
49
|
+
surroundingPairs: [
|
|
50
|
+
{ open: "{", close: "}" },
|
|
51
|
+
{ open: "[", close: "]" },
|
|
52
|
+
{ open: "(", close: ")" },
|
|
53
|
+
{ open: '"', close: '"' }
|
|
54
|
+
],
|
|
55
|
+
indentationRules: {
|
|
56
|
+
decreaseIndentPattern: new RegExp("^((?!.*?/\\*).*\\*/)?\\s*[\\}\\]].*$"),
|
|
57
|
+
increaseIndentPattern: new RegExp(
|
|
58
|
+
"^((?!//).)*(\\{([^}\"'`/]*|(\\t|[ ])*//.*)|\\([^)\"'`/]*|\\[[^\\]\"'`/]*)$"
|
|
59
|
+
),
|
|
60
|
+
// e.g. * ...| or */| or *-----*/|
|
|
61
|
+
unIndentedLinePattern: new RegExp(
|
|
62
|
+
"^(\\t|[ ])*[ ]\\*[^/]*\\*/\\s*$|^(\\t|[ ])*[ ]\\*/\\s*$|^(\\t|[ ])*[ ]\\*([ ]([^\\*]|\\*(?!/))*)?$"
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const language = {
|
|
67
|
+
defaultToken: "",
|
|
68
|
+
tokenPostfix: ".tsp",
|
|
69
|
+
brackets: [
|
|
70
|
+
{ open: "{", close: "}", token: "delimiter.curly" },
|
|
71
|
+
{ open: "[", close: "]", token: "delimiter.square" },
|
|
72
|
+
{ open: "(", close: ")", token: "delimiter.parenthesis" }
|
|
73
|
+
],
|
|
74
|
+
symbols: /[=:;<>]+/,
|
|
75
|
+
keywords,
|
|
76
|
+
namedLiterals,
|
|
77
|
+
escapes: `\\\\(u{[0-9A-Fa-f]+}|n|r|t|\\\\|"|\\\${)`,
|
|
78
|
+
tokenizer: {
|
|
79
|
+
root: [{ include: "@expression" }, { include: "@whitespace" }],
|
|
80
|
+
stringVerbatim: [
|
|
81
|
+
{ regex: `(|"|"")[^"]`, action: { token: "string" } },
|
|
82
|
+
{ regex: `"""${notBefore(`"`)}`, action: { token: "string", next: "@pop" } }
|
|
83
|
+
],
|
|
84
|
+
stringLiteral: [
|
|
85
|
+
{ regex: `\\\${`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
|
|
86
|
+
{ regex: `[^\\\\"$]+`, action: { token: "string" } },
|
|
87
|
+
{ regex: "@escapes", action: { token: "string.escape" } },
|
|
88
|
+
{ regex: `\\\\.`, action: { token: "string.escape.invalid" } },
|
|
89
|
+
{ regex: `"`, action: { token: "string", next: "@pop" } }
|
|
90
|
+
],
|
|
91
|
+
bracketCounting: [
|
|
92
|
+
{ regex: `{`, action: { token: "delimiter.bracket", next: "@bracketCounting" } },
|
|
93
|
+
{ regex: `}`, action: { token: "delimiter.bracket", next: "@pop" } },
|
|
94
|
+
{ include: "@expression" }
|
|
95
|
+
],
|
|
96
|
+
comment: [
|
|
97
|
+
{ regex: `[^\\*]+`, action: { token: "comment" } },
|
|
98
|
+
{ regex: `\\*\\/`, action: { token: "comment", next: "@pop" } },
|
|
99
|
+
{ regex: `[\\/*]`, action: { token: "comment" } }
|
|
100
|
+
],
|
|
101
|
+
whitespace: [
|
|
102
|
+
{ regex: nonCommentWs },
|
|
103
|
+
{ regex: `\\/\\*`, action: { token: "comment", next: "@comment" } },
|
|
104
|
+
{ regex: `\\/\\/.*$`, action: { token: "comment" } }
|
|
105
|
+
],
|
|
106
|
+
expression: [
|
|
107
|
+
{ regex: `"""`, action: { token: "string", next: "@stringVerbatim" } },
|
|
108
|
+
{ regex: `"${notBefore(`""`)}`, action: { token: "string", next: "@stringLiteral" } },
|
|
109
|
+
{ regex: numericLiteral, action: { token: "number" } },
|
|
110
|
+
{
|
|
111
|
+
regex: identifier,
|
|
112
|
+
action: {
|
|
113
|
+
cases: {
|
|
114
|
+
"@keywords": { token: "keyword" },
|
|
115
|
+
"@namedLiterals": { token: "keyword" },
|
|
116
|
+
"@default": { token: "identifier" }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
{ regex: `@${identifier}`, action: { token: "tag" } },
|
|
121
|
+
{ regex: `#${directive}`, action: { token: "directive" } }
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { conf, language };
|