csharp.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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/csharp/csharp", ["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/csharp/csharp.ts
  28. var csharp_exports = {};
  29. __export(csharp_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: "'", notIn: ["string", "comment"] },
  49. { open: '"', close: '"', notIn: ["string", "comment"] }
  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*#region\\b"),
  62. end: new RegExp("^\\s*#endregion\\b")
  63. }
  64. }
  65. };
  66. var language = {
  67. defaultToken: "",
  68. tokenPostfix: ".cs",
  69. brackets: [
  70. { open: "{", close: "}", token: "delimiter.curly" },
  71. { open: "[", close: "]", token: "delimiter.square" },
  72. { open: "(", close: ")", token: "delimiter.parenthesis" },
  73. { open: "<", close: ">", token: "delimiter.angle" }
  74. ],
  75. keywords: [
  76. "extern",
  77. "alias",
  78. "using",
  79. "bool",
  80. "decimal",
  81. "sbyte",
  82. "byte",
  83. "short",
  84. "ushort",
  85. "int",
  86. "uint",
  87. "long",
  88. "ulong",
  89. "char",
  90. "float",
  91. "double",
  92. "object",
  93. "dynamic",
  94. "string",
  95. "assembly",
  96. "is",
  97. "as",
  98. "ref",
  99. "out",
  100. "this",
  101. "base",
  102. "new",
  103. "typeof",
  104. "void",
  105. "checked",
  106. "unchecked",
  107. "default",
  108. "delegate",
  109. "var",
  110. "const",
  111. "if",
  112. "else",
  113. "switch",
  114. "case",
  115. "while",
  116. "do",
  117. "for",
  118. "foreach",
  119. "in",
  120. "break",
  121. "continue",
  122. "goto",
  123. "return",
  124. "throw",
  125. "try",
  126. "catch",
  127. "finally",
  128. "lock",
  129. "yield",
  130. "from",
  131. "let",
  132. "where",
  133. "join",
  134. "on",
  135. "equals",
  136. "into",
  137. "orderby",
  138. "ascending",
  139. "descending",
  140. "select",
  141. "group",
  142. "by",
  143. "namespace",
  144. "partial",
  145. "class",
  146. "field",
  147. "event",
  148. "method",
  149. "param",
  150. "public",
  151. "protected",
  152. "internal",
  153. "private",
  154. "abstract",
  155. "sealed",
  156. "static",
  157. "struct",
  158. "readonly",
  159. "volatile",
  160. "virtual",
  161. "override",
  162. "params",
  163. "get",
  164. "set",
  165. "add",
  166. "remove",
  167. "operator",
  168. "true",
  169. "false",
  170. "implicit",
  171. "explicit",
  172. "interface",
  173. "enum",
  174. "null",
  175. "async",
  176. "await",
  177. "fixed",
  178. "sizeof",
  179. "stackalloc",
  180. "unsafe",
  181. "nameof",
  182. "when"
  183. ],
  184. namespaceFollows: ["namespace", "using"],
  185. parenFollows: ["if", "for", "while", "switch", "foreach", "using", "catch", "when"],
  186. operators: [
  187. "=",
  188. "??",
  189. "||",
  190. "&&",
  191. "|",
  192. "^",
  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. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  222. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  223. tokenizer: {
  224. root: [
  225. [
  226. /\@?[a-zA-Z_]\w*/,
  227. {
  228. cases: {
  229. "@namespaceFollows": {
  230. token: "keyword.$0",
  231. next: "@namespace"
  232. },
  233. "@keywords": {
  234. token: "keyword.$0",
  235. next: "@qualified"
  236. },
  237. "@default": { token: "identifier", next: "@qualified" }
  238. }
  239. }
  240. ],
  241. { include: "@whitespace" },
  242. [
  243. /}/,
  244. {
  245. cases: {
  246. "$S2==interpolatedstring": {
  247. token: "string.quote",
  248. next: "@pop"
  249. },
  250. "$S2==litinterpstring": {
  251. token: "string.quote",
  252. next: "@pop"
  253. },
  254. "@default": "@brackets"
  255. }
  256. }
  257. ],
  258. [/[{}()\[\]]/, "@brackets"],
  259. [/[<>](?!@symbols)/, "@brackets"],
  260. [
  261. /@symbols/,
  262. {
  263. cases: {
  264. "@operators": "delimiter",
  265. "@default": ""
  266. }
  267. }
  268. ],
  269. [/[0-9_]*\.[0-9_]+([eE][\-+]?\d+)?[fFdD]?/, "number.float"],
  270. [/0[xX][0-9a-fA-F_]+/, "number.hex"],
  271. [/0[bB][01_]+/, "number.hex"],
  272. [/[0-9_]+/, "number"],
  273. [/[;,.]/, "delimiter"],
  274. [/"([^"\\]|\\.)*$/, "string.invalid"],
  275. [/"/, { token: "string.quote", next: "@string" }],
  276. [/\$\@"/, { token: "string.quote", next: "@litinterpstring" }],
  277. [/\@"/, { token: "string.quote", next: "@litstring" }],
  278. [/\$"/, { token: "string.quote", next: "@interpolatedstring" }],
  279. [/'[^\\']'/, "string"],
  280. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  281. [/'/, "string.invalid"]
  282. ],
  283. qualified: [
  284. [
  285. /[a-zA-Z_][\w]*/,
  286. {
  287. cases: {
  288. "@keywords": { token: "keyword.$0" },
  289. "@default": "identifier"
  290. }
  291. }
  292. ],
  293. [/\./, "delimiter"],
  294. ["", "", "@pop"]
  295. ],
  296. namespace: [
  297. { include: "@whitespace" },
  298. [/[A-Z]\w*/, "namespace"],
  299. [/[\.=]/, "delimiter"],
  300. ["", "", "@pop"]
  301. ],
  302. comment: [
  303. [/[^\/*]+/, "comment"],
  304. ["\\*/", "comment", "@pop"],
  305. [/[\/*]/, "comment"]
  306. ],
  307. string: [
  308. [/[^\\"]+/, "string"],
  309. [/@escapes/, "string.escape"],
  310. [/\\./, "string.escape.invalid"],
  311. [/"/, { token: "string.quote", next: "@pop" }]
  312. ],
  313. litstring: [
  314. [/[^"]+/, "string"],
  315. [/""/, "string.escape"],
  316. [/"/, { token: "string.quote", next: "@pop" }]
  317. ],
  318. litinterpstring: [
  319. [/[^"{]+/, "string"],
  320. [/""/, "string.escape"],
  321. [/{{/, "string.escape"],
  322. [/}}/, "string.escape"],
  323. [/{/, { token: "string.quote", next: "root.litinterpstring" }],
  324. [/"/, { token: "string.quote", next: "@pop" }]
  325. ],
  326. interpolatedstring: [
  327. [/[^\\"{]+/, "string"],
  328. [/@escapes/, "string.escape"],
  329. [/\\./, "string.escape.invalid"],
  330. [/{{/, "string.escape"],
  331. [/}}/, "string.escape"],
  332. [/{/, { token: "string.quote", next: "root.interpolatedstring" }],
  333. [/"/, { token: "string.quote", next: "@pop" }]
  334. ],
  335. whitespace: [
  336. [/^[ \t\v\f]*#((r)|(load))(?=\s)/, "directive.csx"],
  337. [/^[ \t\v\f]*#\w.*$/, "namespace.cpp"],
  338. [/[ \t\v\f\r\n]+/, ""],
  339. [/\/\*/, "comment", "@comment"],
  340. [/\/\/.*$/, "comment"]
  341. ]
  342. }
  343. };
  344. return __toCommonJS(csharp_exports);
  345. })();
  346. return moduleExports;
  347. });