1
0

kotlin.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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/kotlin/kotlin", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/kotlin/kotlin.ts
  28. var kotlin_exports = {};
  29. __export(kotlin_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
  35. comments: {
  36. lineComment: "//",
  37. blockComment: ["/*", "*/"]
  38. },
  39. brackets: [
  40. ["{", "}"],
  41. ["[", "]"],
  42. ["(", ")"]
  43. ],
  44. autoClosingPairs: [
  45. { open: "{", close: "}" },
  46. { open: "[", close: "]" },
  47. { open: "(", close: ")" },
  48. { open: '"', close: '"' },
  49. { open: "'", close: "'" }
  50. ],
  51. surroundingPairs: [
  52. { open: "{", close: "}" },
  53. { open: "[", close: "]" },
  54. { open: "(", close: ")" },
  55. { open: '"', close: '"' },
  56. { open: "'", close: "'" },
  57. { open: "<", close: ">" }
  58. ],
  59. folding: {
  60. markers: {
  61. start: new RegExp("^\\s*//\\s*(?:(?:#?region\\b)|(?:<editor-fold\\b))"),
  62. end: new RegExp("^\\s*//\\s*(?:(?:#?endregion\\b)|(?:</editor-fold>))")
  63. }
  64. }
  65. };
  66. var language = {
  67. defaultToken: "",
  68. tokenPostfix: ".kt",
  69. keywords: [
  70. "as",
  71. "as?",
  72. "break",
  73. "class",
  74. "continue",
  75. "do",
  76. "else",
  77. "false",
  78. "for",
  79. "fun",
  80. "if",
  81. "in",
  82. "!in",
  83. "interface",
  84. "is",
  85. "!is",
  86. "null",
  87. "object",
  88. "package",
  89. "return",
  90. "super",
  91. "this",
  92. "throw",
  93. "true",
  94. "try",
  95. "typealias",
  96. "val",
  97. "var",
  98. "when",
  99. "while",
  100. "by",
  101. "catch",
  102. "constructor",
  103. "delegate",
  104. "dynamic",
  105. "field",
  106. "file",
  107. "finally",
  108. "get",
  109. "import",
  110. "init",
  111. "param",
  112. "property",
  113. "receiver",
  114. "set",
  115. "setparam",
  116. "where",
  117. "actual",
  118. "abstract",
  119. "annotation",
  120. "companion",
  121. "const",
  122. "crossinline",
  123. "data",
  124. "enum",
  125. "expect",
  126. "external",
  127. "final",
  128. "infix",
  129. "inline",
  130. "inner",
  131. "internal",
  132. "lateinit",
  133. "noinline",
  134. "open",
  135. "operator",
  136. "out",
  137. "override",
  138. "private",
  139. "protected",
  140. "public",
  141. "reified",
  142. "sealed",
  143. "suspend",
  144. "tailrec",
  145. "vararg",
  146. "field",
  147. "it"
  148. ],
  149. operators: [
  150. "+",
  151. "-",
  152. "*",
  153. "/",
  154. "%",
  155. "=",
  156. "+=",
  157. "-=",
  158. "*=",
  159. "/=",
  160. "%=",
  161. "++",
  162. "--",
  163. "&&",
  164. "||",
  165. "!",
  166. "==",
  167. "!=",
  168. "===",
  169. "!==",
  170. ">",
  171. "<",
  172. "<=",
  173. ">=",
  174. "[",
  175. "]",
  176. "!!",
  177. "?.",
  178. "?:",
  179. "::",
  180. "..",
  181. ":",
  182. "?",
  183. "->",
  184. "@",
  185. ";",
  186. "$",
  187. "_"
  188. ],
  189. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  190. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  191. digits: /\d+(_+\d+)*/,
  192. octaldigits: /[0-7]+(_+[0-7]+)*/,
  193. binarydigits: /[0-1]+(_+[0-1]+)*/,
  194. hexdigits: /[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,
  195. tokenizer: {
  196. root: [
  197. [/[A-Z][\w\$]*/, "type.identifier"],
  198. [
  199. /[a-zA-Z_$][\w$]*/,
  200. {
  201. cases: {
  202. "@keywords": { token: "keyword.$0" },
  203. "@default": "identifier"
  204. }
  205. }
  206. ],
  207. { include: "@whitespace" },
  208. [/[{}()\[\]]/, "@brackets"],
  209. [/[<>](?!@symbols)/, "@brackets"],
  210. [
  211. /@symbols/,
  212. {
  213. cases: {
  214. "@operators": "delimiter",
  215. "@default": ""
  216. }
  217. }
  218. ],
  219. [/@\s*[a-zA-Z_\$][\w\$]*/, "annotation"],
  220. [/(@digits)[eE]([\-+]?(@digits))?[fFdD]?/, "number.float"],
  221. [/(@digits)\.(@digits)([eE][\-+]?(@digits))?[fFdD]?/, "number.float"],
  222. [/0[xX](@hexdigits)[Ll]?/, "number.hex"],
  223. [/0(@octaldigits)[Ll]?/, "number.octal"],
  224. [/0[bB](@binarydigits)[Ll]?/, "number.binary"],
  225. [/(@digits)[fFdD]/, "number.float"],
  226. [/(@digits)[lL]?/, "number"],
  227. [/[;,.]/, "delimiter"],
  228. [/"([^"\\]|\\.)*$/, "string.invalid"],
  229. [/"""/, "string", "@multistring"],
  230. [/"/, "string", "@string"],
  231. [/'[^\\']'/, "string"],
  232. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  233. [/'/, "string.invalid"]
  234. ],
  235. whitespace: [
  236. [/[ \t\r\n]+/, ""],
  237. [/\/\*\*(?!\/)/, "comment.doc", "@javadoc"],
  238. [/\/\*/, "comment", "@comment"],
  239. [/\/\/.*$/, "comment"]
  240. ],
  241. comment: [
  242. [/[^\/*]+/, "comment"],
  243. [/\/\*/, "comment", "@comment"],
  244. [/\*\//, "comment", "@pop"],
  245. [/[\/*]/, "comment"]
  246. ],
  247. javadoc: [
  248. [/[^\/*]+/, "comment.doc"],
  249. [/\/\*/, "comment.doc", "@push"],
  250. [/\/\*/, "comment.doc.invalid"],
  251. [/\*\//, "comment.doc", "@pop"],
  252. [/[\/*]/, "comment.doc"]
  253. ],
  254. string: [
  255. [/[^\\"]+/, "string"],
  256. [/@escapes/, "string.escape"],
  257. [/\\./, "string.escape.invalid"],
  258. [/"/, "string", "@pop"]
  259. ],
  260. multistring: [
  261. [/[^\\"]+/, "string"],
  262. [/@escapes/, "string.escape"],
  263. [/\\./, "string.escape.invalid"],
  264. [/"""/, "string", "@pop"],
  265. [/./, "string"]
  266. ]
  267. }
  268. };
  269. return __toCommonJS(kotlin_exports);
  270. })();
  271. return moduleExports;
  272. });