fsharp.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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/fsharp/fsharp",[],()=>{
  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/fsharp/fsharp.ts
  17. var fsharp_exports = {};
  18. __export(fsharp_exports, {
  19. conf: () => conf,
  20. language: () => language
  21. });
  22. var conf = {
  23. comments: {
  24. lineComment: "//",
  25. blockComment: ["(*", "*)"]
  26. },
  27. brackets: [
  28. ["{", "}"],
  29. ["[", "]"],
  30. ["(", ")"]
  31. ],
  32. autoClosingPairs: [
  33. { open: "{", close: "}" },
  34. { open: "[", close: "]" },
  35. { open: "(", close: ")" },
  36. { open: '"', close: '"' }
  37. ],
  38. surroundingPairs: [
  39. { open: "{", close: "}" },
  40. { open: "[", close: "]" },
  41. { open: "(", close: ")" },
  42. { open: '"', close: '"' },
  43. { open: "'", close: "'" }
  44. ],
  45. folding: {
  46. markers: {
  47. start: new RegExp("^\\s*//\\s*#region\\b|^\\s*\\(\\*\\s*#region(.*)\\*\\)"),
  48. end: new RegExp("^\\s*//\\s*#endregion\\b|^\\s*\\(\\*\\s*#endregion\\s*\\*\\)")
  49. }
  50. }
  51. };
  52. var language = {
  53. defaultToken: "",
  54. tokenPostfix: ".fs",
  55. keywords: [
  56. "abstract",
  57. "and",
  58. "atomic",
  59. "as",
  60. "assert",
  61. "asr",
  62. "base",
  63. "begin",
  64. "break",
  65. "checked",
  66. "component",
  67. "const",
  68. "constraint",
  69. "constructor",
  70. "continue",
  71. "class",
  72. "default",
  73. "delegate",
  74. "do",
  75. "done",
  76. "downcast",
  77. "downto",
  78. "elif",
  79. "else",
  80. "end",
  81. "exception",
  82. "eager",
  83. "event",
  84. "external",
  85. "extern",
  86. "false",
  87. "finally",
  88. "for",
  89. "fun",
  90. "function",
  91. "fixed",
  92. "functor",
  93. "global",
  94. "if",
  95. "in",
  96. "include",
  97. "inherit",
  98. "inline",
  99. "interface",
  100. "internal",
  101. "land",
  102. "lor",
  103. "lsl",
  104. "lsr",
  105. "lxor",
  106. "lazy",
  107. "let",
  108. "match",
  109. "member",
  110. "mod",
  111. "module",
  112. "mutable",
  113. "namespace",
  114. "method",
  115. "mixin",
  116. "new",
  117. "not",
  118. "null",
  119. "of",
  120. "open",
  121. "or",
  122. "object",
  123. "override",
  124. "private",
  125. "parallel",
  126. "process",
  127. "protected",
  128. "pure",
  129. "public",
  130. "rec",
  131. "return",
  132. "static",
  133. "sealed",
  134. "struct",
  135. "sig",
  136. "then",
  137. "to",
  138. "true",
  139. "tailcall",
  140. "trait",
  141. "try",
  142. "type",
  143. "upcast",
  144. "use",
  145. "val",
  146. "void",
  147. "virtual",
  148. "volatile",
  149. "when",
  150. "while",
  151. "with",
  152. "yield"
  153. ],
  154. symbols: /[=><!~?:&|+\-*\^%;\.,\/]+/,
  155. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  156. integersuffix: /[uU]?[yslnLI]?/,
  157. floatsuffix: /[fFmM]?/,
  158. tokenizer: {
  159. root: [
  160. [
  161. /[a-zA-Z_]\w*/,
  162. {
  163. cases: {
  164. "@keywords": { token: "keyword.$0" },
  165. "@default": "identifier"
  166. }
  167. }
  168. ],
  169. { include: "@whitespace" },
  170. [/\[<.*>\]/, "annotation"],
  171. [/^#(if|else|endif)/, "keyword"],
  172. [/[{}()\[\]]/, "@brackets"],
  173. [/[<>](?!@symbols)/, "@brackets"],
  174. [/@symbols/, "delimiter"],
  175. [/\d*\d+[eE]([\-+]?\d+)?(@floatsuffix)/, "number.float"],
  176. [/\d*\.\d+([eE][\-+]?\d+)?(@floatsuffix)/, "number.float"],
  177. [/0x[0-9a-fA-F]+LF/, "number.float"],
  178. [/0x[0-9a-fA-F]+(@integersuffix)/, "number.hex"],
  179. [/0b[0-1]+(@integersuffix)/, "number.bin"],
  180. [/\d+(@integersuffix)/, "number"],
  181. [/[;,.]/, "delimiter"],
  182. [/"([^"\\]|\\.)*$/, "string.invalid"],
  183. [/"""/, "string", '@string."""'],
  184. [/"/, "string", '@string."'],
  185. [/\@"/, { token: "string.quote", next: "@litstring" }],
  186. [/'[^\\']'B?/, "string"],
  187. [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
  188. [/'/, "string.invalid"]
  189. ],
  190. whitespace: [
  191. [/[ \t\r\n]+/, ""],
  192. [/\(\*(?!\))/, "comment", "@comment"],
  193. [/\/\/.*$/, "comment"]
  194. ],
  195. comment: [
  196. [/[^*(]+/, "comment"],
  197. [/\*\)/, "comment", "@pop"],
  198. [/\*/, "comment"],
  199. [/\(\*\)/, "comment"],
  200. [/\(/, "comment"]
  201. ],
  202. string: [
  203. [/[^\\"]+/, "string"],
  204. [/@escapes/, "string.escape"],
  205. [/\\./, "string.escape.invalid"],
  206. [
  207. /("""|"B?)/,
  208. {
  209. cases: {
  210. "$#==$S2": { token: "string", next: "@pop" },
  211. "@default": "string"
  212. }
  213. }
  214. ]
  215. ],
  216. litstring: [
  217. [/[^"]+/, "string"],
  218. [/""/, "string.escape"],
  219. [/"/, { token: "string.quote", next: "@pop" }]
  220. ]
  221. }
  222. };
  223. return fsharp_exports;
  224. })();
  225. return moduleExports;
  226. });