@codingame/monaco-vscode-standalone-languages 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/_.contribution.js +74 -0
  2. package/abap/abap.contribution.js +19 -0
  3. package/abap/abap.js +1406 -0
  4. package/apex/apex.contribution.js +20 -0
  5. package/apex/apex.js +338 -0
  6. package/azcli/azcli.contribution.js +19 -0
  7. package/azcli/azcli.js +76 -0
  8. package/bat/bat.contribution.js +19 -0
  9. package/bat/bat.js +108 -0
  10. package/bicep/bicep.contribution.js +19 -0
  11. package/bicep/bicep.js +117 -0
  12. package/cameligo/cameligo.contribution.js +19 -0
  13. package/cameligo/cameligo.js +182 -0
  14. package/clojure/clojure.contribution.js +19 -0
  15. package/clojure/clojure.js +769 -0
  16. package/coffee/coffee.contribution.js +20 -0
  17. package/coffee/coffee.js +240 -0
  18. package/cpp/cpp.contribution.js +29 -0
  19. package/cpp/cpp.js +409 -0
  20. package/csharp/csharp.contribution.js +19 -0
  21. package/csharp/csharp.js +334 -0
  22. package/csp/csp.contribution.js +19 -0
  23. package/csp/csp.js +61 -0
  24. package/css/css.contribution.js +20 -0
  25. package/css/css.js +193 -0
  26. package/cypher/cypher.contribution.js +19 -0
  27. package/cypher/cypher.js +271 -0
  28. package/dart/dart.contribution.js +20 -0
  29. package/dart/dart.js +289 -0
  30. package/dockerfile/dockerfile.contribution.js +20 -0
  31. package/dockerfile/dockerfile.js +138 -0
  32. package/ecl/ecl.contribution.js +19 -0
  33. package/ecl/ecl.js +464 -0
  34. package/elixir/elixir.contribution.js +19 -0
  35. package/elixir/elixir.js +577 -0
  36. package/flow9/flow9.contribution.js +19 -0
  37. package/flow9/flow9.js +150 -0
  38. package/freemarker2/freemarker2.contribution.js +73 -0
  39. package/freemarker2/freemarker2.js +1016 -0
  40. package/fsharp/fsharp.contribution.js +19 -0
  41. package/fsharp/fsharp.js +225 -0
  42. package/go/go.contribution.js +19 -0
  43. package/go/go.js +226 -0
  44. package/graphql/graphql.contribution.js +20 -0
  45. package/graphql/graphql.js +159 -0
  46. package/handlebars/handlebars.contribution.js +20 -0
  47. package/handlebars/handlebars.js +439 -0
  48. package/hcl/hcl.contribution.js +19 -0
  49. package/hcl/hcl.js +191 -0
  50. package/html/html.contribution.js +20 -0
  51. package/html/html.js +328 -0
  52. package/index.js +81 -0
  53. package/ini/ini.contribution.js +20 -0
  54. package/ini/ini.js +79 -0
  55. package/java/java.contribution.js +20 -0
  56. package/java/java.js +240 -0
  57. package/javascript/javascript.contribution.js +22 -0
  58. package/javascript/javascript.js +77 -0
  59. package/julia/julia.contribution.js +19 -0
  60. package/julia/julia.js +519 -0
  61. package/kotlin/kotlin.contribution.js +20 -0
  62. package/kotlin/kotlin.js +261 -0
  63. package/less/less.contribution.js +20 -0
  64. package/less/less.js +169 -0
  65. package/lexon/lexon.contribution.js +19 -0
  66. package/lexon/lexon.js +165 -0
  67. package/liquid/liquid.contribution.js +20 -0
  68. package/liquid/liquid.js +260 -0
  69. package/lua/lua.contribution.js +19 -0
  70. package/lua/lua.js +170 -0
  71. package/m3/m3.contribution.js +19 -0
  72. package/m3/m3.js +218 -0
  73. package/markdown/markdown.contribution.js +19 -0
  74. package/markdown/markdown.js +237 -0
  75. package/mdx/mdx.contribution.js +19 -0
  76. package/mdx/mdx.js +184 -0
  77. package/mips/mips.contribution.js +20 -0
  78. package/mips/mips.js +206 -0
  79. package/msdax/msdax.contribution.js +19 -0
  80. package/msdax/msdax.js +383 -0
  81. package/mysql/mysql.contribution.js +19 -0
  82. package/mysql/mysql.js +886 -0
  83. package/objective-c/objective-c.contribution.js +19 -0
  84. package/objective-c/objective-c.js +191 -0
  85. package/package.json +23 -0
  86. package/pascal/pascal.contribution.js +20 -0
  87. package/pascal/pascal.js +259 -0
  88. package/pascaligo/pascaligo.contribution.js +19 -0
  89. package/pascaligo/pascaligo.js +172 -0
  90. package/perl/perl.contribution.js +19 -0
  91. package/perl/perl.js +634 -0
  92. package/pgsql/pgsql.contribution.js +19 -0
  93. package/pgsql/pgsql.js +859 -0
  94. package/php/php.contribution.js +20 -0
  95. package/php/php.js +508 -0
  96. package/pla/pla.contribution.js +18 -0
  97. package/pla/pla.js +145 -0
  98. package/postiats/postiats.contribution.js +19 -0
  99. package/postiats/postiats.js +915 -0
  100. package/powerquery/powerquery.contribution.js +19 -0
  101. package/powerquery/powerquery.js +898 -0
  102. package/powershell/powershell.contribution.js +19 -0
  103. package/powershell/powershell.js +247 -0
  104. package/protobuf/protobuf.contribution.js +19 -0
  105. package/protobuf/protobuf.js +428 -0
  106. package/pug/pug.contribution.js +19 -0
  107. package/pug/pug.js +410 -0
  108. package/python/python.contribution.js +20 -0
  109. package/python/python.js +295 -0
  110. package/qsharp/qsharp.contribution.js +19 -0
  111. package/qsharp/qsharp.js +293 -0
  112. package/r/r.contribution.js +19 -0
  113. package/r/r.js +251 -0
  114. package/razor/razor.contribution.js +20 -0
  115. package/razor/razor.js +570 -0
  116. package/redis/redis.contribution.js +19 -0
  117. package/redis/redis.js +310 -0
  118. package/redshift/redshift.contribution.js +19 -0
  119. package/redshift/redshift.js +817 -0
  120. package/restructuredtext/restructuredtext.contribution.js +19 -0
  121. package/restructuredtext/restructuredtext.js +182 -0
  122. package/ruby/ruby.contribution.js +20 -0
  123. package/ruby/ruby.js +519 -0
  124. package/rust/rust.contribution.js +19 -0
  125. package/rust/rust.js +351 -0
  126. package/sb/sb.contribution.js +19 -0
  127. package/sb/sb.js +123 -0
  128. package/scala/scala.contribution.js +20 -0
  129. package/scala/scala.js +378 -0
  130. package/scheme/scheme.contribution.js +19 -0
  131. package/scheme/scheme.js +116 -0
  132. package/scss/scss.contribution.js +20 -0
  133. package/scss/scss.js +268 -0
  134. package/shell/shell.contribution.js +19 -0
  135. package/shell/shell.js +229 -0
  136. package/solidity/solidity.contribution.js +19 -0
  137. package/solidity/solidity.js +1375 -0
  138. package/sophia/sophia.contribution.js +19 -0
  139. package/sophia/sophia.js +207 -0
  140. package/sparql/sparql.contribution.js +19 -0
  141. package/sparql/sparql.js +209 -0
  142. package/sql/sql.contribution.js +19 -0
  143. package/sql/sql.js +861 -0
  144. package/st/st.contribution.js +19 -0
  145. package/st/st.js +424 -0
  146. package/swift/swift.contribution.js +20 -0
  147. package/swift/swift.js +320 -0
  148. package/systemverilog/systemverilog.contribution.js +29 -0
  149. package/systemverilog/systemverilog.js +584 -0
  150. package/tcl/tcl.contribution.js +19 -0
  151. package/tcl/tcl.js +240 -0
  152. package/twig/twig.contribution.js +20 -0
  153. package/twig/twig.js +400 -0
  154. package/typescript/typescript.contribution.js +20 -0
  155. package/typescript/typescript.js +362 -0
  156. package/vb/vb.contribution.js +19 -0
  157. package/vb/vb.js +380 -0
  158. package/wgsl/wgsl.contribution.js +19 -0
  159. package/wgsl/wgsl.js +461 -0
  160. package/xml/xml.contribution.js +39 -0
  161. package/xml/xml.js +114 -0
  162. package/yaml/yaml.contribution.js +20 -0
  163. package/yaml/yaml.js +225 -0
@@ -0,0 +1,1016 @@
1
+ import * as monaco_editor_core_star from 'monaco-editor';
2
+
3
+ /*!-----------------------------------------------------------------------------
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Version: 0.47.0(undefined)
6
+ * Released under the MIT license
7
+ * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
8
+ *-----------------------------------------------------------------------------*/
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
+
24
+ // src/fillers/monaco-editor-core.ts
25
+ var monaco_editor_core_exports = {};
26
+ __reExport(monaco_editor_core_exports, monaco_editor_core_star);
27
+
28
+ // src/basic-languages/freemarker2/freemarker2.ts
29
+ var EMPTY_ELEMENTS = [
30
+ "assign",
31
+ "flush",
32
+ "ftl",
33
+ "return",
34
+ "global",
35
+ "import",
36
+ "include",
37
+ "break",
38
+ "continue",
39
+ "local",
40
+ "nested",
41
+ "nt",
42
+ "setting",
43
+ "stop",
44
+ "t",
45
+ "lt",
46
+ "rt",
47
+ "fallback"
48
+ ];
49
+ var BLOCK_ELEMENTS = [
50
+ "attempt",
51
+ "autoesc",
52
+ "autoEsc",
53
+ "compress",
54
+ "comment",
55
+ "escape",
56
+ "noescape",
57
+ "function",
58
+ "if",
59
+ "list",
60
+ "items",
61
+ "sep",
62
+ "macro",
63
+ "noparse",
64
+ "noParse",
65
+ "noautoesc",
66
+ "noAutoEsc",
67
+ "outputformat",
68
+ "switch",
69
+ "visit",
70
+ "recurse"
71
+ ];
72
+ var TagSyntaxAngle = {
73
+ close: ">",
74
+ id: "angle",
75
+ open: "<"
76
+ };
77
+ var TagSyntaxBracket = {
78
+ close: "\\]",
79
+ id: "bracket",
80
+ open: "\\["
81
+ };
82
+ var TagSyntaxAuto = {
83
+ close: "[>\\]]",
84
+ id: "auto",
85
+ open: "[<\\[]"
86
+ };
87
+ var InterpolationSyntaxDollar = {
88
+ close: "\\}",
89
+ id: "dollar",
90
+ open1: "\\$",
91
+ open2: "\\{"
92
+ };
93
+ var InterpolationSyntaxBracket = {
94
+ close: "\\]",
95
+ id: "bracket",
96
+ open1: "\\[",
97
+ open2: "="
98
+ };
99
+ function createLangConfiguration(ts) {
100
+ return {
101
+ brackets: [
102
+ ["<", ">"],
103
+ ["[", "]"],
104
+ ["(", ")"],
105
+ ["{", "}"]
106
+ ],
107
+ comments: {
108
+ blockComment: [`${ts.open}--`, `--${ts.close}`]
109
+ },
110
+ autoCloseBefore: "\n\r }]),.:;=",
111
+ autoClosingPairs: [
112
+ { open: "{", close: "}" },
113
+ { open: "[", close: "]" },
114
+ { open: "(", close: ")" },
115
+ { open: '"', close: '"', notIn: ["string"] },
116
+ { open: "'", close: "'", notIn: ["string"] }
117
+ ],
118
+ surroundingPairs: [
119
+ { open: '"', close: '"' },
120
+ { open: "'", close: "'" },
121
+ { open: "{", close: "}" },
122
+ { open: "[", close: "]" },
123
+ { open: "(", close: ")" },
124
+ { open: "<", close: ">" }
125
+ ],
126
+ folding: {
127
+ markers: {
128
+ start: new RegExp(
129
+ `${ts.open}#(?:${BLOCK_ELEMENTS.join("|")})([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$`
130
+ ),
131
+ end: new RegExp(`${ts.open}/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`)
132
+ }
133
+ },
134
+ onEnterRules: [
135
+ {
136
+ beforeText: new RegExp(
137
+ `${ts.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$`
138
+ ),
139
+ afterText: new RegExp(`^${ts.open}/#([a-zA-Z_]+)[\\r\\n\\t ]*${ts.close}$`),
140
+ action: {
141
+ indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent
142
+ }
143
+ },
144
+ {
145
+ beforeText: new RegExp(
146
+ `${ts.open}#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${ts.close})[^${ts.open}]*$`
147
+ ),
148
+ action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent }
149
+ }
150
+ ]
151
+ };
152
+ }
153
+ function createLangConfigurationAuto() {
154
+ return {
155
+ // Cannot set block comment delimiter in auto mode...
156
+ // It depends on the content and the cursor position of the file...
157
+ brackets: [
158
+ ["<", ">"],
159
+ ["[", "]"],
160
+ ["(", ")"],
161
+ ["{", "}"]
162
+ ],
163
+ autoCloseBefore: "\n\r }]),.:;=",
164
+ autoClosingPairs: [
165
+ { open: "{", close: "}" },
166
+ { open: "[", close: "]" },
167
+ { open: "(", close: ")" },
168
+ { open: '"', close: '"', notIn: ["string"] },
169
+ { open: "'", close: "'", notIn: ["string"] }
170
+ ],
171
+ surroundingPairs: [
172
+ { open: '"', close: '"' },
173
+ { open: "'", close: "'" },
174
+ { open: "{", close: "}" },
175
+ { open: "[", close: "]" },
176
+ { open: "(", close: ")" },
177
+ { open: "<", close: ">" }
178
+ ],
179
+ folding: {
180
+ markers: {
181
+ start: new RegExp(`[<\\[]#(?:${BLOCK_ELEMENTS.join("|")})([^/>\\]]*(?!/)[>\\]])[^<\\[]*$`),
182
+ end: new RegExp(`[<\\[]/#(?:${BLOCK_ELEMENTS.join("|")})[\\r\\n\\t ]*>`)
183
+ }
184
+ },
185
+ onEnterRules: [
186
+ {
187
+ beforeText: new RegExp(
188
+ `[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
189
+ ),
190
+ afterText: new RegExp(`^[<\\[]/#([a-zA-Z_]+)[\\r\\n\\t ]*[>\\]]$`),
191
+ action: {
192
+ indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent
193
+ }
194
+ },
195
+ {
196
+ beforeText: new RegExp(
197
+ `[<\\[]#(?!(?:${EMPTY_ELEMENTS.join("|")}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
198
+ ),
199
+ action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent }
200
+ }
201
+ ]
202
+ };
203
+ }
204
+ function createMonarchLanguage(ts, is) {
205
+ const id = `_${ts.id}_${is.id}`;
206
+ const s = (name) => name.replace(/__id__/g, id);
207
+ const r = (regexp) => {
208
+ const source = regexp.source.replace(/__id__/g, id);
209
+ return new RegExp(source, regexp.flags);
210
+ };
211
+ return {
212
+ // Settings
213
+ unicode: true,
214
+ includeLF: false,
215
+ start: s("default__id__"),
216
+ ignoreCase: false,
217
+ defaultToken: "invalid",
218
+ tokenPostfix: `.freemarker2`,
219
+ brackets: [
220
+ { open: "{", close: "}", token: "delimiter.curly" },
221
+ { open: "[", close: "]", token: "delimiter.square" },
222
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
223
+ { open: "<", close: ">", token: "delimiter.angle" }
224
+ ],
225
+ // Dynamic RegExp
226
+ [s("open__id__")]: new RegExp(ts.open),
227
+ [s("close__id__")]: new RegExp(ts.close),
228
+ [s("iOpen1__id__")]: new RegExp(is.open1),
229
+ [s("iOpen2__id__")]: new RegExp(is.open2),
230
+ [s("iClose__id__")]: new RegExp(is.close),
231
+ // <#START_TAG : "<" | "<#" | "[#">
232
+ // <#END_TAG : "</" | "</#" | "[/#">
233
+ [s("startTag__id__")]: r(/(@open__id__)(#)/),
234
+ [s("endTag__id__")]: r(/(@open__id__)(\/#)/),
235
+ [s("startOrEndTag__id__")]: r(/(@open__id__)(\/?#)/),
236
+ // <#CLOSE_TAG1 : (<BLANK>)* (">" | "]")>
237
+ [s("closeTag1__id__")]: r(/((?:@blank)*)(@close__id__)/),
238
+ // <#CLOSE_TAG2 : (<BLANK>)* ("/")? (">" | "]")>
239
+ [s("closeTag2__id__")]: r(/((?:@blank)*\/?)(@close__id__)/),
240
+ // Static RegExp
241
+ // <#BLANK : " " | "\t" | "\n" | "\r">
242
+ blank: /[ \t\n\r]/,
243
+ // <FALSE : "false">
244
+ // <TRUE : "true">
245
+ // <IN : "in">
246
+ // <AS : "as">
247
+ // <USING : "using">
248
+ keywords: ["false", "true", "in", "as", "using"],
249
+ // Directive names that cannot have an expression parameters and cannot be self-closing
250
+ // E.g. <#if id==2> ... </#if>
251
+ directiveStartCloseTag1: /attempt|recover|sep|auto[eE]sc|no(?:autoe|AutoE)sc|compress|default|no[eE]scape|comment|no[pP]arse/,
252
+ // Directive names that cannot have an expression parameter and can be self-closing
253
+ // E.g. <#if> ... <#else> ... </#if>
254
+ // E.g. <#if> ... <#else /></#if>
255
+ directiveStartCloseTag2: /else|break|continue|return|stop|flush|t|lt|rt|nt|nested|recurse|fallback|ftl/,
256
+ // Directive names that can have an expression parameter and cannot be self-closing
257
+ // E.g. <#if id==2> ... </#if>
258
+ directiveStartBlank: /if|else[iI]f|list|for[eE]ach|switch|case|assign|global|local|include|import|function|macro|transform|visit|stop|return|call|setting|output[fF]ormat|nested|recurse|escape|ftl|items/,
259
+ // Directive names that can have an end tag
260
+ // E.g. </#if>
261
+ directiveEndCloseTag1: /if|list|items|sep|recover|attempt|for[eE]ach|local|global|assign|function|macro|output[fF]ormat|auto[eE]sc|no(?:autoe|AutoE)sc|compress|transform|switch|escape|no[eE]scape/,
262
+ // <#ESCAPED_CHAR :
263
+ // "\\"
264
+ // (
265
+ // ("n" | "t" | "r" | "f" | "b" | "g" | "l" | "a" | "\\" | "'" | "\"" | "{" | "=")
266
+ // |
267
+ // ("x" ["0"-"9", "A"-"F", "a"-"f"])
268
+ // )
269
+ // >
270
+ // Note: While the JavaCC tokenizer rule only specifies one hex digit,
271
+ // FreeMarker actually interprets up to 4 hex digits.
272
+ escapedChar: /\\(?:[ntrfbgla\\'"\{=]|(?:x[0-9A-Fa-f]{1,4}))/,
273
+ // <#ASCII_DIGIT: ["0" - "9"]>
274
+ asciiDigit: /[0-9]/,
275
+ // <INTEGER : (["0"-"9"])+>
276
+ integer: /[0-9]+/,
277
+ // <#NON_ESCAPED_ID_START_CHAR:
278
+ // [
279
+ // // This was generated on JDK 1.8.0_20 Win64 with src/main/misc/identifierChars/IdentifierCharGenerator.java
280
+ // ...
281
+ // ]
282
+ nonEscapedIdStartChar: /[\$@-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u1FFF\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3006\u3031-\u3035\u303B-\u303C\u3040-\u318F\u31A0-\u31BA\u31F0-\u31FF\u3300-\u337F\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
283
+ // <#ESCAPED_ID_CHAR: "\\" ("-" | "." | ":" | "#")>
284
+ escapedIdChar: /\\[\-\.:#]/,
285
+ // <#ID_START_CHAR: <NON_ESCAPED_ID_START_CHAR>|<ESCAPED_ID_CHAR>>
286
+ idStartChar: /(?:@nonEscapedIdStartChar)|(?:@escapedIdChar)/,
287
+ // <ID: <ID_START_CHAR> (<ID_START_CHAR>|<ASCII_DIGIT>)*>
288
+ id: /(?:@idStartChar)(?:(?:@idStartChar)|(?:@asciiDigit))*/,
289
+ // Certain keywords / operators are allowed to index hashes
290
+ //
291
+ // Expression DotVariable(Expression exp) :
292
+ // {
293
+ // Token t;
294
+ // }
295
+ // {
296
+ // <DOT>
297
+ // (
298
+ // t = <ID> | t = <TIMES> | t = <DOUBLE_STAR>
299
+ // |
300
+ // (
301
+ // t = <LESS_THAN>
302
+ // |
303
+ // t = <LESS_THAN_EQUALS>
304
+ // |
305
+ // t = <ESCAPED_GT>
306
+ // |
307
+ // t = <ESCAPED_GTE>
308
+ // |
309
+ // t = <FALSE>
310
+ // |
311
+ // t = <TRUE>
312
+ // |
313
+ // t = <IN>
314
+ // |
315
+ // t = <AS>
316
+ // |
317
+ // t = <USING>
318
+ // )
319
+ // {
320
+ // if (!Character.isLetter(t.image.charAt(0))) {
321
+ // throw new ParseException(t.image + " is not a valid identifier.", template, t);
322
+ // }
323
+ // }
324
+ // )
325
+ // {
326
+ // notListLiteral(exp, "hash");
327
+ // notStringLiteral(exp, "hash");
328
+ // notBooleanLiteral(exp, "hash");
329
+ // Dot dot = new Dot(exp, t.image);
330
+ // dot.setLocation(template, exp, t);
331
+ // return dot;
332
+ // }
333
+ // }
334
+ specialHashKeys: /\*\*|\*|false|true|in|as|using/,
335
+ // <DOUBLE_EQUALS : "==">
336
+ // <EQUALS : "=">
337
+ // <NOT_EQUALS : "!=">
338
+ // <PLUS_EQUALS : "+=">
339
+ // <MINUS_EQUALS : "-=">
340
+ // <TIMES_EQUALS : "*=">
341
+ // <DIV_EQUALS : "/=">
342
+ // <MOD_EQUALS : "%=">
343
+ // <PLUS_PLUS : "++">
344
+ // <MINUS_MINUS : "--">
345
+ // <LESS_THAN_EQUALS : "lte" | "\\lte" | "<=" | "&lt;=">
346
+ // <LESS_THAN : "lt" | "\\lt" | "<" | "&lt;">
347
+ // <ESCAPED_GTE : "gte" | "\\gte" | "&gt;=">
348
+ // <ESCAPED_GT: "gt" | "\\gt" | "&gt;">
349
+ // <DOUBLE_STAR : "**">
350
+ // <PLUS : "+">
351
+ // <MINUS : "-">
352
+ // <TIMES : "*">
353
+ // <PERCENT : "%">
354
+ // <AND : "&" | "&&" | "&amp;&amp;" | "\\and" >
355
+ // <OR : "|" | "||">
356
+ // <EXCLAM : "!">
357
+ // <COMMA : ",">
358
+ // <SEMICOLON : ";">
359
+ // <COLON : ":">
360
+ // <ELLIPSIS : "...">
361
+ // <DOT_DOT_ASTERISK : "..*" >
362
+ // <DOT_DOT_LESS : "..<" | "..!" >
363
+ // <DOT_DOT : "..">
364
+ // <EXISTS : "??">
365
+ // <BUILT_IN : "?">
366
+ // <LAMBDA_ARROW : "->" | "-&gt;">
367
+ namedSymbols: /&lt;=|&gt;=|\\lte|\\lt|&lt;|\\gte|\\gt|&gt;|&amp;&amp;|\\and|-&gt;|->|==|!=|\+=|-=|\*=|\/=|%=|\+\+|--|<=|&&|\|\||:|\.\.\.|\.\.\*|\.\.<|\.\.!|\?\?|=|<|\+|-|\*|\/|%|\||\.\.|\?|!|&|\.|,|;/,
368
+ arrows: ["->", "-&gt;"],
369
+ delimiters: [";", ":", ",", "."],
370
+ stringOperators: ["lte", "lt", "gte", "gt"],
371
+ noParseTags: ["noparse", "noParse", "comment"],
372
+ tokenizer: {
373
+ // Parser states
374
+ // Plain text
375
+ [s("default__id__")]: [
376
+ { include: s("@directive_token__id__") },
377
+ { include: s("@interpolation_and_text_token__id__") }
378
+ ],
379
+ // A FreeMarker expression inside a directive, e.g. <#if 2<3>
380
+ [s("fmExpression__id__.directive")]: [
381
+ { include: s("@blank_and_expression_comment_token__id__") },
382
+ { include: s("@directive_end_token__id__") },
383
+ { include: s("@expression_token__id__") }
384
+ ],
385
+ // A FreeMarker expression inside an interpolation, e.g. ${2+3}
386
+ [s("fmExpression__id__.interpolation")]: [
387
+ { include: s("@blank_and_expression_comment_token__id__") },
388
+ { include: s("@expression_token__id__") },
389
+ { include: s("@greater_operators_token__id__") }
390
+ ],
391
+ // In an expression and inside a not-yet closed parenthesis / bracket
392
+ [s("inParen__id__.plain")]: [
393
+ { include: s("@blank_and_expression_comment_token__id__") },
394
+ { include: s("@directive_end_token__id__") },
395
+ { include: s("@expression_token__id__") }
396
+ ],
397
+ [s("inParen__id__.gt")]: [
398
+ { include: s("@blank_and_expression_comment_token__id__") },
399
+ { include: s("@expression_token__id__") },
400
+ { include: s("@greater_operators_token__id__") }
401
+ ],
402
+ // Expression for the unified call, e.g. <@createMacro() ... >
403
+ [s("noSpaceExpression__id__")]: [
404
+ { include: s("@no_space_expression_end_token__id__") },
405
+ { include: s("@directive_end_token__id__") },
406
+ { include: s("@expression_token__id__") }
407
+ ],
408
+ // For the function of a unified call. Special case for when the
409
+ // expression is a simple identifier.
410
+ // <@join [1,2] ",">
411
+ // <@null!join [1,2] ",">
412
+ [s("unifiedCall__id__")]: [{ include: s("@unified_call_token__id__") }],
413
+ // For singly and doubly quoted string (that may contain interpolations)
414
+ [s("singleString__id__")]: [{ include: s("@string_single_token__id__") }],
415
+ [s("doubleString__id__")]: [{ include: s("@string_double_token__id__") }],
416
+ // For singly and doubly quoted string (that may not contain interpolations)
417
+ [s("rawSingleString__id__")]: [{ include: s("@string_single_raw_token__id__") }],
418
+ [s("rawDoubleString__id__")]: [{ include: s("@string_double_raw_token__id__") }],
419
+ // For a comment in an expression
420
+ // ${ 1 + <#-- comment --> 2}
421
+ [s("expressionComment__id__")]: [{ include: s("@expression_comment_token__id__") }],
422
+ // For <#noparse> ... </#noparse>
423
+ // For <#noParse> ... </#noParse>
424
+ // For <#comment> ... </#comment>
425
+ [s("noParse__id__")]: [{ include: s("@no_parse_token__id__") }],
426
+ // For <#-- ... -->
427
+ [s("terseComment__id__")]: [{ include: s("@terse_comment_token__id__") }],
428
+ // Common rules
429
+ [s("directive_token__id__")]: [
430
+ // <ATTEMPT : <START_TAG> "attempt" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
431
+ // <RECOVER : <START_TAG> "recover" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
432
+ // <SEP : <START_TAG> "sep" <CLOSE_TAG1>>
433
+ // <AUTOESC : <START_TAG> "auto" ("e"|"E") "sc" <CLOSE_TAG1>> {
434
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
435
+ // }
436
+ // <NOAUTOESC : <START_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> {
437
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
438
+ // }
439
+ // <COMPRESS : <START_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
440
+ // <DEFAUL : <START_TAG> "default" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
441
+ // <NOESCAPE : <START_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> {
442
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
443
+ // }
444
+ //
445
+ // <COMMENT : <START_TAG> "comment" <CLOSE_TAG1>> {
446
+ // handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); noparseTag = "comment";
447
+ // }
448
+ // <NOPARSE: <START_TAG> "no" ("p" | "P") "arse" <CLOSE_TAG1>> {
449
+ // int tagNamingConvention = getTagNamingConvention(matchedToken, 2);
450
+ // handleTagSyntaxAndSwitch(matchedToken, tagNamingConvention, NO_PARSE);
451
+ // noparseTag = tagNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION ? "noParse" : "noparse";
452
+ // }
453
+ [
454
+ r(/(?:@startTag__id__)(@directiveStartCloseTag1)(?:@closeTag1__id__)/),
455
+ ts.id === "auto" ? {
456
+ cases: {
457
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
458
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
459
+ }
460
+ } : [
461
+ { token: "@brackets.directive" },
462
+ { token: "delimiter.directive" },
463
+ {
464
+ cases: {
465
+ "@noParseTags": { token: "tag", next: s("@noParse__id__.$3") },
466
+ "@default": { token: "tag" }
467
+ }
468
+ },
469
+ { token: "delimiter.directive" },
470
+ { token: "@brackets.directive" }
471
+ ]
472
+ ],
473
+ // <ELSE : <START_TAG> "else" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
474
+ // <BREAK : <START_TAG> "break" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
475
+ // <CONTINUE : <START_TAG> "continue" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
476
+ // <SIMPLE_RETURN : <START_TAG> "return" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
477
+ // <HALT : <START_TAG> "stop" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
478
+ // <FLUSH : <START_TAG> "flush" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
479
+ // <TRIM : <START_TAG> "t" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
480
+ // <LTRIM : <START_TAG> "lt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
481
+ // <RTRIM : <START_TAG> "rt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
482
+ // <NOTRIM : <START_TAG> "nt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
483
+ // <SIMPLE_NESTED : <START_TAG> "nested" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
484
+ // <SIMPLE_RECURSE : <START_TAG> "recurse" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
485
+ // <FALLBACK : <START_TAG> "fallback" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
486
+ // <TRIVIAL_FTL_HEADER : ("<#ftl" | "[#ftl") ("/")? (">" | "]")> { ftlHeader(matchedToken); }
487
+ [
488
+ r(/(?:@startTag__id__)(@directiveStartCloseTag2)(?:@closeTag2__id__)/),
489
+ ts.id === "auto" ? {
490
+ cases: {
491
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
492
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
493
+ }
494
+ } : [
495
+ { token: "@brackets.directive" },
496
+ { token: "delimiter.directive" },
497
+ { token: "tag" },
498
+ { token: "delimiter.directive" },
499
+ { token: "@brackets.directive" }
500
+ ]
501
+ ],
502
+ // <IF : <START_TAG> "if" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
503
+ // <ELSE_IF : <START_TAG> "else" ("i" | "I") "f" <BLANK>> {
504
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), FM_EXPRESSION);
505
+ // }
506
+ // <LIST : <START_TAG> "list" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
507
+ // <FOREACH : <START_TAG> "for" ("e" | "E") "ach" <BLANK>> {
508
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), FM_EXPRESSION);
509
+ // }
510
+ // <SWITCH : <START_TAG> "switch" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
511
+ // <CASE : <START_TAG> "case" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
512
+ // <ASSIGN : <START_TAG> "assign" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
513
+ // <GLOBALASSIGN : <START_TAG> "global" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
514
+ // <LOCALASSIGN : <START_TAG> "local" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
515
+ // <_INCLUDE : <START_TAG> "include" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
516
+ // <IMPORT : <START_TAG> "import" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
517
+ // <FUNCTION : <START_TAG> "function" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
518
+ // <MACRO : <START_TAG> "macro" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
519
+ // <TRANSFORM : <START_TAG> "transform" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
520
+ // <VISIT : <START_TAG> "visit" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
521
+ // <STOP : <START_TAG> "stop" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
522
+ // <RETURN : <START_TAG> "return" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
523
+ // <CALL : <START_TAG> "call" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
524
+ // <SETTING : <START_TAG> "setting" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
525
+ // <OUTPUTFORMAT : <START_TAG> "output" ("f"|"F") "ormat" <BLANK>> {
526
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), FM_EXPRESSION);
527
+ // }
528
+ // <NESTED : <START_TAG> "nested" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
529
+ // <RECURSE : <START_TAG> "recurse" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
530
+ // <ESCAPE : <START_TAG> "escape" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
531
+ //
532
+ // Note: FreeMarker grammar appears to treat the FTL header as a special case,
533
+ // in order to remove new lines after the header (?), but since we only need
534
+ // to tokenize for highlighting, we can include this directive here.
535
+ // <FTL_HEADER : ("<#ftl" | "[#ftl") <BLANK>> { ftlHeader(matchedToken); }
536
+ //
537
+ // Note: FreeMarker grammar appears to treat the items directive as a special case for
538
+ // the AST parsing process, but since we only need to tokenize, we can include this
539
+ // directive here.
540
+ // <ITEMS : <START_TAG> "items" (<BLANK>)+ <AS> <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
541
+ [
542
+ r(/(?:@startTag__id__)(@directiveStartBlank)(@blank)/),
543
+ ts.id === "auto" ? {
544
+ cases: {
545
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
546
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
547
+ }
548
+ } : [
549
+ { token: "@brackets.directive" },
550
+ { token: "delimiter.directive" },
551
+ { token: "tag" },
552
+ { token: "", next: s("@fmExpression__id__.directive") }
553
+ ]
554
+ ],
555
+ // <END_IF : <END_TAG> "if" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
556
+ // <END_LIST : <END_TAG> "list" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
557
+ // <END_SEP : <END_TAG> "sep" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
558
+ // <END_RECOVER : <END_TAG> "recover" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
559
+ // <END_ATTEMPT : <END_TAG> "attempt" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
560
+ // <END_FOREACH : <END_TAG> "for" ("e" | "E") "ach" <CLOSE_TAG1>> {
561
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), DEFAULT);
562
+ // }
563
+ // <END_LOCAL : <END_TAG> "local" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
564
+ // <END_GLOBAL : <END_TAG> "global" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
565
+ // <END_ASSIGN : <END_TAG> "assign" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
566
+ // <END_FUNCTION : <END_TAG> "function" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
567
+ // <END_MACRO : <END_TAG> "macro" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
568
+ // <END_OUTPUTFORMAT : <END_TAG> "output" ("f" | "F") "ormat" <CLOSE_TAG1>> {
569
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), DEFAULT);
570
+ // }
571
+ // <END_AUTOESC : <END_TAG> "auto" ("e" | "E") "sc" <CLOSE_TAG1>> {
572
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
573
+ // }
574
+ // <END_NOAUTOESC : <END_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> {
575
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
576
+ // }
577
+ // <END_COMPRESS : <END_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
578
+ // <END_TRANSFORM : <END_TAG> "transform" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
579
+ // <END_SWITCH : <END_TAG> "switch" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
580
+ // <END_ESCAPE : <END_TAG> "escape" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
581
+ // <END_NOESCAPE : <END_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> {
582
+ // handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
583
+ // }
584
+ [
585
+ r(/(?:@endTag__id__)(@directiveEndCloseTag1)(?:@closeTag1__id__)/),
586
+ ts.id === "auto" ? {
587
+ cases: {
588
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
589
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
590
+ }
591
+ } : [
592
+ { token: "@brackets.directive" },
593
+ { token: "delimiter.directive" },
594
+ { token: "tag" },
595
+ { token: "delimiter.directive" },
596
+ { token: "@brackets.directive" }
597
+ ]
598
+ ],
599
+ // <UNIFIED_CALL : "<@" | "[@" > { unifiedCall(matchedToken); }
600
+ [
601
+ r(/(@open__id__)(@)/),
602
+ ts.id === "auto" ? {
603
+ cases: {
604
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
605
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
606
+ }
607
+ } : [
608
+ { token: "@brackets.directive" },
609
+ { token: "delimiter.directive", next: s("@unifiedCall__id__") }
610
+ ]
611
+ ],
612
+ // <UNIFIED_CALL_END : ("<" | "[") "/@" ((<ID>) ("."<ID>)*)? <CLOSE_TAG1>> { unifiedCallEnd(matchedToken); }
613
+ [
614
+ r(/(@open__id__)(\/@)((?:(?:@id)(?:\.(?:@id))*)?)(?:@closeTag1__id__)/),
615
+ [
616
+ { token: "@brackets.directive" },
617
+ { token: "delimiter.directive" },
618
+ { token: "tag" },
619
+ { token: "delimiter.directive" },
620
+ { token: "@brackets.directive" }
621
+ ]
622
+ ],
623
+ // <TERSE_COMMENT : ("<" | "[") "#--" > { noparseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); }
624
+ [
625
+ r(/(@open__id__)#--/),
626
+ ts.id === "auto" ? {
627
+ cases: {
628
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
629
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
630
+ }
631
+ } : { token: "comment", next: s("@terseComment__id__") }
632
+ ],
633
+ // <UNKNOWN_DIRECTIVE : ("[#" | "[/#" | "<#" | "</#") (["a"-"z", "A"-"Z", "_"])+>
634
+ [
635
+ r(/(?:@startOrEndTag__id__)([a-zA-Z_]+)/),
636
+ ts.id === "auto" ? {
637
+ cases: {
638
+ "$1==<": { token: "@rematch", switchTo: `@default_angle_${is.id}` },
639
+ "$1==[": { token: "@rematch", switchTo: `@default_bracket_${is.id}` }
640
+ }
641
+ } : [
642
+ { token: "@brackets.directive" },
643
+ { token: "delimiter.directive" },
644
+ { token: "tag.invalid", next: s("@fmExpression__id__.directive") }
645
+ ]
646
+ ]
647
+ ],
648
+ // <DEFAULT, NO_DIRECTIVE> TOKEN :
649
+ [s("interpolation_and_text_token__id__")]: [
650
+ // <DOLLAR_INTERPOLATION_OPENING : "${"> { startInterpolation(matchedToken); }
651
+ // <SQUARE_BRACKET_INTERPOLATION_OPENING : "[="> { startInterpolation(matchedToken); }
652
+ [
653
+ r(/(@iOpen1__id__)(@iOpen2__id__)/),
654
+ [
655
+ { token: is.id === "bracket" ? "@brackets.interpolation" : "delimiter.interpolation" },
656
+ {
657
+ token: is.id === "bracket" ? "delimiter.interpolation" : "@brackets.interpolation",
658
+ next: s("@fmExpression__id__.interpolation")
659
+ }
660
+ ]
661
+ ],
662
+ // <STATIC_TEXT_FALSE_ALARM : "$" | "#" | "<" | "[" | "{"> // to handle a lone dollar sign or "<" or "# or <@ with whitespace after"
663
+ // <STATIC_TEXT_WS : ("\n" | "\r" | "\t" | " ")+>
664
+ // <STATIC_TEXT_NON_WS : (~["$", "<", "#", "[", "{", "\n", "\r", "\t", " "])+>
665
+ [/[\$#<\[\{]|(?:@blank)+|[^\$<#\[\{\n\r\t ]+/, { token: "source" }]
666
+ ],
667
+ // <STRING_LITERAL :
668
+ // (
669
+ // "\""
670
+ // ((~["\"", "\\"]) | <ESCAPED_CHAR>)*
671
+ // "\""
672
+ // )
673
+ // |
674
+ // (
675
+ // "'"
676
+ // ((~["'", "\\"]) | <ESCAPED_CHAR>)*
677
+ // "'"
678
+ // )
679
+ // >
680
+ [s("string_single_token__id__")]: [
681
+ [/[^'\\]/, { token: "string" }],
682
+ [/@escapedChar/, { token: "string.escape" }],
683
+ [/'/, { token: "string", next: "@pop" }]
684
+ ],
685
+ [s("string_double_token__id__")]: [
686
+ [/[^"\\]/, { token: "string" }],
687
+ [/@escapedChar/, { token: "string.escape" }],
688
+ [/"/, { token: "string", next: "@pop" }]
689
+ ],
690
+ // <RAW_STRING : "r" (("\"" (~["\""])* "\"") | ("'" (~["'"])* "'"))>
691
+ [s("string_single_raw_token__id__")]: [
692
+ [/[^']+/, { token: "string.raw" }],
693
+ [/'/, { token: "string.raw", next: "@pop" }]
694
+ ],
695
+ [s("string_double_raw_token__id__")]: [
696
+ [/[^"]+/, { token: "string.raw" }],
697
+ [/"/, { token: "string.raw", next: "@pop" }]
698
+ ],
699
+ // <FM_EXPRESSION, IN_PAREN, NO_SPACE_EXPRESSION, NAMED_PARAMETER_EXPRESSION> TOKEN :
700
+ [s("expression_token__id__")]: [
701
+ // Strings
702
+ [
703
+ /(r?)(['"])/,
704
+ {
705
+ cases: {
706
+ "r'": [
707
+ { token: "keyword" },
708
+ { token: "string.raw", next: s("@rawSingleString__id__") }
709
+ ],
710
+ 'r"': [
711
+ { token: "keyword" },
712
+ { token: "string.raw", next: s("@rawDoubleString__id__") }
713
+ ],
714
+ "'": [{ token: "source" }, { token: "string", next: s("@singleString__id__") }],
715
+ '"': [{ token: "source" }, { token: "string", next: s("@doubleString__id__") }]
716
+ }
717
+ }
718
+ ],
719
+ // Numbers
720
+ // <INTEGER : (["0"-"9"])+>
721
+ // <DECIMAL : <INTEGER> "." <INTEGER>>
722
+ [
723
+ /(?:@integer)(?:\.(?:@integer))?/,
724
+ {
725
+ cases: {
726
+ "(?:@integer)": { token: "number" },
727
+ "@default": { token: "number.float" }
728
+ }
729
+ }
730
+ ],
731
+ // Special hash keys that must not be treated as identifiers
732
+ // after a period, e.g. a.** is accessing the key "**" of a
733
+ [
734
+ /(\.)(@blank*)(@specialHashKeys)/,
735
+ [{ token: "delimiter" }, { token: "" }, { token: "identifier" }]
736
+ ],
737
+ // Symbols / operators
738
+ [
739
+ /(?:@namedSymbols)/,
740
+ {
741
+ cases: {
742
+ "@arrows": { token: "meta.arrow" },
743
+ "@delimiters": { token: "delimiter" },
744
+ "@default": { token: "operators" }
745
+ }
746
+ }
747
+ ],
748
+ // Identifiers
749
+ [
750
+ /@id/,
751
+ {
752
+ cases: {
753
+ "@keywords": { token: "keyword.$0" },
754
+ "@stringOperators": { token: "operators" },
755
+ "@default": { token: "identifier" }
756
+ }
757
+ }
758
+ ],
759
+ // <OPEN_BRACKET : "[">
760
+ // <CLOSE_BRACKET : "]">
761
+ // <OPEN_PAREN : "(">
762
+ // <CLOSE_PAREN : ")">
763
+ // <OPENING_CURLY_BRACKET : "{">
764
+ // <CLOSING_CURLY_BRACKET : "}">
765
+ [
766
+ /[\[\]\(\)\{\}]/,
767
+ {
768
+ cases: {
769
+ "\\[": {
770
+ cases: {
771
+ "$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") },
772
+ "@default": { token: "@brackets", next: s("@inParen__id__.plain") }
773
+ }
774
+ },
775
+ "\\]": {
776
+ cases: {
777
+ ...is.id === "bracket" ? {
778
+ "$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" }
779
+ } : {},
780
+ // This cannot happen while in auto mode, since this applies only to an
781
+ // fmExpression inside a directive. But once we encounter the start of a
782
+ // directive, we can establish the tag syntax mode.
783
+ ...ts.id === "bracket" ? {
784
+ "$S2==directive": { token: "@brackets.directive", next: "@popall" }
785
+ } : {},
786
+ // Ignore mismatched paren
787
+ [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
788
+ "@default": { token: "@brackets" }
789
+ }
790
+ },
791
+ "\\(": { token: "@brackets", next: s("@inParen__id__.gt") },
792
+ "\\)": {
793
+ cases: {
794
+ [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
795
+ "@default": { token: "@brackets" }
796
+ }
797
+ },
798
+ "\\{": {
799
+ cases: {
800
+ "$S2==gt": { token: "@brackets", next: s("@inParen__id__.gt") },
801
+ "@default": { token: "@brackets", next: s("@inParen__id__.plain") }
802
+ }
803
+ },
804
+ "\\}": {
805
+ cases: {
806
+ ...is.id === "bracket" ? {} : {
807
+ "$S2==interpolation": { token: "@brackets.interpolation", next: "@popall" }
808
+ },
809
+ // Ignore mismatched paren
810
+ [s("$S1==inParen__id__")]: { token: "@brackets", next: "@pop" },
811
+ "@default": { token: "@brackets" }
812
+ }
813
+ }
814
+ }
815
+ }
816
+ ],
817
+ // <OPEN_MISPLACED_INTERPOLATION : "${" | "#{" | "[=">
818
+ [/\$\{/, { token: "delimiter.invalid" }]
819
+ ],
820
+ // <FM_EXPRESSION, IN_PAREN, NAMED_PARAMETER_EXPRESSION> SKIP :
821
+ [s("blank_and_expression_comment_token__id__")]: [
822
+ // < ( " " | "\t" | "\n" | "\r" )+ >
823
+ [/(?:@blank)+/, { token: "" }],
824
+ // < ("<" | "[") ("#" | "!") "--"> : EXPRESSION_COMMENT
825
+ [/[<\[][#!]--/, { token: "comment", next: s("@expressionComment__id__") }]
826
+ ],
827
+ // <FM_EXPRESSION, NO_SPACE_EXPRESSION, NAMED_PARAMETER_EXPRESSION> TOKEN :
828
+ [s("directive_end_token__id__")]: [
829
+ // <DIRECTIVE_END : ">">
830
+ // {
831
+ // if (inFTLHeader) {
832
+ // eatNewline();
833
+ // inFTLHeader = false;
834
+ // }
835
+ // if (squBracTagSyntax || postInterpolationLexState != -1 /* We are in an interpolation */) {
836
+ // matchedToken.kind = NATURAL_GT;
837
+ // } else {
838
+ // SwitchTo(DEFAULT);
839
+ // }
840
+ // }
841
+ // This cannot happen while in auto mode, since this applies only to an
842
+ // fmExpression inside a directive. But once we encounter the start of a
843
+ // directive, we can establish the tag syntax mode.
844
+ [
845
+ />/,
846
+ ts.id === "bracket" ? { token: "operators" } : { token: "@brackets.directive", next: "@popall" }
847
+ ],
848
+ // <EMPTY_DIRECTIVE_END : "/>" | "/]">
849
+ // It is a syntax error to end a tag with the wrong close token
850
+ // Let's indicate that to the user by not closing the tag
851
+ [
852
+ r(/(\/)(@close__id__)/),
853
+ [{ token: "delimiter.directive" }, { token: "@brackets.directive", next: "@popall" }]
854
+ ]
855
+ ],
856
+ // <IN_PAREN> TOKEN :
857
+ [s("greater_operators_token__id__")]: [
858
+ // <NATURAL_GT : ">">
859
+ [/>/, { token: "operators" }],
860
+ // <NATURAL_GTE : ">=">
861
+ [/>=/, { token: "operators" }]
862
+ ],
863
+ // <NO_SPACE_EXPRESSION> TOKEN :
864
+ [s("no_space_expression_end_token__id__")]: [
865
+ // <TERMINATING_WHITESPACE : (["\n", "\r", "\t", " "])+> : FM_EXPRESSION
866
+ [/(?:@blank)+/, { token: "", switchTo: s("@fmExpression__id__.directive") }]
867
+ ],
868
+ [s("unified_call_token__id__")]: [
869
+ // Special case for a call where the expression is just an ID
870
+ // <UNIFIED_CALL> <ID> <BLANK>+
871
+ [
872
+ /(@id)((?:@blank)+)/,
873
+ [{ token: "tag" }, { token: "", next: s("@fmExpression__id__.directive") }]
874
+ ],
875
+ [
876
+ r(/(@id)(\/?)(@close__id__)/),
877
+ [
878
+ { token: "tag" },
879
+ { token: "delimiter.directive" },
880
+ { token: "@brackets.directive", next: "@popall" }
881
+ ]
882
+ ],
883
+ [/./, { token: "@rematch", next: s("@noSpaceExpression__id__") }]
884
+ ],
885
+ // <NO_PARSE> TOKEN :
886
+ [s("no_parse_token__id__")]: [
887
+ // <MAYBE_END :
888
+ // ("<" | "[")
889
+ // "/"
890
+ // ("#")?
891
+ // (["a"-"z", "A"-"Z"])+
892
+ // ( " " | "\t" | "\n" | "\r" )*
893
+ // (">" | "]")
894
+ // >
895
+ [
896
+ r(/(@open__id__)(\/#?)([a-zA-Z]+)((?:@blank)*)(@close__id__)/),
897
+ {
898
+ cases: {
899
+ "$S2==$3": [
900
+ { token: "@brackets.directive" },
901
+ { token: "delimiter.directive" },
902
+ { token: "tag" },
903
+ { token: "" },
904
+ { token: "@brackets.directive", next: "@popall" }
905
+ ],
906
+ "$S2==comment": [
907
+ { token: "comment" },
908
+ { token: "comment" },
909
+ { token: "comment" },
910
+ { token: "comment" },
911
+ { token: "comment" }
912
+ ],
913
+ "@default": [
914
+ { token: "source" },
915
+ { token: "source" },
916
+ { token: "source" },
917
+ { token: "source" },
918
+ { token: "source" }
919
+ ]
920
+ }
921
+ }
922
+ ],
923
+ // <KEEP_GOING : (~["<", "[", "-"])+>
924
+ // <LONE_LESS_THAN_OR_DASH : ["<", "[", "-"]>
925
+ [
926
+ /[^<\[\-]+|[<\[\-]/,
927
+ {
928
+ cases: {
929
+ "$S2==comment": { token: "comment" },
930
+ "@default": { token: "source" }
931
+ }
932
+ }
933
+ ]
934
+ ],
935
+ // <EXPRESSION_COMMENT> SKIP:
936
+ [s("expression_comment_token__id__")]: [
937
+ // < "-->" | "--]">
938
+ [
939
+ /--[>\]]/,
940
+ {
941
+ token: "comment",
942
+ next: "@pop"
943
+ }
944
+ ],
945
+ // < (~["-", ">", "]"])+ >
946
+ // < ">">
947
+ // < "]">
948
+ // < "-">
949
+ [/[^\->\]]+|[>\]\-]/, { token: "comment" }]
950
+ ],
951
+ [s("terse_comment_token__id__")]: [
952
+ // <TERSE_COMMENT_END : "-->" | "--]">
953
+ [r(/--(?:@close__id__)/), { token: "comment", next: "@popall" }],
954
+ // <KEEP_GOING : (~["<", "[", "-"])+>
955
+ // <LONE_LESS_THAN_OR_DASH : ["<", "[", "-"]>
956
+ [/[^<\[\-]+|[<\[\-]/, { token: "comment" }]
957
+ ]
958
+ }
959
+ };
960
+ }
961
+ function createMonarchLanguageAuto(is) {
962
+ const angle = createMonarchLanguage(TagSyntaxAngle, is);
963
+ const bracket = createMonarchLanguage(TagSyntaxBracket, is);
964
+ const auto = createMonarchLanguage(TagSyntaxAuto, is);
965
+ return {
966
+ // Angle and bracket syntax mode
967
+ // We switch to one of these once we have determined the mode
968
+ ...angle,
969
+ ...bracket,
970
+ ...auto,
971
+ // Settings
972
+ unicode: true,
973
+ includeLF: false,
974
+ start: `default_auto_${is.id}`,
975
+ ignoreCase: false,
976
+ defaultToken: "invalid",
977
+ tokenPostfix: `.freemarker2`,
978
+ brackets: [
979
+ { open: "{", close: "}", token: "delimiter.curly" },
980
+ { open: "[", close: "]", token: "delimiter.square" },
981
+ { open: "(", close: ")", token: "delimiter.parenthesis" },
982
+ { open: "<", close: ">", token: "delimiter.angle" }
983
+ ],
984
+ tokenizer: {
985
+ ...angle.tokenizer,
986
+ ...bracket.tokenizer,
987
+ ...auto.tokenizer
988
+ }
989
+ };
990
+ }
991
+ var TagAngleInterpolationDollar = {
992
+ conf: createLangConfiguration(TagSyntaxAngle),
993
+ language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxDollar)
994
+ };
995
+ var TagBracketInterpolationDollar = {
996
+ conf: createLangConfiguration(TagSyntaxBracket),
997
+ language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxDollar)
998
+ };
999
+ var TagAngleInterpolationBracket = {
1000
+ conf: createLangConfiguration(TagSyntaxAngle),
1001
+ language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxBracket)
1002
+ };
1003
+ var TagBracketInterpolationBracket = {
1004
+ conf: createLangConfiguration(TagSyntaxBracket),
1005
+ language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxBracket)
1006
+ };
1007
+ var TagAutoInterpolationDollar = {
1008
+ conf: createLangConfigurationAuto(),
1009
+ language: createMonarchLanguageAuto(InterpolationSyntaxDollar)
1010
+ };
1011
+ var TagAutoInterpolationBracket = {
1012
+ conf: createLangConfigurationAuto(),
1013
+ language: createMonarchLanguageAuto(InterpolationSyntaxBracket)
1014
+ };
1015
+
1016
+ export { TagAngleInterpolationBracket, TagAngleInterpolationDollar, TagAutoInterpolationBracket, TagAutoInterpolationDollar, TagBracketInterpolationBracket, TagBracketInterpolationDollar };