javascript.js 11 KB

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