d151bf7af2f6e31e5b01d90822b7c46de4153b6e3d1bdde0b3b68618368f3f089fc54571a387762a9374912642008a27b94aa4a866cda6d5f3fc70a567e425 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /*!-----------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Version: 0.34.1(547870b6881302c5b4ff32173c16d06009e3588f)
  4. * Released under the MIT license
  5. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  6. *-----------------------------------------------------------------------------*/
  7. var __defProp = Object.defineProperty;
  8. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  9. var __getOwnPropNames = Object.getOwnPropertyNames;
  10. var __hasOwnProp = Object.prototype.hasOwnProperty;
  11. var __copyProps = (to, from, except, desc) => {
  12. if (from && typeof from === "object" || typeof from === "function") {
  13. for (let key of __getOwnPropNames(from))
  14. if (!__hasOwnProp.call(to, key) && key !== except)
  15. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  16. }
  17. return to;
  18. };
  19. var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
  20. // src/fillers/monaco-editor-core.ts
  21. var monaco_editor_core_exports = {};
  22. __reExport(monaco_editor_core_exports, monaco_editor_core_star);
  23. import * as monaco_editor_core_star from "../../editor/editor.api.js";
  24. // src/basic-languages/razor/razor.ts
  25. var EMPTY_ELEMENTS = [
  26. "area",
  27. "base",
  28. "br",
  29. "col",
  30. "embed",
  31. "hr",
  32. "img",
  33. "input",
  34. "keygen",
  35. "link",
  36. "menuitem",
  37. "meta",
  38. "param",
  39. "source",
  40. "track",
  41. "wbr"
  42. ];
  43. var conf = {
  44. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\$\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\s]+)/g,
  45. comments: {
  46. blockComment: ["<!--", "-->"]
  47. },
  48. brackets: [
  49. ["<!--", "-->"],
  50. ["<", ">"],
  51. ["{", "}"],
  52. ["(", ")"]
  53. ],
  54. autoClosingPairs: [
  55. { open: "{", close: "}" },
  56. { open: "[", close: "]" },
  57. { open: "(", close: ")" },
  58. { open: '"', close: '"' },
  59. { open: "'", close: "'" }
  60. ],
  61. surroundingPairs: [
  62. { open: '"', close: '"' },
  63. { open: "'", close: "'" },
  64. { open: "<", close: ">" }
  65. ],
  66. onEnterRules: [
  67. {
  68. beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, "i"),
  69. afterText: /^<\/(\w[\w\d]*)\s*>$/i,
  70. action: {
  71. indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent
  72. }
  73. },
  74. {
  75. beforeText: new RegExp(`<(?!(?:${EMPTY_ELEMENTS.join("|")}))(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`, "i"),
  76. action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent }
  77. }
  78. ]
  79. };
  80. var language = {
  81. defaultToken: "",
  82. tokenPostfix: "",
  83. tokenizer: {
  84. root: [
  85. [/@@@@/],
  86. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.root" }],
  87. [/<!DOCTYPE/, "metatag.html", "@doctype"],
  88. [/<!--/, "comment.html", "@comment"],
  89. [/(<)([\w\-]+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
  90. [/(<)(script)/, ["delimiter.html", { token: "tag.html", next: "@script" }]],
  91. [/(<)(style)/, ["delimiter.html", { token: "tag.html", next: "@style" }]],
  92. [/(<)([:\w\-]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
  93. [/(<\/)([\w\-]+)/, ["delimiter.html", { token: "tag.html", next: "@otherTag" }]],
  94. [/</, "delimiter.html"],
  95. [/[ \t\r\n]+/],
  96. [/[^<@]+/]
  97. ],
  98. doctype: [
  99. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.comment" }],
  100. [/[^>]+/, "metatag.content.html"],
  101. [/>/, "metatag.html", "@pop"]
  102. ],
  103. comment: [
  104. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.comment" }],
  105. [/-->/, "comment.html", "@pop"],
  106. [/[^-]+/, "comment.content.html"],
  107. [/./, "comment.content.html"]
  108. ],
  109. otherTag: [
  110. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.otherTag" }],
  111. [/\/?>/, "delimiter.html", "@pop"],
  112. [/"([^"]*)"/, "attribute.value"],
  113. [/'([^']*)'/, "attribute.value"],
  114. [/[\w\-]+/, "attribute.name"],
  115. [/=/, "delimiter"],
  116. [/[ \t\r\n]+/]
  117. ],
  118. script: [
  119. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.script" }],
  120. [/type/, "attribute.name", "@scriptAfterType"],
  121. [/"([^"]*)"/, "attribute.value"],
  122. [/'([^']*)'/, "attribute.value"],
  123. [/[\w\-]+/, "attribute.name"],
  124. [/=/, "delimiter"],
  125. [
  126. />/,
  127. {
  128. token: "delimiter.html",
  129. next: "@scriptEmbedded.text/javascript",
  130. nextEmbedded: "text/javascript"
  131. }
  132. ],
  133. [/[ \t\r\n]+/],
  134. [
  135. /(<\/)(script\s*)(>)/,
  136. ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
  137. ]
  138. ],
  139. scriptAfterType: [
  140. [
  141. /@[^@]/,
  142. {
  143. token: "@rematch",
  144. switchTo: "@razorInSimpleState.scriptAfterType"
  145. }
  146. ],
  147. [/=/, "delimiter", "@scriptAfterTypeEquals"],
  148. [
  149. />/,
  150. {
  151. token: "delimiter.html",
  152. next: "@scriptEmbedded.text/javascript",
  153. nextEmbedded: "text/javascript"
  154. }
  155. ],
  156. [/[ \t\r\n]+/],
  157. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  158. ],
  159. scriptAfterTypeEquals: [
  160. [
  161. /@[^@]/,
  162. {
  163. token: "@rematch",
  164. switchTo: "@razorInSimpleState.scriptAfterTypeEquals"
  165. }
  166. ],
  167. [
  168. /"([^"]*)"/,
  169. {
  170. token: "attribute.value",
  171. switchTo: "@scriptWithCustomType.$1"
  172. }
  173. ],
  174. [
  175. /'([^']*)'/,
  176. {
  177. token: "attribute.value",
  178. switchTo: "@scriptWithCustomType.$1"
  179. }
  180. ],
  181. [
  182. />/,
  183. {
  184. token: "delimiter.html",
  185. next: "@scriptEmbedded.text/javascript",
  186. nextEmbedded: "text/javascript"
  187. }
  188. ],
  189. [/[ \t\r\n]+/],
  190. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  191. ],
  192. scriptWithCustomType: [
  193. [
  194. /@[^@]/,
  195. {
  196. token: "@rematch",
  197. switchTo: "@razorInSimpleState.scriptWithCustomType.$S2"
  198. }
  199. ],
  200. [
  201. />/,
  202. {
  203. token: "delimiter.html",
  204. next: "@scriptEmbedded.$S2",
  205. nextEmbedded: "$S2"
  206. }
  207. ],
  208. [/"([^"]*)"/, "attribute.value"],
  209. [/'([^']*)'/, "attribute.value"],
  210. [/[\w\-]+/, "attribute.name"],
  211. [/=/, "delimiter"],
  212. [/[ \t\r\n]+/],
  213. [/<\/script\s*>/, { token: "@rematch", next: "@pop" }]
  214. ],
  215. scriptEmbedded: [
  216. [
  217. /@[^@]/,
  218. {
  219. token: "@rematch",
  220. switchTo: "@razorInEmbeddedState.scriptEmbedded.$S2",
  221. nextEmbedded: "@pop"
  222. }
  223. ],
  224. [/<\/script/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
  225. ],
  226. style: [
  227. [/@[^@]/, { token: "@rematch", switchTo: "@razorInSimpleState.style" }],
  228. [/type/, "attribute.name", "@styleAfterType"],
  229. [/"([^"]*)"/, "attribute.value"],
  230. [/'([^']*)'/, "attribute.value"],
  231. [/[\w\-]+/, "attribute.name"],
  232. [/=/, "delimiter"],
  233. [
  234. />/,
  235. {
  236. token: "delimiter.html",
  237. next: "@styleEmbedded.text/css",
  238. nextEmbedded: "text/css"
  239. }
  240. ],
  241. [/[ \t\r\n]+/],
  242. [
  243. /(<\/)(style\s*)(>)/,
  244. ["delimiter.html", "tag.html", { token: "delimiter.html", next: "@pop" }]
  245. ]
  246. ],
  247. styleAfterType: [
  248. [
  249. /@[^@]/,
  250. {
  251. token: "@rematch",
  252. switchTo: "@razorInSimpleState.styleAfterType"
  253. }
  254. ],
  255. [/=/, "delimiter", "@styleAfterTypeEquals"],
  256. [
  257. />/,
  258. {
  259. token: "delimiter.html",
  260. next: "@styleEmbedded.text/css",
  261. nextEmbedded: "text/css"
  262. }
  263. ],
  264. [/[ \t\r\n]+/],
  265. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  266. ],
  267. styleAfterTypeEquals: [
  268. [
  269. /@[^@]/,
  270. {
  271. token: "@rematch",
  272. switchTo: "@razorInSimpleState.styleAfterTypeEquals"
  273. }
  274. ],
  275. [
  276. /"([^"]*)"/,
  277. {
  278. token: "attribute.value",
  279. switchTo: "@styleWithCustomType.$1"
  280. }
  281. ],
  282. [
  283. /'([^']*)'/,
  284. {
  285. token: "attribute.value",
  286. switchTo: "@styleWithCustomType.$1"
  287. }
  288. ],
  289. [
  290. />/,
  291. {
  292. token: "delimiter.html",
  293. next: "@styleEmbedded.text/css",
  294. nextEmbedded: "text/css"
  295. }
  296. ],
  297. [/[ \t\r\n]+/],
  298. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  299. ],
  300. styleWithCustomType: [
  301. [
  302. /@[^@]/,
  303. {
  304. token: "@rematch",
  305. switchTo: "@razorInSimpleState.styleWithCustomType.$S2"
  306. }
  307. ],
  308. [
  309. />/,
  310. {
  311. token: "delimiter.html",
  312. next: "@styleEmbedded.$S2",
  313. nextEmbedded: "$S2"
  314. }
  315. ],
  316. [/"([^"]*)"/, "attribute.value"],
  317. [/'([^']*)'/, "attribute.value"],
  318. [/[\w\-]+/, "attribute.name"],
  319. [/=/, "delimiter"],
  320. [/[ \t\r\n]+/],
  321. [/<\/style\s*>/, { token: "@rematch", next: "@pop" }]
  322. ],
  323. styleEmbedded: [
  324. [
  325. /@[^@]/,
  326. {
  327. token: "@rematch",
  328. switchTo: "@razorInEmbeddedState.styleEmbedded.$S2",
  329. nextEmbedded: "@pop"
  330. }
  331. ],
  332. [/<\/style/, { token: "@rematch", next: "@pop", nextEmbedded: "@pop" }]
  333. ],
  334. razorInSimpleState: [
  335. [/@\*/, "comment.cs", "@razorBlockCommentTopLevel"],
  336. [/@[{(]/, "metatag.cs", "@razorRootTopLevel"],
  337. [/(@)(\s*[\w]+)/, ["metatag.cs", { token: "identifier.cs", switchTo: "@$S2.$S3" }]],
  338. [/[})]/, { token: "metatag.cs", switchTo: "@$S2.$S3" }],
  339. [/\*@/, { token: "comment.cs", switchTo: "@$S2.$S3" }]
  340. ],
  341. razorInEmbeddedState: [
  342. [/@\*/, "comment.cs", "@razorBlockCommentTopLevel"],
  343. [/@[{(]/, "metatag.cs", "@razorRootTopLevel"],
  344. [
  345. /(@)(\s*[\w]+)/,
  346. [
  347. "metatag.cs",
  348. {
  349. token: "identifier.cs",
  350. switchTo: "@$S2.$S3",
  351. nextEmbedded: "$S3"
  352. }
  353. ]
  354. ],
  355. [
  356. /[})]/,
  357. {
  358. token: "metatag.cs",
  359. switchTo: "@$S2.$S3",
  360. nextEmbedded: "$S3"
  361. }
  362. ],
  363. [
  364. /\*@/,
  365. {
  366. token: "comment.cs",
  367. switchTo: "@$S2.$S3",
  368. nextEmbedded: "$S3"
  369. }
  370. ]
  371. ],
  372. razorBlockCommentTopLevel: [
  373. [/\*@/, "@rematch", "@pop"],
  374. [/[^*]+/, "comment.cs"],
  375. [/./, "comment.cs"]
  376. ],
  377. razorBlockComment: [
  378. [/\*@/, "comment.cs", "@pop"],
  379. [/[^*]+/, "comment.cs"],
  380. [/./, "comment.cs"]
  381. ],
  382. razorRootTopLevel: [
  383. [/\{/, "delimiter.bracket.cs", "@razorRoot"],
  384. [/\(/, "delimiter.parenthesis.cs", "@razorRoot"],
  385. [/[})]/, "@rematch", "@pop"],
  386. { include: "razorCommon" }
  387. ],
  388. razorRoot: [
  389. [/\{/, "delimiter.bracket.cs", "@razorRoot"],
  390. [/\(/, "delimiter.parenthesis.cs", "@razorRoot"],
  391. [/\}/, "delimiter.bracket.cs", "@pop"],
  392. [/\)/, "delimiter.parenthesis.cs", "@pop"],
  393. { include: "razorCommon" }
  394. ],
  395. razorCommon: [
  396. [
  397. /[a-zA-Z_]\w*/,
  398. {
  399. cases: {
  400. "@razorKeywords": { token: "keyword.cs" },
  401. "@default": "identifier.cs"
  402. }
  403. }
  404. ],
  405. [/[\[\]]/, "delimiter.array.cs"],
  406. [/[ \t\r\n]+/],
  407. [/\/\/.*$/, "comment.cs"],
  408. [/@\*/, "comment.cs", "@razorBlockComment"],
  409. [/"([^"]*)"/, "string.cs"],
  410. [/'([^']*)'/, "string.cs"],
  411. [/(<)([\w\-]+)(\/>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
  412. [/(<)([\w\-]+)(>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
  413. [/(<\/)([\w\-]+)(>)/, ["delimiter.html", "tag.html", "delimiter.html"]],
  414. [/[\+\-\*\%\&\|\^\~\!\=\<\>\/\?\;\:\.\,]/, "delimiter.cs"],
  415. [/\d*\d+[eE]([\-+]?\d+)?/, "number.float.cs"],
  416. [/\d*\.\d+([eE][\-+]?\d+)?/, "number.float.cs"],
  417. [/0[xX][0-9a-fA-F']*[0-9a-fA-F]/, "number.hex.cs"],
  418. [/0[0-7']*[0-7]/, "number.octal.cs"],
  419. [/0[bB][0-1']*[0-1]/, "number.binary.cs"],
  420. [/\d[\d']*/, "number.cs"],
  421. [/\d/, "number.cs"]
  422. ]
  423. },
  424. razorKeywords: [
  425. "abstract",
  426. "as",
  427. "async",
  428. "await",
  429. "base",
  430. "bool",
  431. "break",
  432. "by",
  433. "byte",
  434. "case",
  435. "catch",
  436. "char",
  437. "checked",
  438. "class",
  439. "const",
  440. "continue",
  441. "decimal",
  442. "default",
  443. "delegate",
  444. "do",
  445. "double",
  446. "descending",
  447. "explicit",
  448. "event",
  449. "extern",
  450. "else",
  451. "enum",
  452. "false",
  453. "finally",
  454. "fixed",
  455. "float",
  456. "for",
  457. "foreach",
  458. "from",
  459. "goto",
  460. "group",
  461. "if",
  462. "implicit",
  463. "in",
  464. "int",
  465. "interface",
  466. "internal",
  467. "into",
  468. "is",
  469. "lock",
  470. "long",
  471. "nameof",
  472. "new",
  473. "null",
  474. "namespace",
  475. "object",
  476. "operator",
  477. "out",
  478. "override",
  479. "orderby",
  480. "params",
  481. "private",
  482. "protected",
  483. "public",
  484. "readonly",
  485. "ref",
  486. "return",
  487. "switch",
  488. "struct",
  489. "sbyte",
  490. "sealed",
  491. "short",
  492. "sizeof",
  493. "stackalloc",
  494. "static",
  495. "string",
  496. "select",
  497. "this",
  498. "throw",
  499. "true",
  500. "try",
  501. "typeof",
  502. "uint",
  503. "ulong",
  504. "unchecked",
  505. "unsafe",
  506. "ushort",
  507. "using",
  508. "var",
  509. "virtual",
  510. "volatile",
  511. "void",
  512. "when",
  513. "while",
  514. "where",
  515. "yield",
  516. "model",
  517. "inject"
  518. ],
  519. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/
  520. };
  521. export {
  522. conf,
  523. language
  524. };