csharp.js 7.9 KB

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