Merge branch '5.2' into 5.3
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / 3rdParty / prism / components / prism-elixir.js
1 define(["prism/prism"], function () {
2 Prism.languages.elixir = {
3 'comment': /#.*/m,
4 // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
5 'regex': {
6 pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
7 greedy: true
8 },
9 'string': [
10 {
11 // ~s"""foo""" (multi-line), ~s'''foo''' (multi-line), ~s/foo/, ~s|foo|, ~s"foo", ~s'foo', ~s(foo), ~s[foo], ~s{foo} (with interpolation care), ~s<foo>
12 pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|#(?!\{)|[^#\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,
13 greedy: true,
14 inside: {
15 // See interpolation below
16 }
17 },
18 {
19 pattern: /("""|''')[\s\S]*?\1/,
20 greedy: true,
21 inside: {
22 // See interpolation below
23 }
24 },
25 {
26 // Multi-line strings are allowed
27 pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
28 greedy: true,
29 inside: {
30 // See interpolation below
31 }
32 }
33 ],
34 'atom': {
35 // Look-behind prevents bad highlighting of the :: operator
36 pattern: /(^|[^:]):\w+/,
37 lookbehind: true,
38 alias: 'symbol'
39 },
40 // Look-ahead prevents bad highlighting of the :: operator
41 'attr-name': /\w+\??:(?!:)/,
42 'capture': {
43 // Look-behind prevents bad highlighting of the && operator
44 pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,
45 lookbehind: true,
46 alias: 'function'
47 },
48 'argument': {
49 // Look-behind prevents bad highlighting of the && operator
50 pattern: /(^|[^&])&\d+/,
51 lookbehind: true,
52 alias: 'variable'
53 },
54 'attribute': {
55 pattern: /@\w+/,
56 alias: 'variable'
57 },
58 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
59 'keyword': /\b(?:after|alias|and|case|catch|cond|def(?:callback|exception|impl|module|p|protocol|struct)?|do|else|end|fn|for|if|import|not|or|require|rescue|try|unless|use|when)\b/,
60 'boolean': /\b(?:true|false|nil)\b/,
61 'operator': [
62 /\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
63 {
64 // We don't want to match <<
65 pattern: /([^<])<(?!<)/,
66 lookbehind: true
67 },
68 {
69 // We don't want to match >>
70 pattern: /([^>])>(?!>)/,
71 lookbehind: true
72 }
73 ],
74 'punctuation': /<<|>>|[.,%\[\]{}()]/
75 };
76
77 Prism.languages.elixir.string.forEach(function(o) {
78 o.inside = {
79 'interpolation': {
80 pattern: /#\{[^}]+\}/,
81 inside: {
82 'delimiter': {
83 pattern: /^#\{|\}$/,
84 alias: 'punctuation'
85 },
86 rest: Prism.languages.elixir
87 }
88 }
89 };
90 });
91
92 return Prism; })