javascript.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/javascript/javascript", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __create = Object.create;
  11. var __defProp = Object.defineProperty;
  12. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  13. var __getOwnPropNames = Object.getOwnPropertyNames;
  14. var __getProtoOf = Object.getPrototypeOf;
  15. var __hasOwnProp = Object.prototype.hasOwnProperty;
  16. var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
  17. get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
  18. }) : x)(function(x) {
  19. if (typeof require !== "undefined")
  20. return require.apply(this, arguments);
  21. throw new Error('Dynamic require of "' + x + '" is not supported');
  22. });
  23. var __commonJS = (cb, mod) => function __require2() {
  24. return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
  25. };
  26. var __export = (target, all) => {
  27. for (var name in all)
  28. __defProp(target, name, { get: all[name], enumerable: true });
  29. };
  30. var __copyProps = (to, from, except, desc) => {
  31. if (from && typeof from === "object" || typeof from === "function") {
  32. for (let key of __getOwnPropNames(from))
  33. if (!__hasOwnProp.call(to, key) && key !== except)
  34. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  35. }
  36. return to;
  37. };
  38. var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
  39. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
  40. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  41. // src/fillers/monaco-editor-core-amd.ts
  42. var require_monaco_editor_core_amd = __commonJS({
  43. "src/fillers/monaco-editor-core-amd.ts"(exports, module) {
  44. var api = __toESM(__require("vs/editor/editor.api"));
  45. module.exports = api;
  46. }
  47. });
  48. // src/basic-languages/javascript/javascript.ts
  49. var javascript_exports = {};
  50. __export(javascript_exports, {
  51. conf: () => conf2,
  52. language: () => language2
  53. });
  54. // src/fillers/monaco-editor-core.ts
  55. var monaco_editor_core_exports = {};
  56. __reExport(monaco_editor_core_exports, __toESM(require_monaco_editor_core_amd()));
  57. // src/basic-languages/typescript/typescript.ts
  58. var conf = {
  59. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
  60. comments: {
  61. lineComment: "//",
  62. blockComment: ["/*", "*/"]
  63. },
  64. brackets: [
  65. ["{", "}"],
  66. ["[", "]"],
  67. ["(", ")"]
  68. ],
  69. onEnterRules: [
  70. {
  71. beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
  72. afterText: /^\s*\*\/$/,
  73. action: {
  74. indentAction: monaco_editor_core_exports.languages.IndentAction.IndentOutdent,
  75. appendText: " * "
  76. }
  77. },
  78. {
  79. beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
  80. action: {
  81. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  82. appendText: " * "
  83. }
  84. },
  85. {
  86. beforeText: /^(\t|(\ \ ))*\ \*(\ ([^\*]|\*(?!\/))*)?$/,
  87. action: {
  88. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  89. appendText: "* "
  90. }
  91. },
  92. {
  93. beforeText: /^(\t|(\ \ ))*\ \*\/\s*$/,
  94. action: {
  95. indentAction: monaco_editor_core_exports.languages.IndentAction.None,
  96. removeText: 1
  97. }
  98. }
  99. ],
  100. autoClosingPairs: [
  101. { open: "{", close: "}" },
  102. { open: "[", close: "]" },
  103. { open: "(", close: ")" },
  104. { open: '"', close: '"', notIn: ["string"] },
  105. { open: "'", close: "'", notIn: ["string", "comment"] },
  106. { open: "`", close: "`", notIn: ["string", "comment"] },
  107. { open: "/**", close: " */", notIn: ["string"] }
  108. ],
  109. folding: {
  110. markers: {
  111. start: new RegExp("^\\s*//\\s*#?region\\b"),
  112. end: new RegExp("^\\s*//\\s*#?endregion\\b")
  113. }
  114. }
  115. };
  116. var language = {
  117. defaultToken: "invalid",
  118. tokenPostfix: ".ts",
  119. keywords: [
  120. "abstract",
  121. "any",
  122. "as",
  123. "asserts",
  124. "bigint",
  125. "boolean",
  126. "break",
  127. "case",
  128. "catch",
  129. "class",
  130. "continue",
  131. "const",
  132. "constructor",
  133. "debugger",
  134. "declare",
  135. "default",
  136. "delete",
  137. "do",
  138. "else",
  139. "enum",
  140. "export",
  141. "extends",
  142. "false",
  143. "finally",
  144. "for",
  145. "from",
  146. "function",
  147. "get",
  148. "if",
  149. "implements",
  150. "import",
  151. "in",
  152. "infer",
  153. "instanceof",
  154. "interface",
  155. "is",
  156. "keyof",
  157. "let",
  158. "module",
  159. "namespace",
  160. "never",
  161. "new",
  162. "null",
  163. "number",
  164. "object",
  165. "out",
  166. "package",
  167. "private",
  168. "protected",
  169. "public",
  170. "override",
  171. "readonly",
  172. "require",
  173. "global",
  174. "return",
  175. "satisfies",
  176. "set",
  177. "static",
  178. "string",
  179. "super",
  180. "switch",
  181. "symbol",
  182. "this",
  183. "throw",
  184. "true",
  185. "try",
  186. "type",
  187. "typeof",
  188. "undefined",
  189. "unique",
  190. "unknown",
  191. "var",
  192. "void",
  193. "while",
  194. "with",
  195. "yield",
  196. "async",
  197. "await",
  198. "of"
  199. ],
  200. operators: [
  201. "<=",
  202. ">=",
  203. "==",
  204. "!=",
  205. "===",
  206. "!==",
  207. "=>",
  208. "+",
  209. "-",
  210. "**",
  211. "*",
  212. "/",
  213. "%",
  214. "++",
  215. "--",
  216. "<<",
  217. "</",
  218. ">>",
  219. ">>>",
  220. "&",
  221. "|",
  222. "^",
  223. "!",
  224. "~",
  225. "&&",
  226. "||",
  227. "??",
  228. "?",
  229. ":",
  230. "=",
  231. "+=",
  232. "-=",
  233. "*=",
  234. "**=",
  235. "/=",
  236. "%=",
  237. "<<=",
  238. ">>=",
  239. ">>>=",
  240. "&=",
  241. "|=",
  242. "^=",
  243. "@"
  244. ],
  245. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  246. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  247. digits: /\d+(_+\d+)*/,
  248. octaldigits: /[0-7]+(_+[0-7]+)*/,
  249. binarydigits: /[0-1]+(_+[0-1]+)*/,
  250. hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
  251. regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
  252. regexpesc: /\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,
  253. tokenizer: {
  254. root: [[/[{}]/, "delimiter.bracket"], { include: "common" }],
  255. common: [
  256. [
  257. /[a-z_$][\w$]*/,
  258. {
  259. cases: {
  260. "@keywords": "keyword",
  261. "@default": "identifier"
  262. }
  263. }
  264. ],
  265. [/[A-Z][\w\$]*/, "type.identifier"],
  266. { include: "@whitespace" },
  267. [
  268. /\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,
  269. { token: "regexp", bracket: "@open", next: "@regexp" }
  270. ],
  271. [/[()\[\]]/, "@brackets"],
  272. [/[<>](?!@symbols)/, "@brackets"],
  273. [/!(?=([^=]|$))/, "delimiter"],
  274. [
  275. /@symbols/,
  276. {
  277. cases: {
  278. "@operators": "delimiter",
  279. "@default": ""
  280. }
  281. }
  282. ],
  283. [/(@digits)[eE]([\-+]?(@digits))?/, "number.float"],
  284. [/(@digits)\.(@digits)([eE][\-+]?(@digits))?/, "number.float"],
  285. [/0[xX](@hexdigits)n?/, "number.hex"],
  286. [/0[oO]?(@octaldigits)n?/, "number.octal"],
  287. [/0[bB](@binarydigits)n?/, "number.binary"],
  288. [/(@digits)n?/, "number"],
  289. [/[;,.]/, "delimiter"],
  290. [/"([^"\\]|\\.)*$/, "string.invalid"],
  291. [/'([^'\\]|\\.)*$/, "string.invalid"],
  292. [/"/, "string", "@string_double"],
  293. [/'/, "string", "@string_single"],
  294. [/`/, "string", "@string_backtick"]
  295. ],
  296. whitespace: [
  297. [/[ \t\r\n]+/, ""],
  298. [/\/\*\*(?!\/)/, "comment.doc", "@jsdoc"],
  299. [/\/\*/, "comment", "@comment"],
  300. [/\/\/.*$/, "comment"]
  301. ],
  302. comment: [
  303. [/[^\/*]+/, "comment"],
  304. [/\*\//, "comment", "@pop"],
  305. [/[\/*]/, "comment"]
  306. ],
  307. jsdoc: [
  308. [/[^\/*]+/, "comment.doc"],
  309. [/\*\//, "comment.doc", "@pop"],
  310. [/[\/*]/, "comment.doc"]
  311. ],
  312. regexp: [
  313. [
  314. /(\{)(\d+(?:,\d*)?)(\})/,
  315. ["regexp.escape.control", "regexp.escape.control", "regexp.escape.control"]
  316. ],
  317. [
  318. /(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,
  319. ["regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
  320. ],
  321. [/(\()(\?:|\?=|\?!)/, ["regexp.escape.control", "regexp.escape.control"]],
  322. [/[()]/, "regexp.escape.control"],
  323. [/@regexpctl/, "regexp.escape.control"],
  324. [/[^\\\/]/, "regexp"],
  325. [/@regexpesc/, "regexp.escape"],
  326. [/\\\./, "regexp.invalid"],
  327. [/(\/)([dgimsuy]*)/, [{ token: "regexp", bracket: "@close", next: "@pop" }, "keyword.other"]]
  328. ],
  329. regexrange: [
  330. [/-/, "regexp.escape.control"],
  331. [/\^/, "regexp.invalid"],
  332. [/@regexpesc/, "regexp.escape"],
  333. [/[^\]]/, "regexp"],
  334. [
  335. /\]/,
  336. {
  337. token: "regexp.escape.control",
  338. next: "@pop",
  339. bracket: "@close"
  340. }
  341. ]
  342. ],
  343. string_double: [
  344. [/[^\\"]+/, "string"],
  345. [/@escapes/, "string.escape"],
  346. [/\\./, "string.escape.invalid"],
  347. [/"/, "string", "@pop"]
  348. ],
  349. string_single: [
  350. [/[^\\']+/, "string"],
  351. [/@escapes/, "string.escape"],
  352. [/\\./, "string.escape.invalid"],
  353. [/'/, "string", "@pop"]
  354. ],
  355. string_backtick: [
  356. [/\$\{/, { token: "delimiter.bracket", next: "@bracketCounting" }],
  357. [/[^\\`$]+/, "string"],
  358. [/@escapes/, "string.escape"],
  359. [/\\./, "string.escape.invalid"],
  360. [/`/, "string", "@pop"]
  361. ],
  362. bracketCounting: [
  363. [/\{/, "delimiter.bracket", "@bracketCounting"],
  364. [/\}/, "delimiter.bracket", "@pop"],
  365. { include: "common" }
  366. ]
  367. }
  368. };
  369. // src/basic-languages/javascript/javascript.ts
  370. var conf2 = conf;
  371. var language2 = {
  372. defaultToken: "invalid",
  373. tokenPostfix: ".js",
  374. keywords: [
  375. "break",
  376. "case",
  377. "catch",
  378. "class",
  379. "continue",
  380. "const",
  381. "constructor",
  382. "debugger",
  383. "default",
  384. "delete",
  385. "do",
  386. "else",
  387. "export",
  388. "extends",
  389. "false",
  390. "finally",
  391. "for",
  392. "from",
  393. "function",
  394. "get",
  395. "if",
  396. "import",
  397. "in",
  398. "instanceof",
  399. "let",
  400. "new",
  401. "null",
  402. "return",
  403. "set",
  404. "super",
  405. "switch",
  406. "symbol",
  407. "this",
  408. "throw",
  409. "true",
  410. "try",
  411. "typeof",
  412. "undefined",
  413. "var",
  414. "void",
  415. "while",
  416. "with",
  417. "yield",
  418. "async",
  419. "await",
  420. "of"
  421. ],
  422. typeKeywords: [],
  423. operators: language.operators,
  424. symbols: language.symbols,
  425. escapes: language.escapes,
  426. digits: language.digits,
  427. octaldigits: language.octaldigits,
  428. binarydigits: language.binarydigits,
  429. hexdigits: language.hexdigits,
  430. regexpctl: language.regexpctl,
  431. regexpesc: language.regexpesc,
  432. tokenizer: language.tokenizer
  433. };
  434. return __toCommonJS(javascript_exports);
  435. })();
  436. return moduleExports;
  437. });