@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.
Files changed (165) hide show
  1. package/_.contribution.js +48 -0
  2. package/abap/abap.contribution.js +8 -0
  3. package/abap/abap.js +1397 -0
  4. package/apex/apex.contribution.js +9 -0
  5. package/apex/apex.js +329 -0
  6. package/azcli/azcli.contribution.js +8 -0
  7. package/azcli/azcli.js +67 -0
  8. package/bat/bat.contribution.js +8 -0
  9. package/bat/bat.js +99 -0
  10. package/bicep/bicep.contribution.js +8 -0
  11. package/bicep/bicep.js +108 -0
  12. package/cameligo/cameligo.contribution.js +8 -0
  13. package/cameligo/cameligo.js +173 -0
  14. package/clojure/clojure.contribution.js +8 -0
  15. package/clojure/clojure.js +760 -0
  16. package/coffee/coffee.contribution.js +9 -0
  17. package/coffee/coffee.js +231 -0
  18. package/cpp/cpp.contribution.js +14 -0
  19. package/cpp/cpp.js +388 -0
  20. package/csharp/csharp.contribution.js +8 -0
  21. package/csharp/csharp.js +325 -0
  22. package/csp/csp.contribution.js +8 -0
  23. package/csp/csp.js +52 -0
  24. package/css/css.contribution.js +9 -0
  25. package/css/css.js +184 -0
  26. package/cypher/cypher.contribution.js +8 -0
  27. package/cypher/cypher.js +262 -0
  28. package/dart/dart.contribution.js +9 -0
  29. package/dart/dart.js +280 -0
  30. package/dockerfile/dockerfile.contribution.js +9 -0
  31. package/dockerfile/dockerfile.js +129 -0
  32. package/ecl/ecl.contribution.js +8 -0
  33. package/ecl/ecl.js +455 -0
  34. package/elixir/elixir.contribution.js +8 -0
  35. package/elixir/elixir.js +568 -0
  36. package/flow9/flow9.contribution.js +8 -0
  37. package/flow9/flow9.js +141 -0
  38. package/freemarker2/freemarker2.contribution.js +52 -0
  39. package/freemarker2/freemarker2.js +990 -0
  40. package/fsharp/fsharp.contribution.js +8 -0
  41. package/fsharp/fsharp.js +216 -0
  42. package/go/go.contribution.js +8 -0
  43. package/go/go.js +217 -0
  44. package/graphql/graphql.contribution.js +9 -0
  45. package/graphql/graphql.js +150 -0
  46. package/handlebars/handlebars.contribution.js +9 -0
  47. package/handlebars/handlebars.js +413 -0
  48. package/hcl/hcl.contribution.js +8 -0
  49. package/hcl/hcl.js +182 -0
  50. package/html/html.contribution.js +9 -0
  51. package/html/html.js +302 -0
  52. package/index.js +81 -48
  53. package/ini/ini.contribution.js +9 -0
  54. package/ini/ini.js +70 -0
  55. package/java/java.contribution.js +9 -0
  56. package/java/java.js +231 -0
  57. package/javascript/javascript.contribution.js +11 -0
  58. package/javascript/javascript.js +70 -0
  59. package/julia/julia.contribution.js +8 -0
  60. package/julia/julia.js +510 -0
  61. package/kotlin/kotlin.contribution.js +9 -0
  62. package/kotlin/kotlin.js +251 -0
  63. package/less/less.contribution.js +9 -0
  64. package/less/less.js +160 -0
  65. package/lexon/lexon.contribution.js +8 -0
  66. package/lexon/lexon.js +156 -0
  67. package/liquid/liquid.contribution.js +9 -0
  68. package/liquid/liquid.js +234 -0
  69. package/lua/lua.contribution.js +8 -0
  70. package/lua/lua.js +161 -0
  71. package/m3/m3.contribution.js +8 -0
  72. package/m3/m3.js +209 -0
  73. package/markdown/markdown.contribution.js +8 -0
  74. package/markdown/markdown.js +228 -0
  75. package/mdx/mdx.contribution.js +8 -0
  76. package/mdx/mdx.js +158 -0
  77. package/mips/mips.contribution.js +9 -0
  78. package/mips/mips.js +197 -0
  79. package/msdax/msdax.contribution.js +8 -0
  80. package/msdax/msdax.js +374 -0
  81. package/mysql/mysql.contribution.js +8 -0
  82. package/mysql/mysql.js +877 -0
  83. package/objective-c/objective-c.contribution.js +8 -0
  84. package/objective-c/objective-c.js +182 -0
  85. package/package.json +2 -2
  86. package/pascal/pascal.contribution.js +9 -0
  87. package/pascal/pascal.js +250 -0
  88. package/pascaligo/pascaligo.contribution.js +8 -0
  89. package/pascaligo/pascaligo.js +163 -0
  90. package/perl/perl.contribution.js +8 -0
  91. package/perl/perl.js +625 -0
  92. package/pgsql/pgsql.contribution.js +8 -0
  93. package/pgsql/pgsql.js +850 -0
  94. package/php/php.contribution.js +9 -0
  95. package/php/php.js +499 -0
  96. package/pla/pla.contribution.js +7 -0
  97. package/pla/pla.js +136 -0
  98. package/postiats/postiats.contribution.js +8 -0
  99. package/postiats/postiats.js +906 -0
  100. package/powerquery/powerquery.contribution.js +8 -0
  101. package/powerquery/powerquery.js +889 -0
  102. package/powershell/powershell.contribution.js +8 -0
  103. package/powershell/powershell.js +238 -0
  104. package/protobuf/protobuf.contribution.js +8 -0
  105. package/protobuf/protobuf.js +419 -0
  106. package/pug/pug.contribution.js +8 -0
  107. package/pug/pug.js +401 -0
  108. package/python/python.contribution.js +9 -0
  109. package/python/python.js +294 -0
  110. package/qsharp/qsharp.contribution.js +8 -0
  111. package/qsharp/qsharp.js +300 -0
  112. package/r/r.contribution.js +8 -0
  113. package/r/r.js +242 -0
  114. package/razor/razor.contribution.js +9 -0
  115. package/razor/razor.js +544 -0
  116. package/redis/redis.contribution.js +8 -0
  117. package/redis/redis.js +301 -0
  118. package/redshift/redshift.contribution.js +8 -0
  119. package/redshift/redshift.js +808 -0
  120. package/restructuredtext/restructuredtext.contribution.js +8 -0
  121. package/restructuredtext/restructuredtext.js +173 -0
  122. package/ruby/ruby.contribution.js +9 -0
  123. package/ruby/ruby.js +510 -0
  124. package/rust/rust.contribution.js +8 -0
  125. package/rust/rust.js +342 -0
  126. package/sb/sb.contribution.js +8 -0
  127. package/sb/sb.js +114 -0
  128. package/scala/scala.contribution.js +9 -0
  129. package/scala/scala.js +369 -0
  130. package/scheme/scheme.contribution.js +8 -0
  131. package/scheme/scheme.js +107 -0
  132. package/scss/scss.contribution.js +9 -0
  133. package/scss/scss.js +259 -0
  134. package/shell/shell.contribution.js +8 -0
  135. package/shell/shell.js +220 -0
  136. package/solidity/solidity.contribution.js +8 -0
  137. package/solidity/solidity.js +1366 -0
  138. package/sophia/sophia.contribution.js +8 -0
  139. package/sophia/sophia.js +198 -0
  140. package/sparql/sparql.contribution.js +8 -0
  141. package/sparql/sparql.js +200 -0
  142. package/sql/sql.contribution.js +8 -0
  143. package/sql/sql.js +852 -0
  144. package/st/st.contribution.js +8 -0
  145. package/st/st.js +415 -0
  146. package/swift/swift.contribution.js +9 -0
  147. package/swift/swift.js +311 -0
  148. package/systemverilog/systemverilog.contribution.js +14 -0
  149. package/systemverilog/systemverilog.js +575 -0
  150. package/tcl/tcl.contribution.js +8 -0
  151. package/tcl/tcl.js +231 -0
  152. package/twig/twig.contribution.js +9 -0
  153. package/twig/twig.js +391 -0
  154. package/typescript/typescript.contribution.js +11 -0
  155. package/typescript/typescript.js +336 -0
  156. package/typespec/typespec.contribution.js +8 -0
  157. package/typespec/typespec.js +126 -0
  158. package/vb/vb.contribution.js +8 -0
  159. package/vb/vb.js +371 -0
  160. package/wgsl/wgsl.contribution.js +8 -0
  161. package/wgsl/wgsl.js +452 -0
  162. package/xml/xml.contribution.js +28 -0
  163. package/xml/xml.js +88 -0
  164. package/yaml/yaml.contribution.js +9 -0
  165. package/yaml/yaml.js +199 -0
package/ruby/ruby.js ADDED
@@ -0,0 +1,510 @@
1
+ const conf = {
2
+ comments: {
3
+ lineComment: "#",
4
+ blockComment: ["=begin", "=end"]
5
+ },
6
+ brackets: [
7
+ ["(", ")"],
8
+ ["{", "}"],
9
+ ["[", "]"]
10
+ ],
11
+ autoClosingPairs: [
12
+ { open: "{", close: "}" },
13
+ { open: "[", close: "]" },
14
+ { open: "(", close: ")" },
15
+ { open: '"', close: '"' },
16
+ { open: "'", close: "'" }
17
+ ],
18
+ surroundingPairs: [
19
+ { open: "{", close: "}" },
20
+ { open: "[", close: "]" },
21
+ { open: "(", close: ")" },
22
+ { open: '"', close: '"' },
23
+ { open: "'", close: "'" }
24
+ ],
25
+ indentationRules: {
26
+ increaseIndentPattern: new RegExp(
27
+ `^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|("|'|/).*\\4)*(#.*)?$`
28
+ ),
29
+ decreaseIndentPattern: new RegExp(
30
+ "^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)"
31
+ )
32
+ }
33
+ };
34
+ const language = {
35
+ tokenPostfix: ".ruby",
36
+ keywords: [
37
+ "__LINE__",
38
+ "__ENCODING__",
39
+ "__FILE__",
40
+ "BEGIN",
41
+ "END",
42
+ "alias",
43
+ "and",
44
+ "begin",
45
+ "break",
46
+ "case",
47
+ "class",
48
+ "def",
49
+ "defined?",
50
+ "do",
51
+ "else",
52
+ "elsif",
53
+ "end",
54
+ "ensure",
55
+ "for",
56
+ "false",
57
+ "if",
58
+ "in",
59
+ "module",
60
+ "next",
61
+ "nil",
62
+ "not",
63
+ "or",
64
+ "redo",
65
+ "rescue",
66
+ "retry",
67
+ "return",
68
+ "self",
69
+ "super",
70
+ "then",
71
+ "true",
72
+ "undef",
73
+ "unless",
74
+ "until",
75
+ "when",
76
+ "while",
77
+ "yield"
78
+ ],
79
+ keywordops: ["::", "..", "...", "?", ":", "=>"],
80
+ builtins: [
81
+ "require",
82
+ "public",
83
+ "private",
84
+ "include",
85
+ "extend",
86
+ "attr_reader",
87
+ "protected",
88
+ "private_class_method",
89
+ "protected_class_method",
90
+ "new"
91
+ ],
92
+ // these are closed by 'end' (if, while and until are handled separately)
93
+ declarations: [
94
+ "module",
95
+ "class",
96
+ "def",
97
+ "case",
98
+ "do",
99
+ "begin",
100
+ "for",
101
+ "if",
102
+ "while",
103
+ "until",
104
+ "unless"
105
+ ],
106
+ linedecls: ["def", "case", "do", "begin", "for", "if", "while", "until", "unless"],
107
+ operators: [
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
+ brackets: [
149
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
150
+ { open: "{", close: "}", token: "delimiter.curly" },
151
+ { open: "[", close: "]", token: "delimiter.square" }
152
+ ],
153
+ // we include these common regular expressions
154
+ symbols: /[=><!~?:&|+\-*\/\^%\.]+/,
155
+ // escape sequences
156
+ escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
157
+ escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
158
+ decpart: /\d(_?\d)*/,
159
+ decimal: /0|@decpart/,
160
+ delim: /[^a-zA-Z0-9\s\n\r]/,
161
+ heredelim: /(?:\w+|'[^']*'|"[^"]*"|`[^`]*`)/,
162
+ regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
163
+ regexpesc: /\\(?:[AzZbBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})?/,
164
+ // The main tokenizer for our languages
165
+ tokenizer: {
166
+ // Main entry.
167
+ // root.<decl> where decl is the current opening declaration (like 'class')
168
+ root: [
169
+ // identifiers and keywords
170
+ // most complexity here is due to matching 'end' correctly with declarations.
171
+ // We distinguish a declaration that comes first on a line, versus declarations further on a line (which are most likey modifiers)
172
+ [
173
+ /^(\s*)([a-z_]\w*[!?=]?)/,
174
+ [
175
+ "white",
176
+ {
177
+ cases: {
178
+ "for|until|while": {
179
+ token: "keyword.$2",
180
+ next: "@dodecl.$2"
181
+ },
182
+ "@declarations": {
183
+ token: "keyword.$2",
184
+ next: "@root.$2"
185
+ },
186
+ end: { token: "keyword.$S2", next: "@pop" },
187
+ "@keywords": "keyword",
188
+ "@builtins": "predefined",
189
+ "@default": "identifier"
190
+ }
191
+ }
192
+ ]
193
+ ],
194
+ [
195
+ /[a-z_]\w*[!?=]?/,
196
+ {
197
+ cases: {
198
+ "if|unless|while|until": {
199
+ token: "keyword.$0x",
200
+ next: "@modifier.$0x"
201
+ },
202
+ for: { token: "keyword.$2", next: "@dodecl.$2" },
203
+ "@linedecls": { token: "keyword.$0", next: "@root.$0" },
204
+ end: { token: "keyword.$S2", next: "@pop" },
205
+ "@keywords": "keyword",
206
+ "@builtins": "predefined",
207
+ "@default": "identifier"
208
+ }
209
+ }
210
+ ],
211
+ [/[A-Z][\w]*[!?=]?/, "constructor.identifier"],
212
+ // constant
213
+ [/\$[\w]*/, "global.constant"],
214
+ // global
215
+ [/@[\w]*/, "namespace.instance.identifier"],
216
+ // instance
217
+ [/@@@[\w]*/, "namespace.class.identifier"],
218
+ // class
219
+ // here document
220
+ [/<<[-~](@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
221
+ [/[ \t\r\n]+<<(@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
222
+ [/^<<(@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
223
+ // whitespace
224
+ { include: "@whitespace" },
225
+ // strings
226
+ [/"/, { token: "string.d.delim", next: '@dstring.d."' }],
227
+ [/'/, { token: "string.sq.delim", next: "@sstring.sq" }],
228
+ // % literals. For efficiency, rematch in the 'pstring' state
229
+ [/%([rsqxwW]|Q?)/, { token: "@rematch", next: "pstring" }],
230
+ // commands and symbols
231
+ [/`/, { token: "string.x.delim", next: "@dstring.x.`" }],
232
+ [/:(\w|[$@])\w*[!?=]?/, "string.s"],
233
+ [/:"/, { token: "string.s.delim", next: '@dstring.s."' }],
234
+ [/:'/, { token: "string.s.delim", next: "@sstring.s" }],
235
+ // regular expressions. Lookahead for a (not escaped) closing forwardslash on the same line
236
+ [/\/(?=(\\\/|[^\/\n])+\/)/, { token: "regexp.delim", next: "@regexp" }],
237
+ // delimiters and operators
238
+ [/[{}()\[\]]/, "@brackets"],
239
+ [
240
+ /@symbols/,
241
+ {
242
+ cases: {
243
+ "@keywordops": "keyword",
244
+ "@operators": "operator",
245
+ "@default": ""
246
+ }
247
+ }
248
+ ],
249
+ [/[;,]/, "delimiter"],
250
+ // numbers
251
+ [/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, "number.hex"],
252
+ [/0[_oO][0-7](_?[0-7])*/, "number.octal"],
253
+ [/0[bB][01](_?[01])*/, "number.binary"],
254
+ [/0[dD]@decpart/, "number"],
255
+ [
256
+ /@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/,
257
+ {
258
+ cases: {
259
+ $1: "number.float",
260
+ "@default": "number"
261
+ }
262
+ }
263
+ ]
264
+ ],
265
+ // used to not treat a 'do' as a block opener if it occurs on the same
266
+ // line as a 'do' statement: 'while|until|for'
267
+ // dodecl.<decl> where decl is the declarations started, like 'while'
268
+ dodecl: [
269
+ [/^/, { token: "", switchTo: "@root.$S2" }],
270
+ // get out of do-skipping mode on a new line
271
+ [
272
+ /[a-z_]\w*[!?=]?/,
273
+ {
274
+ cases: {
275
+ end: { token: "keyword.$S2", next: "@pop" },
276
+ // end on same line
277
+ do: { token: "keyword", switchTo: "@root.$S2" },
278
+ // do on same line: not an open bracket here
279
+ "@linedecls": {
280
+ token: "@rematch",
281
+ switchTo: "@root.$S2"
282
+ },
283
+ // other declaration on same line: rematch
284
+ "@keywords": "keyword",
285
+ "@builtins": "predefined",
286
+ "@default": "identifier"
287
+ }
288
+ }
289
+ ],
290
+ { include: "@root" }
291
+ ],
292
+ // used to prevent potential modifiers ('if|until|while|unless') to match
293
+ // with 'end' keywords.
294
+ // modifier.<decl>x where decl is the declaration starter, like 'if'
295
+ modifier: [
296
+ [/^/, "", "@pop"],
297
+ // it was a modifier: get out of modifier mode on a new line
298
+ [
299
+ /[a-z_]\w*[!?=]?/,
300
+ {
301
+ cases: {
302
+ end: { token: "keyword.$S2", next: "@pop" },
303
+ // end on same line
304
+ "then|else|elsif|do": {
305
+ token: "keyword",
306
+ switchTo: "@root.$S2"
307
+ },
308
+ // real declaration and not a modifier
309
+ "@linedecls": {
310
+ token: "@rematch",
311
+ switchTo: "@root.$S2"
312
+ },
313
+ // other declaration => not a modifier
314
+ "@keywords": "keyword",
315
+ "@builtins": "predefined",
316
+ "@default": "identifier"
317
+ }
318
+ }
319
+ ],
320
+ { include: "@root" }
321
+ ],
322
+ // single quote strings (also used for symbols)
323
+ // sstring.<kind> where kind is 'sq' (single quote) or 's' (symbol)
324
+ sstring: [
325
+ [/[^\\']+/, "string.$S2"],
326
+ [/\\\\|\\'|\\$/, "string.$S2.escape"],
327
+ [/\\./, "string.$S2.invalid"],
328
+ [/'/, { token: "string.$S2.delim", next: "@pop" }]
329
+ ],
330
+ // double quoted "string".
331
+ // dstring.<kind>.<delim> where kind is 'd' (double quoted), 'x' (command), or 's' (symbol)
332
+ // and delim is the ending delimiter (" or `)
333
+ dstring: [
334
+ [/[^\\`"#]+/, "string.$S2"],
335
+ [/#/, "string.$S2.escape", "@interpolated"],
336
+ [/\\$/, "string.$S2.escape"],
337
+ [/@escapes/, "string.$S2.escape"],
338
+ [/\\./, "string.$S2.escape.invalid"],
339
+ [
340
+ /[`"]/,
341
+ {
342
+ cases: {
343
+ "$#==$S3": { token: "string.$S2.delim", next: "@pop" },
344
+ "@default": "string.$S2"
345
+ }
346
+ }
347
+ ]
348
+ ],
349
+ // literal documents
350
+ // heredoc.<close> where close is the closing delimiter
351
+ heredoc: [
352
+ [
353
+ /^(\s*)(@heredelim)$/,
354
+ {
355
+ cases: {
356
+ "$2==$S2": ["string.heredoc", { token: "string.heredoc.delimiter", next: "@pop" }],
357
+ "@default": ["string.heredoc", "string.heredoc"]
358
+ }
359
+ }
360
+ ],
361
+ [/.*/, "string.heredoc"]
362
+ ],
363
+ // interpolated sequence
364
+ interpolated: [
365
+ [/\$\w*/, "global.constant", "@pop"],
366
+ [/@\w*/, "namespace.class.identifier", "@pop"],
367
+ [/@@@\w*/, "namespace.instance.identifier", "@pop"],
368
+ [
369
+ /[{]/,
370
+ {
371
+ token: "string.escape.curly",
372
+ switchTo: "@interpolated_compound"
373
+ }
374
+ ],
375
+ ["", "", "@pop"]
376
+ // just a # is interpreted as a #
377
+ ],
378
+ // any code
379
+ interpolated_compound: [
380
+ [/[}]/, { token: "string.escape.curly", next: "@pop" }],
381
+ { include: "@root" }
382
+ ],
383
+ // %r quoted regexp
384
+ // pregexp.<open>.<close> where open/close are the open/close delimiter
385
+ pregexp: [
386
+ { include: "@whitespace" },
387
+ // turns out that you can quote using regex control characters, aargh!
388
+ // for example; %r|kgjgaj| is ok (even though | is used for alternation)
389
+ // so, we need to match those first
390
+ [
391
+ /[^\(\{\[\\]/,
392
+ {
393
+ cases: {
394
+ "$#==$S3": { token: "regexp.delim", next: "@pop" },
395
+ "$#==$S2": { token: "regexp.delim", next: "@push" },
396
+ // nested delimiters are allowed..
397
+ "~[)}\\]]": "@brackets.regexp.escape.control",
398
+ "~@regexpctl": "regexp.escape.control",
399
+ "@default": "regexp"
400
+ }
401
+ }
402
+ ],
403
+ { include: "@regexcontrol" }
404
+ ],
405
+ // We match regular expression quite precisely
406
+ regexp: [
407
+ { include: "@regexcontrol" },
408
+ [/[^\\\/]/, "regexp"],
409
+ ["/[ixmp]*", { token: "regexp.delim" }, "@pop"]
410
+ ],
411
+ regexcontrol: [
412
+ [
413
+ /(\{)(\d+(?:,\d*)?)(\})/,
414
+ [
415
+ "@brackets.regexp.escape.control",
416
+ "regexp.escape.control",
417
+ "@brackets.regexp.escape.control"
418
+ ]
419
+ ],
420
+ [
421
+ /(\[)(\^?)/,
422
+ ["@brackets.regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
423
+ ],
424
+ [/(\()(\?[:=!])/, ["@brackets.regexp.escape.control", "regexp.escape.control"]],
425
+ [/\(\?#/, { token: "regexp.escape.control", next: "@regexpcomment" }],
426
+ [/[()]/, "@brackets.regexp.escape.control"],
427
+ [/@regexpctl/, "regexp.escape.control"],
428
+ [/\\$/, "regexp.escape"],
429
+ [/@regexpesc/, "regexp.escape"],
430
+ [/\\\./, "regexp.invalid"],
431
+ [/#/, "regexp.escape", "@interpolated"]
432
+ ],
433
+ regexrange: [
434
+ [/-/, "regexp.escape.control"],
435
+ [/\^/, "regexp.invalid"],
436
+ [/\\$/, "regexp.escape"],
437
+ [/@regexpesc/, "regexp.escape"],
438
+ [/[^\]]/, "regexp"],
439
+ [/\]/, "@brackets.regexp.escape.control", "@pop"]
440
+ ],
441
+ regexpcomment: [
442
+ [/[^)]+/, "comment"],
443
+ [/\)/, { token: "regexp.escape.control", next: "@pop" }]
444
+ ],
445
+ // % quoted strings
446
+ // A bit repetitive since we need to often special case the kind of ending delimiter
447
+ pstring: [
448
+ [/%([qws])\(/, { token: "string.$1.delim", switchTo: "@qstring.$1.(.)" }],
449
+ [/%([qws])\[/, { token: "string.$1.delim", switchTo: "@qstring.$1.[.]" }],
450
+ [/%([qws])\{/, { token: "string.$1.delim", switchTo: "@qstring.$1.{.}" }],
451
+ [/%([qws])</, { token: "string.$1.delim", switchTo: "@qstring.$1.<.>" }],
452
+ [/%([qws])(@delim)/, { token: "string.$1.delim", switchTo: "@qstring.$1.$2.$2" }],
453
+ [/%r\(/, { token: "regexp.delim", switchTo: "@pregexp.(.)" }],
454
+ [/%r\[/, { token: "regexp.delim", switchTo: "@pregexp.[.]" }],
455
+ [/%r\{/, { token: "regexp.delim", switchTo: "@pregexp.{.}" }],
456
+ [/%r</, { token: "regexp.delim", switchTo: "@pregexp.<.>" }],
457
+ [/%r(@delim)/, { token: "regexp.delim", switchTo: "@pregexp.$1.$1" }],
458
+ [/%(x|W|Q?)\(/, { token: "string.$1.delim", switchTo: "@qqstring.$1.(.)" }],
459
+ [/%(x|W|Q?)\[/, { token: "string.$1.delim", switchTo: "@qqstring.$1.[.]" }],
460
+ [/%(x|W|Q?)\{/, { token: "string.$1.delim", switchTo: "@qqstring.$1.{.}" }],
461
+ [/%(x|W|Q?)</, { token: "string.$1.delim", switchTo: "@qqstring.$1.<.>" }],
462
+ [/%(x|W|Q?)(@delim)/, { token: "string.$1.delim", switchTo: "@qqstring.$1.$2.$2" }],
463
+ [/%([rqwsxW]|Q?)./, { token: "invalid", next: "@pop" }],
464
+ // recover
465
+ [/./, { token: "invalid", next: "@pop" }]
466
+ // recover
467
+ ],
468
+ // non-expanded quoted string.
469
+ // qstring.<kind>.<open>.<close>
470
+ // kind = q|w|s (single quote, array, symbol)
471
+ // open = open delimiter
472
+ // close = close delimiter
473
+ qstring: [
474
+ [/\\$/, "string.$S2.escape"],
475
+ [/\\./, "string.$S2.escape"],
476
+ [
477
+ /./,
478
+ {
479
+ cases: {
480
+ "$#==$S4": { token: "string.$S2.delim", next: "@pop" },
481
+ "$#==$S3": { token: "string.$S2.delim", next: "@push" },
482
+ // nested delimiters are allowed..
483
+ "@default": "string.$S2"
484
+ }
485
+ }
486
+ ]
487
+ ],
488
+ // expanded quoted string.
489
+ // qqstring.<kind>.<open>.<close>
490
+ // kind = Q|W|x (double quote, array, command)
491
+ // open = open delimiter
492
+ // close = close delimiter
493
+ qqstring: [[/#/, "string.$S2.escape", "@interpolated"], { include: "@qstring" }],
494
+ // whitespace & comments
495
+ whitespace: [
496
+ [/[ \t\r\n]+/, ""],
497
+ [/^\s*=begin\b/, "comment", "@comment"],
498
+ [/#.*$/, "comment"]
499
+ ],
500
+ comment: [
501
+ [/[^=]+/, "comment"],
502
+ [/^\s*=begin\b/, "comment.invalid"],
503
+ // nested comment
504
+ [/^\s*=end\b.*/, "comment", "@pop"],
505
+ [/[=]/, "comment"]
506
+ ]
507
+ }
508
+ };
509
+
510
+ export { conf, language };
@@ -0,0 +1,8 @@
1
+ import { registerLanguage } from '../_.contribution.js';
2
+
3
+ registerLanguage({
4
+ id: "rust",
5
+ extensions: [".rs", ".rlib"],
6
+ aliases: ["Rust", "rust"],
7
+ loader: () => import('./rust.js')
8
+ });