julia.js 12 KB

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