kotlin.js 6.0 KB

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