source: node_modules/refractor/lang/julia.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[d24f17c]1'use strict'
2
3module.exports = julia
4julia.displayName = 'julia'
5julia.aliases = []
6function julia(Prism) {
7 Prism.languages.julia = {
8 comment: {
9 // support one level of nested comments
10 // https://github.com/JuliaLang/julia/pull/6128
11 pattern:
12 /(^|[^\\])(?:#=(?:[^#=]|=(?!#)|#(?!=)|#=(?:[^#=]|=(?!#)|#(?!=))*=#)*=#|#.*)/,
13 lookbehind: true
14 },
15 regex: {
16 // https://docs.julialang.org/en/v1/manual/strings/#Regular-Expressions-1
17 pattern: /r"(?:\\.|[^"\\\r\n])*"[imsx]{0,4}/,
18 greedy: true
19 },
20 string: {
21 // https://docs.julialang.org/en/v1/manual/strings/#String-Basics-1
22 // https://docs.julialang.org/en/v1/manual/strings/#non-standard-string-literals-1
23 // https://docs.julialang.org/en/v1/manual/running-external-programs/#Running-External-Programs-1
24 pattern:
25 /"""[\s\S]+?"""|(?:\b\w+)?"(?:\\.|[^"\\\r\n])*"|`(?:[^\\`\r\n]|\\.)*`/,
26 greedy: true
27 },
28 char: {
29 // https://docs.julialang.org/en/v1/manual/strings/#man-characters-1
30 pattern: /(^|[^\w'])'(?:\\[^\r\n][^'\r\n]*|[^\\\r\n])'/,
31 lookbehind: true,
32 greedy: true
33 },
34 keyword:
35 /\b(?:abstract|baremodule|begin|bitstype|break|catch|ccall|const|continue|do|else|elseif|end|export|finally|for|function|global|if|immutable|import|importall|in|let|local|macro|module|print|println|quote|return|struct|try|type|typealias|using|while)\b/,
36 boolean: /\b(?:false|true)\b/,
37 number:
38 /(?:\b(?=\d)|\B(?=\.))(?:0[box])?(?:[\da-f]+(?:_[\da-f]+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[efp][+-]?\d+(?:_\d+)*)?j?/i,
39 // https://docs.julialang.org/en/v1/manual/mathematical-operations/
40 // https://docs.julialang.org/en/v1/manual/mathematical-operations/#Operator-Precedence-and-Associativity-1
41 operator:
42 /&&|\|\||[-+*^%÷⊻&$\\]=?|\/[\/=]?|!=?=?|\|[=>]?|<(?:<=?|[=:|])?|>(?:=|>>?=?)?|==?=?|[~≠≤≥'√∛]/,
43 punctuation: /::?|[{}[\]();,.?]/,
44 // https://docs.julialang.org/en/v1/base/numbers/#Base.im
45 constant: /\b(?:(?:Inf|NaN)(?:16|32|64)?|im|pi)\b|[πℯ]/
46 }
47}
Note: See TracBrowser for help on using the repository browser.