coffee.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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/coffee/coffee",[],()=>{
  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/coffee/coffee.ts
  17. var coffee_exports = {};
  18. __export(coffee_exports, {
  19. conf: () => conf,
  20. language: () => language
  21. });
  22. var conf = {
  23. wordPattern: /(-?\d*\.\d\w*)|([^\`\~\!\@\#%\^\&\*\(\)\=\$\-\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,
  24. comments: {
  25. blockComment: ["###", "###"],
  26. lineComment: "#"
  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. ],
  47. folding: {
  48. markers: {
  49. start: new RegExp("^\\s*#region\\b"),
  50. end: new RegExp("^\\s*#endregion\\b")
  51. }
  52. }
  53. };
  54. var language = {
  55. defaultToken: "",
  56. ignoreCase: true,
  57. tokenPostfix: ".coffee",
  58. brackets: [
  59. { open: "{", close: "}", token: "delimiter.curly" },
  60. { open: "[", close: "]", token: "delimiter.square" },
  61. { open: "(", close: ")", token: "delimiter.parenthesis" }
  62. ],
  63. regEx: /\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,
  64. keywords: [
  65. "and",
  66. "or",
  67. "is",
  68. "isnt",
  69. "not",
  70. "on",
  71. "yes",
  72. "@",
  73. "no",
  74. "off",
  75. "true",
  76. "false",
  77. "null",
  78. "this",
  79. "new",
  80. "delete",
  81. "typeof",
  82. "in",
  83. "instanceof",
  84. "return",
  85. "throw",
  86. "break",
  87. "continue",
  88. "debugger",
  89. "if",
  90. "else",
  91. "switch",
  92. "for",
  93. "while",
  94. "do",
  95. "try",
  96. "catch",
  97. "finally",
  98. "class",
  99. "extends",
  100. "super",
  101. "undefined",
  102. "then",
  103. "unless",
  104. "until",
  105. "loop",
  106. "of",
  107. "by",
  108. "when"
  109. ],
  110. symbols: /[=><!~?&%|+\-*\/\^\.,\:]+/,
  111. escapes: /\\(?:[abfnrtv\\"'$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  112. tokenizer: {
  113. root: [
  114. [/\@[a-zA-Z_]\w*/, "variable.predefined"],
  115. [
  116. /[a-zA-Z_]\w*/,
  117. {
  118. cases: {
  119. this: "variable.predefined",
  120. "@keywords": { token: "keyword.$0" },
  121. "@default": ""
  122. }
  123. }
  124. ],
  125. [/[ \t\r\n]+/, ""],
  126. [/###/, "comment", "@comment"],
  127. [/#.*$/, "comment"],
  128. ["///", { token: "regexp", next: "@hereregexp" }],
  129. [/^(\s*)(@regEx)/, ["", "regexp"]],
  130. [/(\()(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
  131. [/(\,)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  132. [/(\=)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  133. [/(\:)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  134. [/(\[)(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
  135. [/(\!)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  136. [/(\&)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  137. [/(\|)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  138. [/(\?)(\s*)(@regEx)/, ["delimiter", "", "regexp"]],
  139. [/(\{)(\s*)(@regEx)/, ["@brackets", "", "regexp"]],
  140. [/(\;)(\s*)(@regEx)/, ["", "", "regexp"]],
  141. [
  142. /}/,
  143. {
  144. cases: {
  145. "$S2==interpolatedstring": {
  146. token: "string",
  147. next: "@pop"
  148. },
  149. "@default": "@brackets"
  150. }
  151. }
  152. ],
  153. [/[{}()\[\]]/, "@brackets"],
  154. [/@symbols/, "delimiter"],
  155. [/\d+[eE]([\-+]?\d+)?/, "number.float"],
  156. [/\d+\.\d+([eE][\-+]?\d+)?/, "number.float"],
  157. [/0[xX][0-9a-fA-F]+/, "number.hex"],
  158. [/0[0-7]+(?!\d)/, "number.octal"],
  159. [/\d+/, "number"],
  160. [/[,.]/, "delimiter"],
  161. [/"""/, "string", '@herestring."""'],
  162. [/'''/, "string", "@herestring.'''"],
  163. [
  164. /"/,
  165. {
  166. cases: {
  167. "@eos": "string",
  168. "@default": { token: "string", next: '@string."' }
  169. }
  170. }
  171. ],
  172. [
  173. /'/,
  174. {
  175. cases: {
  176. "@eos": "string",
  177. "@default": { token: "string", next: "@string.'" }
  178. }
  179. }
  180. ]
  181. ],
  182. string: [
  183. [/[^"'\#\\]+/, "string"],
  184. [/@escapes/, "string.escape"],
  185. [/\./, "string.escape.invalid"],
  186. [/\./, "string.escape.invalid"],
  187. [
  188. /#{/,
  189. {
  190. cases: {
  191. '$S2=="': {
  192. token: "string",
  193. next: "root.interpolatedstring"
  194. },
  195. "@default": "string"
  196. }
  197. }
  198. ],
  199. [
  200. /["']/,
  201. {
  202. cases: {
  203. "$#==$S2": { token: "string", next: "@pop" },
  204. "@default": "string"
  205. }
  206. }
  207. ],
  208. [/#/, "string"]
  209. ],
  210. herestring: [
  211. [
  212. /("""|''')/,
  213. {
  214. cases: {
  215. "$1==$S2": { token: "string", next: "@pop" },
  216. "@default": "string"
  217. }
  218. }
  219. ],
  220. [/[^#\\'"]+/, "string"],
  221. [/['"]+/, "string"],
  222. [/@escapes/, "string.escape"],
  223. [/\./, "string.escape.invalid"],
  224. [/#{/, { token: "string.quote", next: "root.interpolatedstring" }],
  225. [/#/, "string"]
  226. ],
  227. comment: [
  228. [/[^#]+/, "comment"],
  229. [/###/, "comment", "@pop"],
  230. [/#/, "comment"]
  231. ],
  232. hereregexp: [
  233. [/[^\\\/#]+/, "regexp"],
  234. [/\\./, "regexp"],
  235. [/#.*$/, "comment"],
  236. ["///[igm]*", { token: "regexp", next: "@pop" }],
  237. [/\//, "regexp"]
  238. ]
  239. }
  240. };
  241. return coffee_exports;
  242. })();
  243. return moduleExports;
  244. });