1 define(["prism/prism"], function () {
2 Prism
.languages
.elixir
= {
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>
6 pattern
: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
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]?/,
15 // See interpolation below
19 pattern
: /("""|''')[\s\S]*?\1/,
22 // See interpolation below
26 // Multi-line strings are allowed
27 pattern
: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
30 // See interpolation below
35 // Look-behind prevents bad highlighting of the :: operator
36 pattern
: /(^|[^:]):\w+/,
40 // Look-ahead prevents bad highlighting of the :: operator
41 'attr-name': /\w+\??:(?!:)/,
43 // Look-behind prevents bad highlighting of the && operator
44 pattern
: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,
49 // Look-behind prevents bad highlighting of the && operator
50 pattern
: /(^|[^&])&\d+/,
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/,
62 /\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
64 // We don't want to match <<
65 pattern
: /([^<])<(?!<)/,
69 // We don't want to match >>
70 pattern
: /([^>])>(?!>)/,
74 'punctuation': /<<|>>|[.,%\[\]{}()]/
77 Prism
.languages
.elixir
.string
.forEach(function(o
) {
80 pattern
: /#\{[^}]+\}/,
86 rest
: Prism
.languages
.elixir