twig-ECLVATD6.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. import "./chunk-2LSFTFF7.js";
  2. // node_modules/.pnpm/monaco-editor@0.38.0/node_modules/monaco-editor/esm/vs/basic-languages/twig/twig.js
  3. var conf = {
  4. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
  5. comments: {
  6. blockComment: ["{#", "#}"]
  7. },
  8. brackets: [
  9. ["{#", "#}"],
  10. ["{%", "%}"],
  11. ["{{", "}}"],
  12. ["(", ")"],
  13. ["[", "]"],
  14. ["<!--", "-->"],
  15. ["<", ">"]
  16. ],
  17. autoClosingPairs: [
  18. { open: "{# ", close: " #}" },
  19. { open: "{% ", close: " %}" },
  20. { open: "{{ ", close: " }}" },
  21. { open: "[", close: "]" },
  22. { open: "(", close: ")" },
  23. { open: '"', close: '"' },
  24. { open: "'", close: "'" }
  25. ],
  26. surroundingPairs: [
  27. { open: '"', close: '"' },
  28. { open: "'", close: "'" },
  29. { open: "<", close: ">" }
  30. ]
  31. };
  32. var language = {
  33. defaultToken: "",
  34. tokenPostfix: "",
  35. ignoreCase: true,
  36. keywords: [
  37. "apply",
  38. "autoescape",
  39. "block",
  40. "deprecated",
  41. "do",
  42. "embed",
  43. "extends",
  44. "flush",
  45. "for",
  46. "from",
  47. "if",
  48. "import",
  49. "include",
  50. "macro",
  51. "sandbox",
  52. "set",
  53. "use",
  54. "verbatim",
  55. "with",
  56. "endapply",
  57. "endautoescape",
  58. "endblock",
  59. "endembed",
  60. "endfor",
  61. "endif",
  62. "endmacro",
  63. "endsandbox",
  64. "endset",
  65. "endwith",
  66. "true",
  67. "false"
  68. ],
  69. tokenizer: {
  70. root: [
  71. [/\s+/],
  72. [/{#/, "comment.twig", "@commentState"],
  73. [/{%[-~]?/, "delimiter.twig", "@blockState"],
  74. [/{{[-~]?/, "delimiter.twig", "@variableState"],
  75. [/<!DOCTYPE/, "metatag.html", "@doctype"],
  76. [/<!--/, "comment.html", "@comment"],
  77. [/(<)((?:[\w\-]+:)?[\w\-]+)(\s*)(\/>)/, ["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\-]+:)?[\w\-]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
  81. [/(<\/)((?:[\w\-]+:)?[\w\-]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
  82. [/</, "delimiter.html"],
  83. [/[^<]+/]
  84. ],
  85. commentState: [
  86. [/#}/, "comment.twig", "@pop"],
  87. [/./, "comment.twig"]
  88. ],
  89. blockState: [
  90. [/[-~]?%}/, "delimiter.twig", "@pop"],
  91. [/\s+/],
  92. [
  93. /(verbatim)(\s*)([-~]?%})/,
  94. ["keyword.twig", "", { token: "delimiter.twig", next: "@rawDataState" }]
  95. ],
  96. { include: "expression" }
  97. ],
  98. rawDataState: [
  99. [
  100. /({%[-~]?)(\s*)(endverbatim)(\s*)([-~]?%})/,
  101. ["delimiter.twig", "", "keyword.twig", "", { token: "delimiter.twig", next: "@popall" }]
  102. ],
  103. [/./, "string.twig"]
  104. ],
  105. variableState: [[/[-~]?}}/, "delimiter.twig", "@pop"], { include: "expression" }],
  106. stringState: [
  107. [/"/, "string.twig", "@pop"],
  108. [/#{\s*/, "string.twig", "@interpolationState"],
  109. [/[^#"\\]*(?:(?:\\.|#(?!\{))[^#"\\]*)*/, "string.twig"]
  110. ],
  111. interpolationState: [
  112. [/}/, "string.twig", "@pop"],
  113. { include: "expression" }
  114. ],
  115. expression: [
  116. [/\s+/],
  117. [/\+|-|\/{1,2}|%|\*{1,2}/, "operators.twig"],
  118. [/(and|or|not|b-and|b-xor|b-or)(\s+)/, ["operators.twig", ""]],
  119. [/==|!=|<|>|>=|<=/, "operators.twig"],
  120. [/(starts with|ends with|matches)(\s+)/, ["operators.twig", ""]],
  121. [/(in)(\s+)/, ["operators.twig", ""]],
  122. [/(is)(\s+)/, ["operators.twig", ""]],
  123. [/\||~|:|\.{1,2}|\?{1,2}/, "operators.twig"],
  124. [
  125. /[^\W\d][\w]*/,
  126. {
  127. cases: {
  128. "@keywords": "keyword.twig",
  129. "@default": "variable.twig"
  130. }
  131. }
  132. ],
  133. [/\d+(\.\d+)?/, "number.twig"],
  134. [/\(|\)|\[|\]|{|}|,/, "delimiter.twig"],
  135. [/"([^#"\\]*(?:\\.[^#"\\]*)*)"|\'([^\'\\]*(?:\\.[^\'\\]*)*)\'/, "string.twig"],
  136. [/"/, "string.twig", "@stringState"],
  137. [/=>/, "operators.twig"],
  138. [/=/, "operators.twig"]
  139. ],
  140. doctype: [
  141. [/[^>]+/, "metatag.content.html"],
  142. [/>/, "metatag.html", "@pop"]
  143. ],
  144. comment: [
  145. [/-->/, "comment.html", "@pop"],
  146. [/[^-]+/, "comment.content.html"],
  147. [/./, "comment.content.html"]
  148. ],
  149. otherTag: [
  150. [/\/?>/, "delimiter.html", "@pop"],
  151. [/"([^"]*)"/, "attribute.value.html"],
  152. [/'([^']*)'/, "attribute.value.html"],
  153. [/[\w\-]+/, "attribute.name.html"],
  154. [/=/, "delimiter.html"],
  155. [/[ \t\r\n]+/]
  156. ],
  157. script: [
  158. [/type/, "attribute.name.html", "@scriptAfterType"],
  159. [/"([^"]*)"/, "attribute.value.html"],
  160. [/'([^']*)'/, "attribute.value.html"],
  161. [/[\w\-]+/, "attribute.name.html"],
  162. [/=/, "delimiter.html"],
  163. [
  164. />/,
  165. {
  166. token: "delimiter.html",
  167. next: "@scriptEmbedded",
  168. nextEmbedded: "text/javascript"
  169. }
  170. ],
  171. [/[ \t\r\n]+/],
  172. [
  173. /(<\/)(script\s*)(>)/,
  174. ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
  175. ]
  176. ],
  177. scriptAfterType: [
  178. [/=/, "delimiter.html", "@scriptAfterTypeEquals"],
  179. [
  180. />/,
  181. {
  182. token: "delimiter.html",
  183. next: "@scriptEmbedded",
  184. nextEmbedded: "text/javascript"
  185. }
  186. ],
  187. [/[ \t\r\n]+/],
  188. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  189. ],
  190. scriptAfterTypeEquals: [
  191. [
  192. /"([^"]*)"/,
  193. {
  194. token: "attribute.value.html",
  195. switchTo: "@scriptWithCustomType.$1"
  196. }
  197. ],
  198. [
  199. /'([^']*)'/,
  200. {
  201. token: "attribute.value.html",
  202. switchTo: "@scriptWithCustomType.$1"
  203. }
  204. ],
  205. [
  206. />/,
  207. {
  208. token: "delimiter.html",
  209. next: "@scriptEmbedded",
  210. nextEmbedded: "text/javascript"
  211. }
  212. ],
  213. [/[ \t\r\n]+/],
  214. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  215. ],
  216. scriptWithCustomType: [
  217. [
  218. />/,
  219. {
  220. token: "delimiter.html",
  221. next: "@scriptEmbedded.$S2",
  222. nextEmbedded: "$S2"
  223. }
  224. ],
  225. [/"([^"]*)"/, "attribute.value.html"],
  226. [/'([^']*)'/, "attribute.value.html"],
  227. [/[\w\-]+/, "attribute.name.html"],
  228. [/=/, "delimiter.html"],
  229. [/[ \t\r\n]+/],
  230. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  231. ],
  232. scriptEmbedded: [
  233. [/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
  234. [/[^<]+/, ""]
  235. ],
  236. style: [
  237. [/type/, "attribute.name.html", "@styleAfterType"],
  238. [/"([^"]*)"/, "attribute.value.html"],
  239. [/'([^']*)'/, "attribute.value.html"],
  240. [/[\w\-]+/, "attribute.name.html"],
  241. [/=/, "delimiter.html"],
  242. [
  243. />/,
  244. {
  245. token: "delimiter.html",
  246. next: "@styleEmbedded",
  247. nextEmbedded: "text/css"
  248. }
  249. ],
  250. [/[ \t\r\n]+/],
  251. [
  252. /(<\/)(style\s*)(>)/,
  253. ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
  254. ]
  255. ],
  256. styleAfterType: [
  257. [/=/, "delimiter.html", "@styleAfterTypeEquals"],
  258. [
  259. />/,
  260. {
  261. token: "delimiter.html",
  262. next: "@styleEmbedded",
  263. nextEmbedded: "text/css"
  264. }
  265. ],
  266. [/[ \t\r\n]+/],
  267. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  268. ],
  269. styleAfterTypeEquals: [
  270. [
  271. /"([^"]*)"/,
  272. {
  273. token: "attribute.value.html",
  274. switchTo: "@styleWithCustomType.$1"
  275. }
  276. ],
  277. [
  278. /'([^']*)'/,
  279. {
  280. token: "attribute.value.html",
  281. switchTo: "@styleWithCustomType.$1"
  282. }
  283. ],
  284. [
  285. />/,
  286. {
  287. token: "delimiter.html",
  288. next: "@styleEmbedded",
  289. nextEmbedded: "text/css"
  290. }
  291. ],
  292. [/[ \t\r\n]+/],
  293. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  294. ],
  295. styleWithCustomType: [
  296. [
  297. />/,
  298. {
  299. token: "delimiter.html",
  300. next: "@styleEmbedded.$S2",
  301. nextEmbedded: "$S2"
  302. }
  303. ],
  304. [/"([^"]*)"/, "attribute.value.html"],
  305. [/'([^']*)'/, "attribute.value.html"],
  306. [/[\w\-]+/, "attribute.name.html"],
  307. [/=/, "delimiter.html"],
  308. [/[ \t\r\n]+/],
  309. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  310. ],
  311. styleEmbedded: [
  312. [/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }],
  313. [/[^<]+/, ""]
  314. ]
  315. }
  316. };
  317. export {
  318. conf,
  319. language
  320. };
  321. /*! Bundled license information:
  322. monaco-editor/esm/vs/basic-languages/twig/twig.js:
  323. (*!-----------------------------------------------------------------------------
  324. * Copyright (c) Microsoft Corporation. All rights reserved.
  325. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  326. * Released under the MIT license
  327. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  328. *-----------------------------------------------------------------------------*)
  329. */
  330. //# sourceMappingURL=twig-ECLVATD6.js.map