@codingame/monaco-vscode-standalone-languages 23.2.1 → 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,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 };
|
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
|
+
});
|