julia.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  1. "use strict";
  2. /*!-----------------------------------------------------------------------------
  3. * Copyright (c) Microsoft Corporation. All rights reserved.
  4. * Version: 0.38.0(0e330ae453813de4e6cf272460fb79c7117073d0)
  5. * Released under the MIT license
  6. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  7. *-----------------------------------------------------------------------------*/
  8. define("vs/basic-languages/julia/julia", ["require"],(require)=>{
  9. var moduleExports = (() => {
  10. var __defProp = Object.defineProperty;
  11. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  12. var __getOwnPropNames = Object.getOwnPropertyNames;
  13. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14. var __export = (target, all) => {
  15. for (var name in all)
  16. __defProp(target, name, { get: all[name], enumerable: true });
  17. };
  18. var __copyProps = (to, from, except, desc) => {
  19. if (from && typeof from === "object" || typeof from === "function") {
  20. for (let key of __getOwnPropNames(from))
  21. if (!__hasOwnProp.call(to, key) && key !== except)
  22. __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  23. }
  24. return to;
  25. };
  26. var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
  27. // src/basic-languages/julia/julia.ts
  28. var julia_exports = {};
  29. __export(julia_exports, {
  30. conf: () => conf,
  31. language: () => language
  32. });
  33. var conf = {
  34. brackets: [
  35. ["{", "}"],
  36. ["[", "]"],
  37. ["(", ")"]
  38. ],
  39. autoClosingPairs: [
  40. { open: "{", close: "}" },
  41. { open: "[", close: "]" },
  42. { open: "(", close: ")" },
  43. { open: '"', close: '"' },
  44. { open: "'", close: "'" }
  45. ],
  46. surroundingPairs: [
  47. { open: "{", close: "}" },
  48. { open: "[", close: "]" },
  49. { open: "(", close: ")" },
  50. { open: '"', close: '"' },
  51. { open: "'", close: "'" }
  52. ]
  53. };
  54. var language = {
  55. tokenPostfix: ".julia",
  56. keywords: [
  57. "begin",
  58. "while",
  59. "if",
  60. "for",
  61. "try",
  62. "return",
  63. "break",
  64. "continue",
  65. "function",
  66. "macro",
  67. "quote",
  68. "let",
  69. "local",
  70. "global",
  71. "const",
  72. "do",
  73. "struct",
  74. "module",
  75. "baremodule",
  76. "using",
  77. "import",
  78. "export",
  79. "end",
  80. "else",
  81. "elseif",
  82. "catch",
  83. "finally",
  84. "mutable",
  85. "primitive",
  86. "abstract",
  87. "type",
  88. "in",
  89. "isa",
  90. "where",
  91. "new"
  92. ],
  93. types: [
  94. "LinRange",
  95. "LineNumberNode",
  96. "LinearIndices",
  97. "LoadError",
  98. "MIME",
  99. "Matrix",
  100. "Method",
  101. "MethodError",
  102. "Missing",
  103. "MissingException",
  104. "Module",
  105. "NTuple",
  106. "NamedTuple",
  107. "Nothing",
  108. "Number",
  109. "OrdinalRange",
  110. "OutOfMemoryError",
  111. "OverflowError",
  112. "Pair",
  113. "PartialQuickSort",
  114. "PermutedDimsArray",
  115. "Pipe",
  116. "Ptr",
  117. "QuoteNode",
  118. "Rational",
  119. "RawFD",
  120. "ReadOnlyMemoryError",
  121. "Real",
  122. "ReentrantLock",
  123. "Ref",
  124. "Regex",
  125. "RegexMatch",
  126. "RoundingMode",
  127. "SegmentationFault",
  128. "Set",
  129. "Signed",
  130. "Some",
  131. "StackOverflowError",
  132. "StepRange",
  133. "StepRangeLen",
  134. "StridedArray",
  135. "StridedMatrix",
  136. "StridedVecOrMat",
  137. "StridedVector",
  138. "String",
  139. "StringIndexError",
  140. "SubArray",
  141. "SubString",
  142. "SubstitutionString",
  143. "Symbol",
  144. "SystemError",
  145. "Task",
  146. "Text",
  147. "TextDisplay",
  148. "Timer",
  149. "Tuple",
  150. "Type",
  151. "TypeError",
  152. "TypeVar",
  153. "UInt",
  154. "UInt128",
  155. "UInt16",
  156. "UInt32",
  157. "UInt64",
  158. "UInt8",
  159. "UndefInitializer",
  160. "AbstractArray",
  161. "UndefKeywordError",
  162. "AbstractChannel",
  163. "UndefRefError",
  164. "AbstractChar",
  165. "UndefVarError",
  166. "AbstractDict",
  167. "Union",
  168. "AbstractDisplay",
  169. "UnionAll",
  170. "AbstractFloat",
  171. "UnitRange",
  172. "AbstractIrrational",
  173. "Unsigned",
  174. "AbstractMatrix",
  175. "AbstractRange",
  176. "Val",
  177. "AbstractSet",
  178. "Vararg",
  179. "AbstractString",
  180. "VecElement",
  181. "AbstractUnitRange",
  182. "VecOrMat",
  183. "AbstractVecOrMat",
  184. "Vector",
  185. "AbstractVector",
  186. "VersionNumber",
  187. "Any",
  188. "WeakKeyDict",
  189. "ArgumentError",
  190. "WeakRef",
  191. "Array",
  192. "AssertionError",
  193. "BigFloat",
  194. "BigInt",
  195. "BitArray",
  196. "BitMatrix",
  197. "BitSet",
  198. "BitVector",
  199. "Bool",
  200. "BoundsError",
  201. "CapturedException",
  202. "CartesianIndex",
  203. "CartesianIndices",
  204. "Cchar",
  205. "Cdouble",
  206. "Cfloat",
  207. "Channel",
  208. "Char",
  209. "Cint",
  210. "Cintmax_t",
  211. "Clong",
  212. "Clonglong",
  213. "Cmd",
  214. "Colon",
  215. "Complex",
  216. "ComplexF16",
  217. "ComplexF32",
  218. "ComplexF64",
  219. "CompositeException",
  220. "Condition",
  221. "Cptrdiff_t",
  222. "Cshort",
  223. "Csize_t",
  224. "Cssize_t",
  225. "Cstring",
  226. "Cuchar",
  227. "Cuint",
  228. "Cuintmax_t",
  229. "Culong",
  230. "Culonglong",
  231. "Cushort",
  232. "Cvoid",
  233. "Cwchar_t",
  234. "Cwstring",
  235. "DataType",
  236. "DenseArray",
  237. "DenseMatrix",
  238. "DenseVecOrMat",
  239. "DenseVector",
  240. "Dict",
  241. "DimensionMismatch",
  242. "Dims",
  243. "DivideError",
  244. "DomainError",
  245. "EOFError",
  246. "Enum",
  247. "ErrorException",
  248. "Exception",
  249. "ExponentialBackOff",
  250. "Expr",
  251. "Float16",
  252. "Float32",
  253. "Float64",
  254. "Function",
  255. "GlobalRef",
  256. "HTML",
  257. "IO",
  258. "IOBuffer",
  259. "IOContext",
  260. "IOStream",
  261. "IdDict",
  262. "IndexCartesian",
  263. "IndexLinear",
  264. "IndexStyle",
  265. "InexactError",
  266. "InitError",
  267. "Int",
  268. "Int128",
  269. "Int16",
  270. "Int32",
  271. "Int64",
  272. "Int8",
  273. "Integer",
  274. "InterruptException",
  275. "InvalidStateException",
  276. "Irrational",
  277. "KeyError"
  278. ],
  279. keywordops: ["<:", ">:", ":", "=>", "...", ".", "->", "?"],
  280. allops: /[^\w\d\s()\[\]{}"'#]+/,
  281. constants: [
  282. "true",
  283. "false",
  284. "nothing",
  285. "missing",
  286. "undef",
  287. "Inf",
  288. "pi",
  289. "NaN",
  290. "\u03C0",
  291. "\u212F",
  292. "ans",
  293. "PROGRAM_FILE",
  294. "ARGS",
  295. "C_NULL",
  296. "VERSION",
  297. "DEPOT_PATH",
  298. "LOAD_PATH"
  299. ],
  300. operators: [
  301. "!",
  302. "!=",
  303. "!==",
  304. "%",
  305. "&",
  306. "*",
  307. "+",
  308. "-",
  309. "/",
  310. "//",
  311. "<",
  312. "<<",
  313. "<=",
  314. "==",
  315. "===",
  316. "=>",
  317. ">",
  318. ">=",
  319. ">>",
  320. ">>>",
  321. "\\",
  322. "^",
  323. "|",
  324. "|>",
  325. "~",
  326. "\xF7",
  327. "\u2208",
  328. "\u2209",
  329. "\u220B",
  330. "\u220C",
  331. "\u2218",
  332. "\u221A",
  333. "\u221B",
  334. "\u2229",
  335. "\u222A",
  336. "\u2248",
  337. "\u2249",
  338. "\u2260",
  339. "\u2261",
  340. "\u2262",
  341. "\u2264",
  342. "\u2265",
  343. "\u2286",
  344. "\u2287",
  345. "\u2288",
  346. "\u2289",
  347. "\u228A",
  348. "\u228B",
  349. "\u22BB"
  350. ],
  351. brackets: [
  352. { open: "(", close: ")", token: "delimiter.parenthesis" },
  353. { open: "{", close: "}", token: "delimiter.curly" },
  354. { open: "[", close: "]", token: "delimiter.square" }
  355. ],
  356. ident: /π|ℯ|\b(?!\d)\w+\b/,
  357. escape: /(?:[abefnrstv\\"'\n\r]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2}|u[0-9A-Fa-f]{4})/,
  358. escapes: /\\(?:C\-(@escape|.)|c(@escape|.)|@escape)/,
  359. tokenizer: {
  360. root: [
  361. [/(::)\s*|\b(isa)\s+/, "keyword", "@typeanno"],
  362. [/\b(isa)(\s*\(@ident\s*,\s*)/, ["keyword", { token: "", next: "@typeanno" }]],
  363. [/\b(type|struct)[ \t]+/, "keyword", "@typeanno"],
  364. [/^\s*:@ident[!?]?/, "metatag"],
  365. [/(return)(\s*:@ident[!?]?)/, ["keyword", "metatag"]],
  366. [/(\(|\[|\{|@allops)(\s*:@ident[!?]?)/, ["", "metatag"]],
  367. [/:\(/, "metatag", "@quote"],
  368. [/r"""/, "regexp.delim", "@tregexp"],
  369. [/r"/, "regexp.delim", "@sregexp"],
  370. [/raw"""/, "string.delim", "@rtstring"],
  371. [/[bv]?"""/, "string.delim", "@dtstring"],
  372. [/raw"/, "string.delim", "@rsstring"],
  373. [/[bv]?"/, "string.delim", "@dsstring"],
  374. [
  375. /(@ident)\{/,
  376. {
  377. cases: {
  378. "$1@types": { token: "type", next: "@gen" },
  379. "@default": { token: "type", next: "@gen" }
  380. }
  381. }
  382. ],
  383. [
  384. /@ident[!?'']?(?=\.?\()/,
  385. {
  386. cases: {
  387. "@types": "type",
  388. "@keywords": "keyword",
  389. "@constants": "variable",
  390. "@default": "keyword.flow"
  391. }
  392. }
  393. ],
  394. [
  395. /@ident[!?']?/,
  396. {
  397. cases: {
  398. "@types": "type",
  399. "@keywords": "keyword",
  400. "@constants": "variable",
  401. "@default": "identifier"
  402. }
  403. }
  404. ],
  405. [/\$\w+/, "key"],
  406. [/\$\(/, "key", "@paste"],
  407. [/@@@ident/, "annotation"],
  408. { include: "@whitespace" },
  409. [/'(?:@escapes|.)'/, "string.character"],
  410. [/[()\[\]{}]/, "@brackets"],
  411. [
  412. /@allops/,
  413. {
  414. cases: {
  415. "@keywordops": "keyword",
  416. "@operators": "operator"
  417. }
  418. }
  419. ],
  420. [/[;,]/, "delimiter"],
  421. [/0[xX][0-9a-fA-F](_?[0-9a-fA-F])*/, "number.hex"],
  422. [/0[_oO][0-7](_?[0-7])*/, "number.octal"],
  423. [/0[bB][01](_?[01])*/, "number.binary"],
  424. [/[+\-]?\d+(\.\d+)?(im?|[eE][+\-]?\d+(\.\d+)?)?/, "number"]
  425. ],
  426. typeanno: [
  427. [/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*\{/, "type", "@gen"],
  428. [/([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(\s*<:\s*)/, ["type", "keyword"]],
  429. [/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*/, "type", "@pop"],
  430. ["", "", "@pop"]
  431. ],
  432. gen: [
  433. [/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*\{/, "type", "@push"],
  434. [/[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*/, "type"],
  435. [/<:/, "keyword"],
  436. [/(\})(\s*<:\s*)/, ["type", { token: "keyword", next: "@pop" }]],
  437. [/\}/, "type", "@pop"],
  438. { include: "@root" }
  439. ],
  440. quote: [
  441. [/\$\(/, "key", "@paste"],
  442. [/\(/, "@brackets", "@paren"],
  443. [/\)/, "metatag", "@pop"],
  444. { include: "@root" }
  445. ],
  446. paste: [
  447. [/:\(/, "metatag", "@quote"],
  448. [/\(/, "@brackets", "@paren"],
  449. [/\)/, "key", "@pop"],
  450. { include: "@root" }
  451. ],
  452. paren: [
  453. [/\$\(/, "key", "@paste"],
  454. [/:\(/, "metatag", "@quote"],
  455. [/\(/, "@brackets", "@push"],
  456. [/\)/, "@brackets", "@pop"],
  457. { include: "@root" }
  458. ],
  459. sregexp: [
  460. [/^.*/, "invalid"],
  461. [/[^\\"()\[\]{}]/, "regexp"],
  462. [/[()\[\]{}]/, "@brackets"],
  463. [/\\./, "operator.scss"],
  464. [/"[imsx]*/, "regexp.delim", "@pop"]
  465. ],
  466. tregexp: [
  467. [/[^\\"()\[\]{}]/, "regexp"],
  468. [/[()\[\]{}]/, "@brackets"],
  469. [/\\./, "operator.scss"],
  470. [/"(?!"")/, "string"],
  471. [/"""[imsx]*/, "regexp.delim", "@pop"]
  472. ],
  473. rsstring: [
  474. [/^.*/, "invalid"],
  475. [/[^\\"]/, "string"],
  476. [/\\./, "string.escape"],
  477. [/"/, "string.delim", "@pop"]
  478. ],
  479. rtstring: [
  480. [/[^\\"]/, "string"],
  481. [/\\./, "string.escape"],
  482. [/"(?!"")/, "string"],
  483. [/"""/, "string.delim", "@pop"]
  484. ],
  485. dsstring: [
  486. [/^.*/, "invalid"],
  487. [/[^\\"\$]/, "string"],
  488. [/\$/, "", "@interpolated"],
  489. [/@escapes/, "string.escape"],
  490. [/\\./, "string.escape.invalid"],
  491. [/"/, "string.delim", "@pop"]
  492. ],
  493. dtstring: [
  494. [/[^\\"\$]/, "string"],
  495. [/\$/, "", "@interpolated"],
  496. [/@escapes/, "string.escape"],
  497. [/\\./, "string.escape.invalid"],
  498. [/"(?!"")/, "string"],
  499. [/"""/, "string.delim", "@pop"]
  500. ],
  501. interpolated: [
  502. [/\(/, { token: "", switchTo: "@interpolated_compound" }],
  503. [/[a-zA-Z_]\w*/, "identifier"],
  504. ["", "", "@pop"]
  505. ],
  506. interpolated_compound: [[/\)/, "", "@pop"], { include: "@root" }],
  507. whitespace: [
  508. [/[ \t\r\n]+/, ""],
  509. [/#=/, "comment", "@multi_comment"],
  510. [/#.*$/, "comment"]
  511. ],
  512. multi_comment: [
  513. [/#=/, "comment", "@push"],
  514. [/=#/, "comment", "@pop"],
  515. [/=(?!#)|#(?!=)/, "comment"],
  516. [/[^#=]+/, "comment"]
  517. ]
  518. }
  519. };
  520. return __toCommonJS(julia_exports);
  521. })();
  522. return moduleExports;
  523. });