python.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.37.1(20a8d5a651d057aaed7875ad1c1f2ecf13c4e773)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/python/python", ["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/python/python.ts
  49. var python_exports = {};
  50. __export(python_exports, {
  51. conf: () => conf,
  52. language: () => language
  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/python/python.ts
  58. var conf = {
  59. comments: {
  60. lineComment: "#",
  61. blockComment: ["'''", "'''"]
  62. },
  63. brackets: [
  64. ["{", "}"],
  65. ["[", "]"],
  66. ["(", ")"]
  67. ],
  68. autoClosingPairs: [
  69. { open: "{", close: "}" },
  70. { open: "[", close: "]" },
  71. { open: "(", close: ")" },
  72. { open: '"', close: '"', notIn: ["string"] },
  73. { open: "'", close: "'", notIn: ["string", "comment"] }
  74. ],
  75. surroundingPairs: [
  76. { open: "{", close: "}" },
  77. { open: "[", close: "]" },
  78. { open: "(", close: ")" },
  79. { open: '"', close: '"' },
  80. { open: "'", close: "'" }
  81. ],
  82. onEnterRules: [
  83. {
  84. beforeText: new RegExp("^\\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async|match|case).*?:\\s*$"),
  85. action: { indentAction: monaco_editor_core_exports.languages.IndentAction.Indent }
  86. }
  87. ],
  88. folding: {
  89. offSide: true,
  90. markers: {
  91. start: new RegExp("^\\s*#region\\b"),
  92. end: new RegExp("^\\s*#endregion\\b")
  93. }
  94. }
  95. };
  96. var language = {
  97. defaultToken: "",
  98. tokenPostfix: ".python",
  99. keywords: [
  100. "False",
  101. "None",
  102. "True",
  103. "_",
  104. "and",
  105. "as",
  106. "assert",
  107. "async",
  108. "await",
  109. "break",
  110. "case",
  111. "class",
  112. "continue",
  113. "def",
  114. "del",
  115. "elif",
  116. "else",
  117. "except",
  118. "exec",
  119. "finally",
  120. "for",
  121. "from",
  122. "global",
  123. "if",
  124. "import",
  125. "in",
  126. "is",
  127. "lambda",
  128. "match",
  129. "nonlocal",
  130. "not",
  131. "or",
  132. "pass",
  133. "print",
  134. "raise",
  135. "return",
  136. "try",
  137. "while",
  138. "with",
  139. "yield",
  140. "int",
  141. "float",
  142. "long",
  143. "complex",
  144. "hex",
  145. "abs",
  146. "all",
  147. "any",
  148. "apply",
  149. "basestring",
  150. "bin",
  151. "bool",
  152. "buffer",
  153. "bytearray",
  154. "callable",
  155. "chr",
  156. "classmethod",
  157. "cmp",
  158. "coerce",
  159. "compile",
  160. "complex",
  161. "delattr",
  162. "dict",
  163. "dir",
  164. "divmod",
  165. "enumerate",
  166. "eval",
  167. "execfile",
  168. "file",
  169. "filter",
  170. "format",
  171. "frozenset",
  172. "getattr",
  173. "globals",
  174. "hasattr",
  175. "hash",
  176. "help",
  177. "id",
  178. "input",
  179. "intern",
  180. "isinstance",
  181. "issubclass",
  182. "iter",
  183. "len",
  184. "locals",
  185. "list",
  186. "map",
  187. "max",
  188. "memoryview",
  189. "min",
  190. "next",
  191. "object",
  192. "oct",
  193. "open",
  194. "ord",
  195. "pow",
  196. "print",
  197. "property",
  198. "reversed",
  199. "range",
  200. "raw_input",
  201. "reduce",
  202. "reload",
  203. "repr",
  204. "reversed",
  205. "round",
  206. "self",
  207. "set",
  208. "setattr",
  209. "slice",
  210. "sorted",
  211. "staticmethod",
  212. "str",
  213. "sum",
  214. "super",
  215. "tuple",
  216. "type",
  217. "unichr",
  218. "unicode",
  219. "vars",
  220. "xrange",
  221. "zip",
  222. "__dict__",
  223. "__methods__",
  224. "__members__",
  225. "__class__",
  226. "__bases__",
  227. "__name__",
  228. "__mro__",
  229. "__subclasses__",
  230. "__init__",
  231. "__import__"
  232. ],
  233. brackets: [
  234. { open: "{", close: "}", token: "delimiter.curly" },
  235. { open: "[", close: "]", token: "delimiter.bracket" },
  236. { open: "(", close: ")", token: "delimiter.parenthesis" }
  237. ],
  238. tokenizer: {
  239. root: [
  240. { include: "@whitespace" },
  241. { include: "@numbers" },
  242. { include: "@strings" },
  243. [/[,:;]/, "delimiter"],
  244. [/[{}\[\]()]/, "@brackets"],
  245. [/@[a-zA-Z_]\w*/, "tag"],
  246. [
  247. /[a-zA-Z_]\w*/,
  248. {
  249. cases: {
  250. "@keywords": "keyword",
  251. "@default": "identifier"
  252. }
  253. }
  254. ]
  255. ],
  256. whitespace: [
  257. [/\s+/, "white"],
  258. [/(^#.*$)/, "comment"],
  259. [/'''/, "string", "@endDocString"],
  260. [/"""/, "string", "@endDblDocString"]
  261. ],
  262. endDocString: [
  263. [/[^']+/, "string"],
  264. [/\\'/, "string"],
  265. [/'''/, "string", "@popall"],
  266. [/'/, "string"]
  267. ],
  268. endDblDocString: [
  269. [/[^"]+/, "string"],
  270. [/\\"/, "string"],
  271. [/"""/, "string", "@popall"],
  272. [/"/, "string"]
  273. ],
  274. numbers: [
  275. [/-?0x([abcdef]|[ABCDEF]|\d)+[lL]?/, "number.hex"],
  276. [/-?(\d*\.)?\d+([eE][+\-]?\d+)?[jJ]?[lL]?/, "number"]
  277. ],
  278. strings: [
  279. [/'$/, "string.escape", "@popall"],
  280. [/'/, "string.escape", "@stringBody"],
  281. [/"$/, "string.escape", "@popall"],
  282. [/"/, "string.escape", "@dblStringBody"]
  283. ],
  284. stringBody: [
  285. [/[^\\']+$/, "string", "@popall"],
  286. [/[^\\']+/, "string"],
  287. [/\\./, "string"],
  288. [/'/, "string.escape", "@popall"],
  289. [/\\$/, "string"]
  290. ],
  291. dblStringBody: [
  292. [/[^\\"]+$/, "string", "@popall"],
  293. [/[^\\"]+/, "string"],
  294. [/\\./, "string"],
  295. [/"/, "string.escape", "@popall"],
  296. [/\\$/, "string"]
  297. ]
  298. }
  299. };
  300. return __toCommonJS(python_exports);
  301. })();
  302. return moduleExports;
  303. });