a830489d434d9c0c3071cd0bbf1db773cdecdfe2e755f3ed87a54869e7ee4345a7b86df07034b4ca172a369161c32f9e7b8479286106c19c67d07f8784fd87 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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/typescript/typescript.ts
  25. var conf = {
  26. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
  27. comments: {
  28. lineComment: "//",
  29. blockComment: ["/*", "*/"]
  30. },
  31. brackets: [
  32. ["{", "}"],
  33. ["[", "]"],
  34. ["(", ")"]
  35. ],
  36. onEnterRules: [
  37. {
  38. beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
  39. afterText: /^\s*\*\/$/,
  40. action: {
  41. indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent,
  42. appendText: " * "
  43. }
  44. },
  45. {
  46. beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
  47. action: {
  48. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  49. appendText: " * "
  50. }
  51. },
  52. {
  53. beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
  54. action: {
  55. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  56. appendText: "* "
  57. }
  58. },
  59. {
  60. beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
  61. action: {
  62. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  63. removeText: 1
  64. }
  65. }
  66. ],
  67. autoClosingPairs: [
  68. { open: "{", close: "}" },
  69. { open: "[", close: "]" },
  70. { open: "(", close: ")" },
  71. { open: '"', close: '"', notIn: ["string"] },
  72. { open: "'", close: "'", notIn: ["string", "comment"] },
  73. { open: "`", close: "`", notIn: ["string", "comment"] },
  74. { open: "/**", close: " */", notIn: ["string"] }
  75. ],
  76. folding: {
  77. markers: {
  78. start: new RegExp("^\\s*//\\s*#?region\\b"),
  79. end: new RegExp("^\\s*//\\s*#?endregion\\b")
  80. }
  81. }
  82. };
  83. var language = {
  84. defaultToken: "invalid",
  85. tokenPostfix: ".ts",
  86. keywords: [
  87. "abstract",
  88. "any",
  89. "as",
  90. "asserts",
  91. "bigint",
  92. "boolean",
  93. "break",
  94. "case",
  95. "catch",
  96. "class",
  97. "continue",
  98. "const",
  99. "constructor",
  100. "debugger",
  101. "declare",
  102. "default",
  103. "delete",
  104. "do",
  105. "else",
  106. "enum",
  107. "export",
  108. "extends",
  109. "false",
  110. "finally",
  111. "for",
  112. "from",
  113. "function",
  114. "get",
  115. "if",
  116. "implements",
  117. "import",
  118. "in",
  119. "infer",
  120. "instanceof",
  121. "interface",
  122. "is",
  123. "keyof",
  124. "let",
  125. "module",
  126. "namespace",
  127. "never",
  128. "new",
  129. "null",
  130. "number",
  131. "object",
  132. "out",
  133. "package",
  134. "private",
  135. "protected",
  136. "public",
  137. "override",
  138. "readonly",
  139. "require",
  140. "global",
  141. "return",
  142. "set",
  143. "static",
  144. "string",
  145. "super",
  146. "switch",
  147. "symbol",
  148. "this",
  149. "throw",
  150. "true",
  151. "try",
  152. "type",
  153. "typeof",
  154. "undefined",
  155. "unique",
  156. "unknown",
  157. "var",
  158. "void",
  159. "while",
  160. "with",
  161. "yield",
  162. "async",
  163. "await",
  164. "of"
  165. ],
  166. operators: [
  167. "<=",
  168. ">=",
  169. "==",
  170. "!=",
  171. "===",
  172. "!==",
  173. "=>",
  174. "+",
  175. "-",
  176. "**",
  177. "*",
  178. "/",
  179. "%",
  180. "++",
  181. "--",
  182. "<<",
  183. "</",
  184. ">>",
  185. ">>>",
  186. "&",
  187. "|",
  188. "^",
  189. "!",
  190. "~",
  191. "&&",
  192. "||",
  193. "??",
  194. "?",
  195. ":",
  196. "=",
  197. "+=",
  198. "-=",
  199. "*=",
  200. "**=",
  201. "/=",
  202. "%=",
  203. "<<=",
  204. ">>=",
  205. ">>>=",
  206. "&=",
  207. "|=",
  208. "^=",
  209. "@"
  210. ],
  211. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  212. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  213. digits: /\d+(_+\d+)*/,
  214. octaldigits: /[0-7]+(_+[0-7]+)*/,
  215. binarydigits: /[0-1]+(_+[0-1]+)*/,
  216. hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
  217. regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
  218. regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
  219. tokenizer: {
  220. root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
  221. common: [
  222. [
  223. /[a-z_$][\w$]*/,
  224. {
  225. cases: {
  226. "@keywords": "keyword",
  227. "@default": "identifier"
  228. }
  229. }
  230. ],
  231. [/[A-Z][\w\$]*/, "type.identifier"],
  232. { include: "@whitespace" },
  233. [
  234. /\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
  235. { token: "regexp", bracket: "@open", next: "@regexp" }
  236. ],
  237. [/[()\[\]]/, "@brackets"],
  238. [/[<>](?!@symbols)/, "@brackets"],
  239. [/!(?=([^=]|$))/, "delimiter"],
  240. [
  241. /@symbols/,
  242. {
  243. cases: {
  244. "@operators": "delimiter",
  245. "@default": ""
  246. }
  247. }
  248. ],
  249. [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
  250. [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
  251. [/0[xX](@hexdigits)n?/, "number.hex"],
  252. [/0[oO]?(@octaldigits)n?/, "number.octal"],
  253. [/0[bB](@binarydigits)n?/, "number.binary"],
  254. [/(@digits)n?/, "number"],
  255. [/[;,.]/, "delimiter"],
  256. [/"([^"\\]|\\.)*$/, "string.invalid"],
  257. [/'([^'\\]|\\.)*$/, "string.invalid"],
  258. [/"/, "string", "@string_double"],
  259. [/'/, "string", "@string_single"],
  260. [/`/, "string", "@string_backtick"]
  261. ],
  262. whitespace: [
  263. [/[ \t\r\n]+/, ""],
  264. [/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
  265. [/\/\*/, "comment", "@comment"],
  266. [/\/\/.*$/, "comment"]
  267. ],
  268. comment: [
  269. [/[^\/*]+/, "comment"],
  270. [/\*\//, "comment", "@pop"],
  271. [/[\/*]/, "comment"]
  272. ],
  273. jsdoc: [
  274. [/[^\/*]+/, "comment.doc"],
  275. [/\*\//, "comment.doc", "@pop"],
  276. [/[\/*]/, "comment.doc"]
  277. ],
  278. regexp: [
  279. [
  280. /(\{)(\d+(?:,\d*)?)(\})/,
  281. ["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
  282. ],
  283. [
  284. /(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
  285. ["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
  286. ],
  287. [/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
  288. [/[()]/, "regexp.escape.control"],
  289. [/@regexpctl/, "regexp.escape.control"],
  290. [/[^\\\/]/, "regexp"],
  291. [/@regexpesc/, "regexp.escape"],
  292. [/\\\./, "regexp.invalid"],
  293. [/(\/)([dgimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
  294. ],
  295. regexrange: [
  296. [/-/, "regexp.escape.control"],
  297. [/\^/, "regexp.invalid"],
  298. [/@regexpesc/, "regexp.escape"],
  299. [/[^\]]/, "regexp"],
  300. [
  301. /\]/,
  302. {
  303. token: "regexp.escape.control",
  304. next: "@pop",
  305. bracket: "@close"
  306. }
  307. ]
  308. ],
  309. string_double: [
  310. [/[^\\"]+/, "string"],
  311. [/@escapes/, "string.escape"],
  312. [/\\./, "string.escape.invalid"],
  313. [/"/, "string", "@pop"]
  314. ],
  315. string_single: [
  316. [/[^\\']+/, "string"],
  317. [/@escapes/, "string.escape"],
  318. [/\\./, "string.escape.invalid"],
  319. [/'/, "string", "@pop"]
  320. ],
  321. string_backtick: [
  322. [/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
  323. [/[^\\`$]+/, "string"],
  324. [/@escapes/, "string.escape"],
  325. [/\\./, "string.escape.invalid"],
  326. [/`/, "string", "@pop"]
  327. ],
  328. bracketCounting: [
  329. [/\{/, "delimiter.bracket", "@bracketCounting"],
  330. [/\}/, "delimiter.bracket", "@pop"],
  331. { include: "common" }
  332. ]
  333. }
  334. };
  335. export {
  336. conf,
  337. language
  338. };