ruby-CUOVD6Y6.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. import "./chunk-2LSFTFF7.js";
  2. // node_modules/.pnpm/monaco-editor@0.38.0/node_modules/monaco-editor/esm/vs/basic-languages/ruby/ruby.js
  3. var conf = {
  4. comments: {
  5. lineComment: "#",
  6. blockComment: ["=begin", "=end"]
  7. },
  8. brackets: [
  9. ["(", ")"],
  10. ["{", "}"],
  11. ["[", "]"]
  12. ],
  13. autoClosingPairs: [
  14. { open: "{", close: "}" },
  15. { open: "[", close: "]" },
  16. { open: "(", close: ")" },
  17. { open: '"', close: '"' },
  18. { open: "'", close: "'" }
  19. ],
  20. surroundingPairs: [
  21. { open: "{", close: "}" },
  22. { open: "[", close: "]" },
  23. { open: "(", close: ")" },
  24. { open: '"', close: '"' },
  25. { open: "'", close: "'" }
  26. ],
  27. indentationRules: {
  28. increaseIndentPattern: new RegExp(`^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|("|'|/).*\\4)*(#.*)?$`),
  29. decreaseIndentPattern: new RegExp("^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)")
  30. }
  31. };
  32. var language = {
  33. tokenPostfix: ".ruby",
  34. keywords: [
  35. "__LINE__",
  36. "__ENCODING__",
  37. "__FILE__",
  38. "BEGIN",
  39. "END",
  40. "alias",
  41. "and",
  42. "begin",
  43. "break",
  44. "case",
  45. "class",
  46. "def",
  47. "defined?",
  48. "do",
  49. "else",
  50. "elsif",
  51. "end",
  52. "ensure",
  53. "for",
  54. "false",
  55. "if",
  56. "in",
  57. "module",
  58. "next",
  59. "nil",
  60. "not",
  61. "or",
  62. "redo",
  63. "rescue",
  64. "retry",
  65. "return",
  66. "self",
  67. "super",
  68. "then",
  69. "true",
  70. "undef",
  71. "unless",
  72. "until",
  73. "when",
  74. "while",
  75. "yield"
  76. ],
  77. keywordops: ["::", "..", "...", "?", ":", "=>"],
  78. builtins: [
  79. "require",
  80. "public",
  81. "private",
  82. "include",
  83. "extend",
  84. "attr_reader",
  85. "protected",
  86. "private_class_method",
  87. "protected_class_method",
  88. "new"
  89. ],
  90. declarations: [
  91. "module",
  92. "class",
  93. "def",
  94. "case",
  95. "do",
  96. "begin",
  97. "for",
  98. "if",
  99. "while",
  100. "until",
  101. "unless"
  102. ],
  103. linedecls: ["def", "case", "do", "begin", "for", "if", "while", "until", "unless"],
  104. operators: [
  105. "^",
  106. "&",
  107. "|",
  108. "<=>",
  109. "==",
  110. "===",
  111. "!~",
  112. "=~",
  113. ">",
  114. ">=",
  115. "<",
  116. "<=",
  117. "<<",
  118. ">>",
  119. "+",
  120. "-",
  121. "*",
  122. "/",
  123. "%",
  124. "**",
  125. "~",
  126. "+@",
  127. "-@",
  128. "[]",
  129. "[]=",
  130. "`",
  131. "+=",
  132. "-=",
  133. "*=",
  134. "**=",
  135. "/=",
  136. "^=",
  137. "%=",
  138. "<<=",
  139. ">>=",
  140. "&=",
  141. "&&=",
  142. "||=",
  143. "|="
  144. ],
  145. brackets: [
  146. { open: "(", close: ")", token: "delimiter.parenthesis" },
  147. { open: "{", close: "}", token: "delimiter.curly" },
  148. { open: "[", close: "]", token: "delimiter.square" }
  149. ],
  150. symbols: /[=><!~?:&|+\-*\/\^%\.]+/,
  151. escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
  152. escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
  153. decpart: /\d(_?\d)*/,
  154. decimal: /0|@decpart/,
  155. delim: /[^a-zA-Z0-9\s\n\r]/,
  156. heredelim: /(?:\w+|'[^']*'|"[^"]*"|`[^`]*`)/,
  157. regexpctl: /[(){}\[\]\$\^|\-*+?\.]/,
  158. regexpesc: /\\(?:[AzZbBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})?/,
  159. tokenizer: {
  160. root: [
  161. [
  162. /^(\s*)([a-z_]\w*[!?=]?)/,
  163. [
  164. "white",
  165. {
  166. cases: {
  167. "for|until|while": {
  168. token: "keyword.$2",
  169. next: "@dodecl.$2"
  170. },
  171. "@declarations": {
  172. token: "keyword.$2",
  173. next: "@root.$2"
  174. },
  175. end: { token: "keyword.$S2", next: "@pop" },
  176. "@keywords": "keyword",
  177. "@builtins": "predefined",
  178. "@default": "identifier"
  179. }
  180. }
  181. ]
  182. ],
  183. [
  184. /[a-z_]\w*[!?=]?/,
  185. {
  186. cases: {
  187. "if|unless|while|until": {
  188. token: "keyword.$0x",
  189. next: "@modifier.$0x"
  190. },
  191. for: { token: "keyword.$2", next: "@dodecl.$2" },
  192. "@linedecls": { token: "keyword.$0", next: "@root.$0" },
  193. end: { token: "keyword.$S2", next: "@pop" },
  194. "@keywords": "keyword",
  195. "@builtins": "predefined",
  196. "@default": "identifier"
  197. }
  198. }
  199. ],
  200. [/[A-Z][\w]*[!?=]?/, "constructor.identifier"],
  201. [/\$[\w]*/, "global.constant"],
  202. [/@[\w]*/, "namespace.instance.identifier"],
  203. [/@@@[\w]*/, "namespace.class.identifier"],
  204. [/<<[-~](@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
  205. [/[ \t\r\n]+<<(@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
  206. [/^<<(@heredelim).*/, { token: "string.heredoc.delimiter", next: "@heredoc.$1" }],
  207. { include: "@whitespace" },
  208. [/"/, { token: "string.d.delim", next: '@dstring.d."' }],
  209. [/'/, { token: "string.sq.delim", next: "@sstring.sq" }],
  210. [/%([rsqxwW]|Q?)/, { token: "@rematch", next: "pstring" }],
  211. [/`/, { token: "string.x.delim", next: "@dstring.x.`" }],
  212. [/:(\w|[$@])\w*[!?=]?/, "string.s"],
  213. [/:"/, { token: "string.s.delim", next: '@dstring.s."' }],
  214. [/:'/, { token: "string.s.delim", next: "@sstring.s" }],
  215. [/\/(?=(\\\/|[^\/\n])+\/)/, { token: "regexp.delim", next: "@regexp" }],
  216. [/[{}()\[\]]/, "@brackets"],
  217. [
  218. /@symbols/,
  219. {
  220. cases: {
  221. "@keywordops": "keyword",
  222. "@operators": "operator",
  223. "@default": ""
  224. }
  225. }
  226. ],
  227. [/[;,]/, "delimiter"],
  228. [/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, "number.hex"],
  229. [/0[_oO][0-7](_?[0-7])*/, "number.octal"],
  230. [/0[bB][01](_?[01])*/, "number.binary"],
  231. [/0[dD]@decpart/, "number"],
  232. [
  233. /@decimal((\.@decpart)?([eE][\-+]?@decpart)?)/,
  234. {
  235. cases: {
  236. $1: "number.float",
  237. "@default": "number"
  238. }
  239. }
  240. ]
  241. ],
  242. dodecl: [
  243. [/^/, { token: "", switchTo: "@root.$S2" }],
  244. [
  245. /[a-z_]\w*[!?=]?/,
  246. {
  247. cases: {
  248. end: { token: "keyword.$S2", next: "@pop" },
  249. do: { token: "keyword", switchTo: "@root.$S2" },
  250. "@linedecls": {
  251. token: "@rematch",
  252. switchTo: "@root.$S2"
  253. },
  254. "@keywords": "keyword",
  255. "@builtins": "predefined",
  256. "@default": "identifier"
  257. }
  258. }
  259. ],
  260. { include: "@root" }
  261. ],
  262. modifier: [
  263. [/^/, "", "@pop"],
  264. [
  265. /[a-z_]\w*[!?=]?/,
  266. {
  267. cases: {
  268. end: { token: "keyword.$S2", next: "@pop" },
  269. "then|else|elsif|do": {
  270. token: "keyword",
  271. switchTo: "@root.$S2"
  272. },
  273. "@linedecls": {
  274. token: "@rematch",
  275. switchTo: "@root.$S2"
  276. },
  277. "@keywords": "keyword",
  278. "@builtins": "predefined",
  279. "@default": "identifier"
  280. }
  281. }
  282. ],
  283. { include: "@root" }
  284. ],
  285. sstring: [
  286. [/[^\\']+/, "string.$S2"],
  287. [/\\\\|\\'|\\$/, "string.$S2.escape"],
  288. [/\\./, "string.$S2.invalid"],
  289. [/'/, { token: "string.$S2.delim", next: "@pop" }]
  290. ],
  291. dstring: [
  292. [/[^\\`"#]+/, "string.$S2"],
  293. [/#/, "string.$S2.escape", "@interpolated"],
  294. [/\\$/, "string.$S2.escape"],
  295. [/@escapes/, "string.$S2.escape"],
  296. [/\\./, "string.$S2.escape.invalid"],
  297. [
  298. /[`"]/,
  299. {
  300. cases: {
  301. "$#==$S3": { token: "string.$S2.delim", next: "@pop" },
  302. "@default": "string.$S2"
  303. }
  304. }
  305. ]
  306. ],
  307. heredoc: [
  308. [
  309. /^(\s*)(@heredelim)$/,
  310. {
  311. cases: {
  312. "$2==$S2": ["string.heredoc", { token: "string.heredoc.delimiter", next: "@pop" }],
  313. "@default": ["string.heredoc", "string.heredoc"]
  314. }
  315. }
  316. ],
  317. [/.*/, "string.heredoc"]
  318. ],
  319. interpolated: [
  320. [/\$\w*/, "global.constant", "@pop"],
  321. [/@\w*/, "namespace.class.identifier", "@pop"],
  322. [/@@@\w*/, "namespace.instance.identifier", "@pop"],
  323. [
  324. /[{]/,
  325. {
  326. token: "string.escape.curly",
  327. switchTo: "@interpolated_compound"
  328. }
  329. ],
  330. ["", "", "@pop"]
  331. ],
  332. interpolated_compound: [
  333. [/[}]/, { token: "string.escape.curly", next: "@pop" }],
  334. { include: "@root" }
  335. ],
  336. pregexp: [
  337. { include: "@whitespace" },
  338. [
  339. /[^\(\{\[\\]/,
  340. {
  341. cases: {
  342. "$#==$S3": { token: "regexp.delim", next: "@pop" },
  343. "$#==$S2": { token: "regexp.delim", next: "@push" },
  344. "~[)}\\]]": "@brackets.regexp.escape.control",
  345. "~@regexpctl": "regexp.escape.control",
  346. "@default": "regexp"
  347. }
  348. }
  349. ],
  350. { include: "@regexcontrol" }
  351. ],
  352. regexp: [
  353. { include: "@regexcontrol" },
  354. [/[^\\\/]/, "regexp"],
  355. ["/[ixmp]*", { token: "regexp.delim" }, "@pop"]
  356. ],
  357. regexcontrol: [
  358. [
  359. /(\{)(\d+(?:,\d*)?)(\})/,
  360. [
  361. "@brackets.regexp.escape.control",
  362. "regexp.escape.control",
  363. "@brackets.regexp.escape.control"
  364. ]
  365. ],
  366. [
  367. /(\[)(\^?)/,
  368. ["@brackets.regexp.escape.control", { token: "regexp.escape.control", next: "@regexrange" }]
  369. ],
  370. [/(\()(\?[:=!])/, ["@brackets.regexp.escape.control", "regexp.escape.control"]],
  371. [/\(\?#/, { token: "regexp.escape.control", next: "@regexpcomment" }],
  372. [/[()]/, "@brackets.regexp.escape.control"],
  373. [/@regexpctl/, "regexp.escape.control"],
  374. [/\\$/, "regexp.escape"],
  375. [/@regexpesc/, "regexp.escape"],
  376. [/\\\./, "regexp.invalid"],
  377. [/#/, "regexp.escape", "@interpolated"]
  378. ],
  379. regexrange: [
  380. [/-/, "regexp.escape.control"],
  381. [/\^/, "regexp.invalid"],
  382. [/\\$/, "regexp.escape"],
  383. [/@regexpesc/, "regexp.escape"],
  384. [/[^\]]/, "regexp"],
  385. [/\]/, "@brackets.regexp.escape.control", "@pop"]
  386. ],
  387. regexpcomment: [
  388. [/[^)]+/, "comment"],
  389. [/\)/, { token: "regexp.escape.control", next: "@pop" }]
  390. ],
  391. pstring: [
  392. [/%([qws])\(/, { token: "string.$1.delim", switchTo: "@qstring.$1.(.)" }],
  393. [/%([qws])\[/, { token: "string.$1.delim", switchTo: "@qstring.$1.[.]" }],
  394. [/%([qws])\{/, { token: "string.$1.delim", switchTo: "@qstring.$1.{.}" }],
  395. [/%([qws])</, { token: "string.$1.delim", switchTo: "@qstring.$1.<.>" }],
  396. [/%([qws])(@delim)/, { token: "string.$1.delim", switchTo: "@qstring.$1.$2.$2" }],
  397. [/%r\(/, { token: "regexp.delim", switchTo: "@pregexp.(.)" }],
  398. [/%r\[/, { token: "regexp.delim", switchTo: "@pregexp.[.]" }],
  399. [/%r\{/, { token: "regexp.delim", switchTo: "@pregexp.{.}" }],
  400. [/%r</, { token: "regexp.delim", switchTo: "@pregexp.<.>" }],
  401. [/%r(@delim)/, { token: "regexp.delim", switchTo: "@pregexp.$1.$1" }],
  402. [/%(x|W|Q?)\(/, { token: "string.$1.delim", switchTo: "@qqstring.$1.(.)" }],
  403. [/%(x|W|Q?)\[/, { token: "string.$1.delim", switchTo: "@qqstring.$1.[.]" }],
  404. [/%(x|W|Q?)\{/, { token: "string.$1.delim", switchTo: "@qqstring.$1.{.}" }],
  405. [/%(x|W|Q?)</, { token: "string.$1.delim", switchTo: "@qqstring.$1.<.>" }],
  406. [/%(x|W|Q?)(@delim)/, { token: "string.$1.delim", switchTo: "@qqstring.$1.$2.$2" }],
  407. [/%([rqwsxW]|Q?)./, { token: "invalid", next: "@pop" }],
  408. [/./, { token: "invalid", next: "@pop" }]
  409. ],
  410. qstring: [
  411. [/\\$/, "string.$S2.escape"],
  412. [/\\./, "string.$S2.escape"],
  413. [
  414. /./,
  415. {
  416. cases: {
  417. "$#==$S4": { token: "string.$S2.delim", next: "@pop" },
  418. "$#==$S3": { token: "string.$S2.delim", next: "@push" },
  419. "@default": "string.$S2"
  420. }
  421. }
  422. ]
  423. ],
  424. qqstring: [[/#/, "string.$S2.escape", "@interpolated"], { include: "@qstring" }],
  425. whitespace: [
  426. [/[ \t\r\n]+/, ""],
  427. [/^\s*=begin\b/, "comment", "@comment"],
  428. [/#.*$/, "comment"]
  429. ],
  430. comment: [
  431. [/[^=]+/, "comment"],
  432. [/^\s*=begin\b/, "comment.invalid"],
  433. [/^\s*=end\b.*/, "comment", "@pop"],
  434. [/[=]/, "comment"]
  435. ]
  436. }
  437. };
  438. export {
  439. conf,
  440. language
  441. };
  442. /*! Bundled license information:
  443. monaco-editor/esm/vs/basic-languages/ruby/ruby.js:
  444. (*!-----------------------------------------------------------------------------
  445. * Copyright (c) Microsoft Corporation. All rights reserved.
  446. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  447. * Released under the MIT license
  448. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  449. *-----------------------------------------------------------------------------*)
  450. */
  451. //# sourceMappingURL=ruby-CUOVD6Y6.js.map