@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
@@ -0,0 +1,413 @@
1
+ import { languages } from 'monaco-editor';
2
+
3
+ const EMPTY_ELEMENTS = [
4
+ "area",
5
+ "base",
6
+ "br",
7
+ "col",
8
+ "embed",
9
+ "hr",
10
+ "img",
11
+ "input",
12
+ "keygen",
13
+ "link",
14
+ "menuitem",
15
+ "meta",
16
+ "param",
17
+ "source",
18
+ "track",
19
+ "wbr"
20
+ ];
21
+ const conf = {
22
+ wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
23
+ comments: {
24
+ blockComment: ["{{!--", "--}}"]
25
+ },
26
+ brackets: [
27
+ ["<!--", "-->"],
28
+ ["<", ">"],
29
+ ["{{", "}}"],
30
+ ["{", "}"],
31
+ ["(", ")"]
32
+ ],
33
+ autoClosingPairs: [
34
+ { open: "{", close: "}" },
35
+ { open: "[", close: "]" },
36
+ { open: "(", close: ")" },
37
+ { open: '"', close: '"' },
38
+ { open: "'", close: "'" }
39
+ ],
40
+ surroundingPairs: [
41
+ { open: "<", close: ">" },
42
+ { open: '"', close: '"' },
43
+ { open: "'", close: "'" }
44
+ ],
45
+ onEnterRules: [
46
+ {
47
+ beforeText: new RegExp(
48
+ `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
49
+ "i"
50
+ ),
51
+ afterText: /^<\/(\w[\w\d]*)\s*>$/i,
52
+ action: {
53
+ indentAction: languages.IndentAction.IndentOutdent
54
+ }
55
+ },
56
+ {
57
+ beforeText: new RegExp(
58
+ `<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,
59
+ "i"
60
+ ),
61
+ action: { indentAction: languages.IndentAction.Indent }
62
+ }
63
+ ]
64
+ };
65
+ const language = {
66
+ defaultToken: "",
67
+ tokenPostfix: "",
68
+ // ignoreCase: true,
69
+ // The main tokenizer for our languages
70
+ tokenizer: {
71
+ root: [
72
+ [/\{\{!--/, "comment.block.start.handlebars", "@commentBlock"],
73
+ [/\{\{!/, "comment.start.handlebars", "@comment"],
74
+ [/\{\{/, { token: "@rematch", switchTo: "@handlebarsInSimpleState.root" }],
75
+ [/<!DOCTYPE/, "metatag.html", "@doctype"],
76
+ [/<!--/, "comment.html", "@commentHtml"],
77
+ [/(<)(\w+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
78
+ [/(<)(script)/, ["delimiter.html", { token: "tag.html", next: "@script" }]],
79
+ [/(<)(style)/, ["delimiter.html", { token: "tag.html", next: "@style" }]],
80
+ [/(<)([:\w]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
81
+ [/(<\/)(\w+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
82
+ [/</, "delimiter.html"],
83
+ [/\{/, "delimiter.html"],
84
+ [/[^<{]+/]
85
+ // text
86
+ ],
87
+ doctype: [
88
+ [
89
+ /\{\{/,
90
+ {
91
+ token: "@rematch",
92
+ switchTo: "@handlebarsInSimpleState.comment"
93
+ }
94
+ ],
95
+ [/[^>]+/, "metatag.content.html"],
96
+ [/>/, "metatag.html", "@pop"]
97
+ ],
98
+ comment: [
99
+ [/\}\}/, "comment.end.handlebars", "@pop"],
100
+ [/./, "comment.content.handlebars"]
101
+ ],
102
+ commentBlock: [
103
+ [/--\}\}/, "comment.block.end.handlebars", "@pop"],
104
+ [/./, "comment.content.handlebars"]
105
+ ],
106
+ commentHtml: [
107
+ [
108
+ /\{\{/,
109
+ {
110
+ token: "@rematch",
111
+ switchTo: "@handlebarsInSimpleState.comment"
112
+ }
113
+ ],
114
+ [/-->/, "comment.html", "@pop"],
115
+ [/[^-]+/, "comment.content.html"],
116
+ [/./, "comment.content.html"]
117
+ ],
118
+ otherTag: [
119
+ [
120
+ /\{\{/,
121
+ {
122
+ token: "@rematch",
123
+ switchTo: "@handlebarsInSimpleState.otherTag"
124
+ }
125
+ ],
126
+ [/\/?>/, "delimiter.html", "@pop"],
127
+ [/"([^"]*)"/, "attribute.value"],
128
+ [/'([^']*)'/, "attribute.value"],
129
+ [/[\w\-]+/, "attribute.name"],
130
+ [/=/, "delimiter"],
131
+ [/[ \t\r\n]+/]
132
+ // whitespace
133
+ ],
134
+ // -- BEGIN <script> tags handling
135
+ // After <script
136
+ script: [
137
+ [
138
+ /\{\{/,
139
+ {
140
+ token: "@rematch",
141
+ switchTo: "@handlebarsInSimpleState.script"
142
+ }
143
+ ],
144
+ [/type/, "attribute.name", "@scriptAfterType"],
145
+ [/"([^"]*)"/, "attribute.value"],
146
+ [/'([^']*)'/, "attribute.value"],
147
+ [/[\w\-]+/, "attribute.name"],
148
+ [/=/, "delimiter"],
149
+ [
150
+ />/,
151
+ {
152
+ token: "delimiter.html",
153
+ next: "@scriptEmbedded.text/javascript",
154
+ nextEmbedded: "text/javascript"
155
+ }
156
+ ],
157
+ [/[ \t\r\n]+/],
158
+ // whitespace
159
+ [
160
+ /(<\/)(script\s*)(>)/,
161
+ ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
162
+ ]
163
+ ],
164
+ // After <script ... type
165
+ scriptAfterType: [
166
+ [
167
+ /\{\{/,
168
+ {
169
+ token: "@rematch",
170
+ switchTo: "@handlebarsInSimpleState.scriptAfterType"
171
+ }
172
+ ],
173
+ [/=/, "delimiter", "@scriptAfterTypeEquals"],
174
+ [
175
+ />/,
176
+ {
177
+ token: "delimiter.html",
178
+ next: "@scriptEmbedded.text/javascript",
179
+ nextEmbedded: "text/javascript"
180
+ }
181
+ ],
182
+ // cover invalid e.g. <script type>
183
+ [/[ \t\r\n]+/],
184
+ // whitespace
185
+ [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
186
+ ],
187
+ // After <script ... type =
188
+ scriptAfterTypeEquals: [
189
+ [
190
+ /\{\{/,
191
+ {
192
+ token: "@rematch",
193
+ switchTo: "@handlebarsInSimpleState.scriptAfterTypeEquals"
194
+ }
195
+ ],
196
+ [
197
+ /"([^"]*)"/,
198
+ {
199
+ token: "attribute.value",
200
+ switchTo: "@scriptWithCustomType.$1"
201
+ }
202
+ ],
203
+ [
204
+ /'([^']*)'/,
205
+ {
206
+ token: "attribute.value",
207
+ switchTo: "@scriptWithCustomType.$1"
208
+ }
209
+ ],
210
+ [
211
+ />/,
212
+ {
213
+ token: "delimiter.html",
214
+ next: "@scriptEmbedded.text/javascript",
215
+ nextEmbedded: "text/javascript"
216
+ }
217
+ ],
218
+ // cover invalid e.g. <script type=>
219
+ [/[ \t\r\n]+/],
220
+ // whitespace
221
+ [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
222
+ ],
223
+ // After <script ... type = $S2
224
+ scriptWithCustomType: [
225
+ [
226
+ /\{\{/,
227
+ {
228
+ token: "@rematch",
229
+ switchTo: "@handlebarsInSimpleState.scriptWithCustomType.$S2"
230
+ }
231
+ ],
232
+ [
233
+ />/,
234
+ {
235
+ token: "delimiter.html",
236
+ next: "@scriptEmbedded.$S2",
237
+ nextEmbedded: "$S2"
238
+ }
239
+ ],
240
+ [/"([^"]*)"/, "attribute.value"],
241
+ [/'([^']*)'/, "attribute.value"],
242
+ [/[\w\-]+/, "attribute.name"],
243
+ [/=/, "delimiter"],
244
+ [/[ \t\r\n]+/],
245
+ // whitespace
246
+ [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
247
+ ],
248
+ scriptEmbedded: [
249
+ [
250
+ /\{\{/,
251
+ {
252
+ token: "@rematch",
253
+ switchTo: "@handlebarsInEmbeddedState.scriptEmbedded.$S2",
254
+ nextEmbedded: "@pop"
255
+ }
256
+ ],
257
+ [/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
258
+ ],
259
+ // -- END <script> tags handling
260
+ // -- BEGIN <style> tags handling
261
+ // After <style
262
+ style: [
263
+ [
264
+ /\{\{/,
265
+ {
266
+ token: "@rematch",
267
+ switchTo: "@handlebarsInSimpleState.style"
268
+ }
269
+ ],
270
+ [/type/, "attribute.name", "@styleAfterType"],
271
+ [/"([^"]*)"/, "attribute.value"],
272
+ [/'([^']*)'/, "attribute.value"],
273
+ [/[\w\-]+/, "attribute.name"],
274
+ [/=/, "delimiter"],
275
+ [
276
+ />/,
277
+ {
278
+ token: "delimiter.html",
279
+ next: "@styleEmbedded.text/css",
280
+ nextEmbedded: "text/css"
281
+ }
282
+ ],
283
+ [/[ \t\r\n]+/],
284
+ // whitespace
285
+ [
286
+ /(<\/)(style\s*)(>)/,
287
+ ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
288
+ ]
289
+ ],
290
+ // After <style ... type
291
+ styleAfterType: [
292
+ [
293
+ /\{\{/,
294
+ {
295
+ token: "@rematch",
296
+ switchTo: "@handlebarsInSimpleState.styleAfterType"
297
+ }
298
+ ],
299
+ [/=/, "delimiter", "@styleAfterTypeEquals"],
300
+ [
301
+ />/,
302
+ {
303
+ token: "delimiter.html",
304
+ next: "@styleEmbedded.text/css",
305
+ nextEmbedded: "text/css"
306
+ }
307
+ ],
308
+ // cover invalid e.g. <style type>
309
+ [/[ \t\r\n]+/],
310
+ // whitespace
311
+ [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
312
+ ],
313
+ // After <style ... type =
314
+ styleAfterTypeEquals: [
315
+ [
316
+ /\{\{/,
317
+ {
318
+ token: "@rematch",
319
+ switchTo: "@handlebarsInSimpleState.styleAfterTypeEquals"
320
+ }
321
+ ],
322
+ [
323
+ /"([^"]*)"/,
324
+ {
325
+ token: "attribute.value",
326
+ switchTo: "@styleWithCustomType.$1"
327
+ }
328
+ ],
329
+ [
330
+ /'([^']*)'/,
331
+ {
332
+ token: "attribute.value",
333
+ switchTo: "@styleWithCustomType.$1"
334
+ }
335
+ ],
336
+ [
337
+ />/,
338
+ {
339
+ token: "delimiter.html",
340
+ next: "@styleEmbedded.text/css",
341
+ nextEmbedded: "text/css"
342
+ }
343
+ ],
344
+ // cover invalid e.g. <style type=>
345
+ [/[ \t\r\n]+/],
346
+ // whitespace
347
+ [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
348
+ ],
349
+ // After <style ... type = $S2
350
+ styleWithCustomType: [
351
+ [
352
+ /\{\{/,
353
+ {
354
+ token: "@rematch",
355
+ switchTo: "@handlebarsInSimpleState.styleWithCustomType.$S2"
356
+ }
357
+ ],
358
+ [
359
+ />/,
360
+ {
361
+ token: "delimiter.html",
362
+ next: "@styleEmbedded.$S2",
363
+ nextEmbedded: "$S2"
364
+ }
365
+ ],
366
+ [/"([^"]*)"/, "attribute.value"],
367
+ [/'([^']*)'/, "attribute.value"],
368
+ [/[\w\-]+/, "attribute.name"],
369
+ [/=/, "delimiter"],
370
+ [/[ \t\r\n]+/],
371
+ // whitespace
372
+ [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
373
+ ],
374
+ styleEmbedded: [
375
+ [
376
+ /\{\{/,
377
+ {
378
+ token: "@rematch",
379
+ switchTo: "@handlebarsInEmbeddedState.styleEmbedded.$S2",
380
+ nextEmbedded: "@pop"
381
+ }
382
+ ],
383
+ [/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
384
+ ],
385
+ // -- END <style> tags handling
386
+ handlebarsInSimpleState: [
387
+ [/\{\{\{?/, "delimiter.handlebars"],
388
+ [/\}\}\}?/, { token: "delimiter.handlebars", switchTo: "@$S2.$S3" }],
389
+ { include: "handlebarsRoot" }
390
+ ],
391
+ handlebarsInEmbeddedState: [
392
+ [/\{\{\{?/, "delimiter.handlebars"],
393
+ [
394
+ /\}\}\}?/,
395
+ {
396
+ token: "delimiter.handlebars",
397
+ switchTo: "@$S2.$S3",
398
+ nextEmbedded: "$S3"
399
+ }
400
+ ],
401
+ { include: "handlebarsRoot" }
402
+ ],
403
+ handlebarsRoot: [
404
+ [/"[^"]*"/, "string.handlebars"],
405
+ [/[#/][^\s}]+/, "keyword.helper.handlebars"],
406
+ [/else\b/, "keyword.helper.handlebars"],
407
+ [/[\s]+/],
408
+ [/[^}]/, "variable.parameter.handlebars"]
409
+ ]
410
+ }
411
+ };
412
+
413
+ export { conf, language };
@@ -0,0 +1,8 @@
1
+ import { registerLanguage } from '../_.contribution.js';
2
+
3
+ registerLanguage({
4
+ id: "hcl",
5
+ extensions: [".tf", ".tfvars", ".hcl"],
6
+ aliases: ["Terraform", "tf", "HCL", "hcl"],
7
+ loader: () => import('./hcl.js')
8
+ });
package/hcl/hcl.js ADDED
@@ -0,0 +1,182 @@
1
+ const conf = {
2
+ comments: {
3
+ lineComment: "#",
4
+ blockComment: ["/*", "*/"]
5
+ },
6
+ brackets: [
7
+ ["{", "}"],
8
+ ["[", "]"],
9
+ ["(", ")"]
10
+ ],
11
+ autoClosingPairs: [
12
+ { open: "{", close: "}" },
13
+ { open: "[", close: "]" },
14
+ { open: "(", close: ")" },
15
+ { open: '"', close: '"', notIn: ["string"] }
16
+ ],
17
+ surroundingPairs: [
18
+ { open: "{", close: "}" },
19
+ { open: "[", close: "]" },
20
+ { open: "(", close: ")" },
21
+ { open: '"', close: '"' }
22
+ ]
23
+ };
24
+ const language = {
25
+ defaultToken: "",
26
+ tokenPostfix: ".hcl",
27
+ keywords: [
28
+ "var",
29
+ "local",
30
+ "path",
31
+ "for_each",
32
+ "any",
33
+ "string",
34
+ "number",
35
+ "bool",
36
+ "true",
37
+ "false",
38
+ "null",
39
+ "if ",
40
+ "else ",
41
+ "endif ",
42
+ "for ",
43
+ "in",
44
+ "endfor"
45
+ ],
46
+ operators: [
47
+ "=",
48
+ ">=",
49
+ "<=",
50
+ "==",
51
+ "!=",
52
+ "+",
53
+ "-",
54
+ "*",
55
+ "/",
56
+ "%",
57
+ "&&",
58
+ "||",
59
+ "!",
60
+ "<",
61
+ ">",
62
+ "?",
63
+ "...",
64
+ ":"
65
+ ],
66
+ symbols: /[=><!~?:&|+\-*\/\^%]+/,
67
+ escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
68
+ terraformFunctions: /(abs|ceil|floor|log|max|min|pow|signum|chomp|format|formatlist|indent|join|lower|regex|regexall|replace|split|strrev|substr|title|trimspace|upper|chunklist|coalesce|coalescelist|compact|concat|contains|distinct|element|flatten|index|keys|length|list|lookup|map|matchkeys|merge|range|reverse|setintersection|setproduct|setunion|slice|sort|transpose|values|zipmap|base64decode|base64encode|base64gzip|csvdecode|jsondecode|jsonencode|urlencode|yamldecode|yamlencode|abspath|dirname|pathexpand|basename|file|fileexists|fileset|filebase64|templatefile|formatdate|timeadd|timestamp|base64sha256|base64sha512|bcrypt|filebase64sha256|filebase64sha512|filemd5|filemd1|filesha256|filesha512|md5|rsadecrypt|sha1|sha256|sha512|uuid|uuidv5|cidrhost|cidrnetmask|cidrsubnet|tobool|tolist|tomap|tonumber|toset|tostring)/,
69
+ terraformMainBlocks: /(module|data|terraform|resource|provider|variable|output|locals)/,
70
+ tokenizer: {
71
+ root: [
72
+ // highlight main blocks
73
+ [
74
+ /^@terraformMainBlocks([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,
75
+ ["type", "", "string", "", "string", "", "@brackets"]
76
+ ],
77
+ // highlight all the remaining blocks
78
+ [
79
+ /(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)(\{)/,
80
+ ["identifier", "", "string", "", "string", "", "@brackets"]
81
+ ],
82
+ // highlight block
83
+ [
84
+ /(\w+[ \t]+)([ \t]*)([\w-]+|"[\w-]+"|)([ \t]*)([\w-]+|"[\w-]+"|)(=)(\{)/,
85
+ ["identifier", "", "string", "", "operator", "", "@brackets"]
86
+ ],
87
+ // terraform general highlight - shared with expressions
88
+ { include: "@terraform" }
89
+ ],
90
+ terraform: [
91
+ // highlight terraform functions
92
+ [/@terraformFunctions(\()/, ["type", "@brackets"]],
93
+ // all other words are variables or keywords
94
+ [
95
+ /[a-zA-Z_]\w*-*/,
96
+ // must work with variables such as foo-bar and also with negative numbers
97
+ {
98
+ cases: {
99
+ "@keywords": { token: "keyword.$0" },
100
+ "@default": "variable"
101
+ }
102
+ }
103
+ ],
104
+ { include: "@whitespace" },
105
+ { include: "@heredoc" },
106
+ // delimiters and operators
107
+ [/[{}()\[\]]/, "@brackets"],
108
+ [/[<>](?!@symbols)/, "@brackets"],
109
+ [
110
+ /@symbols/,
111
+ {
112
+ cases: {
113
+ "@operators": "operator",
114
+ "@default": ""
115
+ }
116
+ }
117
+ ],
118
+ // numbers
119
+ [/\d*\d+[eE]([\-+]?\d+)?/, "number.float"],
120
+ [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float"],
121
+ [/\d[\d']*/, "number"],
122
+ [/\d/, "number"],
123
+ [/[;,.]/, "delimiter"],
124
+ // delimiter: after number because of .\d floats
125
+ // strings
126
+ [/"/, "string", "@string"],
127
+ // this will include expressions
128
+ [/'/, "invalid"]
129
+ ],
130
+ heredoc: [
131
+ [/<<[-]*\s*["]?([\w\-]+)["]?/, { token: "string.heredoc.delimiter", next: "@heredocBody.$1" }]
132
+ ],
133
+ heredocBody: [
134
+ [
135
+ /([\w\-]+)$/,
136
+ {
137
+ cases: {
138
+ "$1==$S2": [
139
+ {
140
+ token: "string.heredoc.delimiter",
141
+ next: "@popall"
142
+ }
143
+ ],
144
+ "@default": "string.heredoc"
145
+ }
146
+ }
147
+ ],
148
+ [/./, "string.heredoc"]
149
+ ],
150
+ whitespace: [
151
+ [/[ \t\r\n]+/, ""],
152
+ [/\/\*/, "comment", "@comment"],
153
+ [/\/\/.*$/, "comment"],
154
+ [/#.*$/, "comment"]
155
+ ],
156
+ comment: [
157
+ [/[^\/*]+/, "comment"],
158
+ [/\*\//, "comment", "@pop"],
159
+ [/[\/*]/, "comment"]
160
+ ],
161
+ string: [
162
+ [/\$\{/, { token: "delimiter", next: "@stringExpression" }],
163
+ [/[^\\"\$]+/, "string"],
164
+ [/@escapes/, "string.escape"],
165
+ [/\\./, "string.escape.invalid"],
166
+ [/"/, "string", "@popall"]
167
+ ],
168
+ stringInsideExpression: [
169
+ [/[^\\"]+/, "string"],
170
+ [/@escapes/, "string.escape"],
171
+ [/\\./, "string.escape.invalid"],
172
+ [/"/, "string", "@pop"]
173
+ ],
174
+ stringExpression: [
175
+ [/\}/, { token: "delimiter", next: "@pop" }],
176
+ [/"/, "string", "@stringInsideExpression"],
177
+ { include: "@terraform" }
178
+ ]
179
+ }
180
+ };
181
+
182
+ export { conf, language };
@@ -0,0 +1,9 @@
1
+ import { registerLanguage } from '../_.contribution.js';
2
+
3
+ registerLanguage({
4
+ id: "html",
5
+ extensions: [".html", ".htm", ".shtml", ".xhtml", ".mdoc", ".jsp", ".asp", ".aspx", ".jshtm"],
6
+ aliases: ["HTML", "htm", "html", "xhtml"],
7
+ mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
8
+ loader: () => import('./html.js')
9
+ });