elixir-KO55WI37.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. import "./chunk-2LSFTFF7.js";
  2. // node_modules/.pnpm/monaco-editor@0.38.0/node_modules/monaco-editor/esm/vs/basic-languages/elixir/elixir.js
  3. var conf = {
  4. comments: {
  5. lineComment: "#"
  6. },
  7. brackets: [
  8. ["{", "}"],
  9. ["[", "]"],
  10. ["(", ")"]
  11. ],
  12. surroundingPairs: [
  13. { open: "{", close: "}" },
  14. { open: "[", close: "]" },
  15. { open: "(", close: ")" },
  16. { open: "'", close: "'" },
  17. { open: '"', close: '"' }
  18. ],
  19. autoClosingPairs: [
  20. { open: "'", close: "'", notIn: ["string", "comment"] },
  21. { open: '"', close: '"', notIn: ["comment"] },
  22. { open: '"""', close: '"""' },
  23. { open: "`", close: "`", notIn: ["string", "comment"] },
  24. { open: "(", close: ")" },
  25. { open: "{", close: "}" },
  26. { open: "[", close: "]" },
  27. { open: "<<", close: ">>" }
  28. ],
  29. indentationRules: {
  30. increaseIndentPattern: /^\s*(after|else|catch|rescue|fn|[^#]*(do|<\-|\->|\{|\[|\=))\s*$/,
  31. decreaseIndentPattern: /^\s*((\}|\])\s*$|(after|else|catch|rescue|end)\b)/
  32. }
  33. };
  34. var language = {
  35. defaultToken: "source",
  36. tokenPostfix: ".elixir",
  37. brackets: [
  38. { open: "[", close: "]", token: "delimiter.square" },
  39. { open: "(", close: ")", token: "delimiter.parenthesis" },
  40. { open: "{", close: "}", token: "delimiter.curly" },
  41. { open: "<<", close: ">>", token: "delimiter.angle.special" }
  42. ],
  43. declarationKeywords: [
  44. "def",
  45. "defp",
  46. "defn",
  47. "defnp",
  48. "defguard",
  49. "defguardp",
  50. "defmacro",
  51. "defmacrop",
  52. "defdelegate",
  53. "defcallback",
  54. "defmacrocallback",
  55. "defmodule",
  56. "defprotocol",
  57. "defexception",
  58. "defimpl",
  59. "defstruct"
  60. ],
  61. operatorKeywords: ["and", "in", "not", "or", "when"],
  62. namespaceKeywords: ["alias", "import", "require", "use"],
  63. otherKeywords: [
  64. "after",
  65. "case",
  66. "catch",
  67. "cond",
  68. "do",
  69. "else",
  70. "end",
  71. "fn",
  72. "for",
  73. "if",
  74. "quote",
  75. "raise",
  76. "receive",
  77. "rescue",
  78. "super",
  79. "throw",
  80. "try",
  81. "unless",
  82. "unquote_splicing",
  83. "unquote",
  84. "with"
  85. ],
  86. constants: ["true", "false", "nil"],
  87. nameBuiltin: ["__MODULE__", "__DIR__", "__ENV__", "__CALLER__", "__STACKTRACE__"],
  88. operator: /-[->]?|!={0,2}|\*{1,2}|\/|\\\\|&{1,3}|\.\.?|\^(?:\^\^)?|\+\+?|<(?:-|<<|=|>|\|>|~>?)?|=~|={1,3}|>(?:=|>>)?|\|~>|\|>|\|{1,3}|~>>?|~~~|::/,
  89. variableName: /[a-z_][a-zA-Z0-9_]*[?!]?/,
  90. atomName: /[a-zA-Z_][a-zA-Z0-9_@]*[?!]?|@specialAtomName|@operator/,
  91. specialAtomName: /\.\.\.|<<>>|%\{\}|%|\{\}/,
  92. aliasPart: /[A-Z][a-zA-Z0-9_]*/,
  93. moduleName: /@aliasPart(?:\.@aliasPart)*/,
  94. sigilSymmetricDelimiter: /"""|'''|"|'|\/|\|/,
  95. sigilStartDelimiter: /@sigilSymmetricDelimiter|<|\{|\[|\(/,
  96. sigilEndDelimiter: /@sigilSymmetricDelimiter|>|\}|\]|\)/,
  97. sigilModifiers: /[a-zA-Z0-9]*/,
  98. decimal: /\d(?:_?\d)*/,
  99. hex: /[0-9a-fA-F](_?[0-9a-fA-F])*/,
  100. octal: /[0-7](_?[0-7])*/,
  101. binary: /[01](_?[01])*/,
  102. escape: /\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}|\\./,
  103. tokenizer: {
  104. root: [
  105. { include: "@whitespace" },
  106. { include: "@comments" },
  107. { include: "@keywordsShorthand" },
  108. { include: "@numbers" },
  109. { include: "@identifiers" },
  110. { include: "@strings" },
  111. { include: "@atoms" },
  112. { include: "@sigils" },
  113. { include: "@attributes" },
  114. { include: "@symbols" }
  115. ],
  116. whitespace: [[/\s+/, "white"]],
  117. comments: [[/(#)(.*)/, ["comment.punctuation", "comment"]]],
  118. keywordsShorthand: [
  119. [/(@atomName)(:)(\s+)/, ["constant", "constant.punctuation", "white"]],
  120. [
  121. /"(?=([^"]|#\{.*?\}|\\")*":)/,
  122. { token: "constant.delimiter", next: "@doubleQuotedStringKeyword" }
  123. ],
  124. [
  125. /'(?=([^']|#\{.*?\}|\\')*':)/,
  126. { token: "constant.delimiter", next: "@singleQuotedStringKeyword" }
  127. ]
  128. ],
  129. doubleQuotedStringKeyword: [
  130. [/":/, { token: "constant.delimiter", next: "@pop" }],
  131. { include: "@stringConstantContentInterpol" }
  132. ],
  133. singleQuotedStringKeyword: [
  134. [/':/, { token: "constant.delimiter", next: "@pop" }],
  135. { include: "@stringConstantContentInterpol" }
  136. ],
  137. numbers: [
  138. [/0b@binary/, "number.binary"],
  139. [/0o@octal/, "number.octal"],
  140. [/0x@hex/, "number.hex"],
  141. [/@decimal\.@decimal([eE]-?@decimal)?/, "number.float"],
  142. [/@decimal/, "number"]
  143. ],
  144. identifiers: [
  145. [
  146. /\b(defp?|defnp?|defmacrop?|defguardp?|defdelegate)(\s+)(@variableName)(?!\s+@operator)/,
  147. [
  148. "keyword.declaration",
  149. "white",
  150. {
  151. cases: {
  152. unquote: "keyword",
  153. "@default": "function"
  154. }
  155. }
  156. ]
  157. ],
  158. [
  159. /(@variableName)(?=\s*\.?\s*\()/,
  160. {
  161. cases: {
  162. "@declarationKeywords": "keyword.declaration",
  163. "@namespaceKeywords": "keyword",
  164. "@otherKeywords": "keyword",
  165. "@default": "function.call"
  166. }
  167. }
  168. ],
  169. [
  170. /(@moduleName)(\s*)(\.)(\s*)(@variableName)/,
  171. ["type.identifier", "white", "operator", "white", "function.call"]
  172. ],
  173. [
  174. /(:)(@atomName)(\s*)(\.)(\s*)(@variableName)/,
  175. ["constant.punctuation", "constant", "white", "operator", "white", "function.call"]
  176. ],
  177. [
  178. /(\|>)(\s*)(@variableName)/,
  179. [
  180. "operator",
  181. "white",
  182. {
  183. cases: {
  184. "@otherKeywords": "keyword",
  185. "@default": "function.call"
  186. }
  187. }
  188. ]
  189. ],
  190. [
  191. /(&)(\s*)(@variableName)/,
  192. ["operator", "white", "function.call"]
  193. ],
  194. [
  195. /@variableName/,
  196. {
  197. cases: {
  198. "@declarationKeywords": "keyword.declaration",
  199. "@operatorKeywords": "keyword.operator",
  200. "@namespaceKeywords": "keyword",
  201. "@otherKeywords": "keyword",
  202. "@constants": "constant.language",
  203. "@nameBuiltin": "variable.language",
  204. "_.*": "comment.unused",
  205. "@default": "identifier"
  206. }
  207. }
  208. ],
  209. [/@moduleName/, "type.identifier"]
  210. ],
  211. strings: [
  212. [/"""/, { token: "string.delimiter", next: "@doubleQuotedHeredoc" }],
  213. [/'''/, { token: "string.delimiter", next: "@singleQuotedHeredoc" }],
  214. [/"/, { token: "string.delimiter", next: "@doubleQuotedString" }],
  215. [/'/, { token: "string.delimiter", next: "@singleQuotedString" }]
  216. ],
  217. doubleQuotedHeredoc: [
  218. [/"""/, { token: "string.delimiter", next: "@pop" }],
  219. { include: "@stringContentInterpol" }
  220. ],
  221. singleQuotedHeredoc: [
  222. [/'''/, { token: "string.delimiter", next: "@pop" }],
  223. { include: "@stringContentInterpol" }
  224. ],
  225. doubleQuotedString: [
  226. [/"/, { token: "string.delimiter", next: "@pop" }],
  227. { include: "@stringContentInterpol" }
  228. ],
  229. singleQuotedString: [
  230. [/'/, { token: "string.delimiter", next: "@pop" }],
  231. { include: "@stringContentInterpol" }
  232. ],
  233. atoms: [
  234. [/(:)(@atomName)/, ["constant.punctuation", "constant"]],
  235. [/:"/, { token: "constant.delimiter", next: "@doubleQuotedStringAtom" }],
  236. [/:'/, { token: "constant.delimiter", next: "@singleQuotedStringAtom" }]
  237. ],
  238. doubleQuotedStringAtom: [
  239. [/"/, { token: "constant.delimiter", next: "@pop" }],
  240. { include: "@stringConstantContentInterpol" }
  241. ],
  242. singleQuotedStringAtom: [
  243. [/'/, { token: "constant.delimiter", next: "@pop" }],
  244. { include: "@stringConstantContentInterpol" }
  245. ],
  246. sigils: [
  247. [/~[a-z]@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.interpol" }],
  248. [/~[A-Z]@sigilStartDelimiter/, { token: "@rematch", next: "@sigil.noInterpol" }]
  249. ],
  250. sigil: [
  251. [/~([a-zA-Z])\{/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.{.}" }],
  252. [/~([a-zA-Z])\[/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.[.]" }],
  253. [/~([a-zA-Z])\(/, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.(.)" }],
  254. [/~([a-zA-Z])\</, { token: "@rematch", switchTo: "@sigilStart.$S2.$1.<.>" }],
  255. [
  256. /~([a-zA-Z])(@sigilSymmetricDelimiter)/,
  257. { token: "@rematch", switchTo: "@sigilStart.$S2.$1.$2.$2" }
  258. ]
  259. ],
  260. "sigilStart.interpol.s": [
  261. [
  262. /~s@sigilStartDelimiter/,
  263. {
  264. token: "string.delimiter",
  265. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  266. }
  267. ]
  268. ],
  269. "sigilContinue.interpol.s": [
  270. [
  271. /(@sigilEndDelimiter)@sigilModifiers/,
  272. {
  273. cases: {
  274. "$1==$S5": { token: "string.delimiter", next: "@pop" },
  275. "@default": "string"
  276. }
  277. }
  278. ],
  279. { include: "@stringContentInterpol" }
  280. ],
  281. "sigilStart.noInterpol.S": [
  282. [
  283. /~S@sigilStartDelimiter/,
  284. {
  285. token: "string.delimiter",
  286. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  287. }
  288. ]
  289. ],
  290. "sigilContinue.noInterpol.S": [
  291. [/(^|[^\\])\\@sigilEndDelimiter/, "string"],
  292. [
  293. /(@sigilEndDelimiter)@sigilModifiers/,
  294. {
  295. cases: {
  296. "$1==$S5": { token: "string.delimiter", next: "@pop" },
  297. "@default": "string"
  298. }
  299. }
  300. ],
  301. { include: "@stringContent" }
  302. ],
  303. "sigilStart.interpol.r": [
  304. [
  305. /~r@sigilStartDelimiter/,
  306. {
  307. token: "regexp.delimiter",
  308. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  309. }
  310. ]
  311. ],
  312. "sigilContinue.interpol.r": [
  313. [
  314. /(@sigilEndDelimiter)@sigilModifiers/,
  315. {
  316. cases: {
  317. "$1==$S5": { token: "regexp.delimiter", next: "@pop" },
  318. "@default": "regexp"
  319. }
  320. }
  321. ],
  322. { include: "@regexpContentInterpol" }
  323. ],
  324. "sigilStart.noInterpol.R": [
  325. [
  326. /~R@sigilStartDelimiter/,
  327. {
  328. token: "regexp.delimiter",
  329. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  330. }
  331. ]
  332. ],
  333. "sigilContinue.noInterpol.R": [
  334. [/(^|[^\\])\\@sigilEndDelimiter/, "regexp"],
  335. [
  336. /(@sigilEndDelimiter)@sigilModifiers/,
  337. {
  338. cases: {
  339. "$1==$S5": { token: "regexp.delimiter", next: "@pop" },
  340. "@default": "regexp"
  341. }
  342. }
  343. ],
  344. { include: "@regexpContent" }
  345. ],
  346. "sigilStart.interpol": [
  347. [
  348. /~([a-zA-Z])@sigilStartDelimiter/,
  349. {
  350. token: "sigil.delimiter",
  351. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  352. }
  353. ]
  354. ],
  355. "sigilContinue.interpol": [
  356. [
  357. /(@sigilEndDelimiter)@sigilModifiers/,
  358. {
  359. cases: {
  360. "$1==$S5": { token: "sigil.delimiter", next: "@pop" },
  361. "@default": "sigil"
  362. }
  363. }
  364. ],
  365. { include: "@sigilContentInterpol" }
  366. ],
  367. "sigilStart.noInterpol": [
  368. [
  369. /~([a-zA-Z])@sigilStartDelimiter/,
  370. {
  371. token: "sigil.delimiter",
  372. switchTo: "@sigilContinue.$S2.$S3.$S4.$S5"
  373. }
  374. ]
  375. ],
  376. "sigilContinue.noInterpol": [
  377. [/(^|[^\\])\\@sigilEndDelimiter/, "sigil"],
  378. [
  379. /(@sigilEndDelimiter)@sigilModifiers/,
  380. {
  381. cases: {
  382. "$1==$S5": { token: "sigil.delimiter", next: "@pop" },
  383. "@default": "sigil"
  384. }
  385. }
  386. ],
  387. { include: "@sigilContent" }
  388. ],
  389. attributes: [
  390. [
  391. /\@(module|type)?doc (~[sS])?"""/,
  392. {
  393. token: "comment.block.documentation",
  394. next: "@doubleQuotedHeredocDocstring"
  395. }
  396. ],
  397. [
  398. /\@(module|type)?doc (~[sS])?'''/,
  399. {
  400. token: "comment.block.documentation",
  401. next: "@singleQuotedHeredocDocstring"
  402. }
  403. ],
  404. [
  405. /\@(module|type)?doc (~[sS])?"/,
  406. {
  407. token: "comment.block.documentation",
  408. next: "@doubleQuotedStringDocstring"
  409. }
  410. ],
  411. [
  412. /\@(module|type)?doc (~[sS])?'/,
  413. {
  414. token: "comment.block.documentation",
  415. next: "@singleQuotedStringDocstring"
  416. }
  417. ],
  418. [/\@(module|type)?doc false/, "comment.block.documentation"],
  419. [/\@(@variableName)/, "variable"]
  420. ],
  421. doubleQuotedHeredocDocstring: [
  422. [/"""/, { token: "comment.block.documentation", next: "@pop" }],
  423. { include: "@docstringContent" }
  424. ],
  425. singleQuotedHeredocDocstring: [
  426. [/'''/, { token: "comment.block.documentation", next: "@pop" }],
  427. { include: "@docstringContent" }
  428. ],
  429. doubleQuotedStringDocstring: [
  430. [/"/, { token: "comment.block.documentation", next: "@pop" }],
  431. { include: "@docstringContent" }
  432. ],
  433. singleQuotedStringDocstring: [
  434. [/'/, { token: "comment.block.documentation", next: "@pop" }],
  435. { include: "@docstringContent" }
  436. ],
  437. symbols: [
  438. [/\?(\\.|[^\\\s])/, "number.constant"],
  439. [/&\d+/, "operator"],
  440. [/<<<|>>>/, "operator"],
  441. [/[()\[\]\{\}]|<<|>>/, "@brackets"],
  442. [/\.\.\./, "identifier"],
  443. [/=>/, "punctuation"],
  444. [/@operator/, "operator"],
  445. [/[:;,.%]/, "punctuation"]
  446. ],
  447. stringContentInterpol: [
  448. { include: "@interpolation" },
  449. { include: "@escapeChar" },
  450. { include: "@stringContent" }
  451. ],
  452. stringContent: [[/./, "string"]],
  453. stringConstantContentInterpol: [
  454. { include: "@interpolation" },
  455. { include: "@escapeChar" },
  456. { include: "@stringConstantContent" }
  457. ],
  458. stringConstantContent: [[/./, "constant"]],
  459. regexpContentInterpol: [
  460. { include: "@interpolation" },
  461. { include: "@escapeChar" },
  462. { include: "@regexpContent" }
  463. ],
  464. regexpContent: [
  465. [/(\s)(#)(\s.*)$/, ["white", "comment.punctuation", "comment"]],
  466. [/./, "regexp"]
  467. ],
  468. sigilContentInterpol: [
  469. { include: "@interpolation" },
  470. { include: "@escapeChar" },
  471. { include: "@sigilContent" }
  472. ],
  473. sigilContent: [[/./, "sigil"]],
  474. docstringContent: [[/./, "comment.block.documentation"]],
  475. escapeChar: [[/@escape/, "constant.character.escape"]],
  476. interpolation: [[/#{/, { token: "delimiter.bracket.embed", next: "@interpolationContinue" }]],
  477. interpolationContinue: [
  478. [/}/, { token: "delimiter.bracket.embed", next: "@pop" }],
  479. { include: "@root" }
  480. ]
  481. }
  482. };
  483. export {
  484. conf,
  485. language
  486. };
  487. /*! Bundled license information:
  488. monaco-editor/esm/vs/basic-languages/elixir/elixir.js:
  489. (*!-----------------------------------------------------------------------------
  490. * Copyright (c) Microsoft Corporation. All rights reserved.
  491. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  492. * Released under the MIT license
  493. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  494. *-----------------------------------------------------------------------------*)
  495. */
  496. //# sourceMappingURL=elixir-KO55WI37.js.map