aboutsummaryrefslogtreecommitdiff
path: root/node_modules/prismjs/components/prism-elixir.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/prismjs/components/prism-elixir.js
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/prismjs/components/prism-elixir.js')
-rw-r--r--node_modules/prismjs/components/prism-elixir.js93
1 files changed, 93 insertions, 0 deletions
diff --git a/node_modules/prismjs/components/prism-elixir.js b/node_modules/prismjs/components/prism-elixir.js
new file mode 100644
index 00000000..c8ba9598
--- /dev/null
+++ b/node_modules/prismjs/components/prism-elixir.js
@@ -0,0 +1,93 @@
+Prism.languages.elixir = {
+ 'comment': {
+ pattern: /#.*/m,
+ lookbehind: true
+ },
+ // ~r"""foo""" (multi-line), ~r'''foo''' (multi-line), ~r/foo/, ~r|foo|, ~r"foo", ~r'foo', ~r(foo), ~r[foo], ~r{foo}, ~r<foo>
+ 'regex': {
+ pattern: /~[rR](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[uismxfr]*/,
+ greedy: true
+ },
+ 'string': [
+ {
+ // ~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>
+ pattern: /~[cCsSwW](?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|([\/|"'])(?:\\.|(?!\2)[^\\\r\n])+\2|\((?:\\.|[^\\)\r\n])+\)|\[(?:\\.|[^\\\]\r\n])+\]|\{(?:\\.|#\{[^}]+\}|[^\\}\r\n])+\}|<(?:\\.|[^\\>\r\n])+>)[csa]?/,
+ greedy: true,
+ inside: {
+ // See interpolation below
+ }
+ },
+ {
+ pattern: /("""|''')[\s\S]*?\1/,
+ greedy: true,
+ inside: {
+ // See interpolation below
+ }
+ },
+ {
+ // Multi-line strings are allowed
+ pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ greedy: true,
+ inside: {
+ // See interpolation below
+ }
+ }
+ ],
+ 'atom': {
+ // Look-behind prevents bad highlighting of the :: operator
+ pattern: /(^|[^:]):\w+/,
+ lookbehind: true,
+ alias: 'symbol'
+ },
+ // Look-ahead prevents bad highlighting of the :: operator
+ 'attr-name': /\w+:(?!:)/,
+ 'capture': {
+ // Look-behind prevents bad highlighting of the && operator
+ pattern: /(^|[^&])&(?:[^&\s\d()][^\s()]*|(?=\())/,
+ lookbehind: true,
+ alias: 'function'
+ },
+ 'argument': {
+ // Look-behind prevents bad highlighting of the && operator
+ pattern: /(^|[^&])&\d+/,
+ lookbehind: true,
+ alias: 'variable'
+ },
+ 'attribute': {
+ pattern: /@\w+/,
+ alias: 'variable'
+ },
+ 'number': /\b(?:0[box][a-f\d_]+|\d[\d_]*)(?:\.[\d_]+)?(?:e[+-]?[\d_]+)?\b/i,
+ '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/,
+ 'boolean': /\b(?:true|false|nil)\b/,
+ 'operator': [
+ /\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
+ {
+ // We don't want to match <<
+ pattern: /([^<])<(?!<)/,
+ lookbehind: true
+ },
+ {
+ // We don't want to match >>
+ pattern: /([^>])>(?!>)/,
+ lookbehind: true
+ }
+ ],
+ 'punctuation': /<<|>>|[.,%\[\]{}()]/
+};
+
+Prism.languages.elixir.string.forEach(function(o) {
+ o.inside = {
+ 'interpolation': {
+ pattern: /#\{[^}]+\}/,
+ inside: {
+ 'delimiter': {
+ pattern: /^#\{|\}$/,
+ alias: 'punctuation'
+ },
+ rest: Prism.languages.elixir
+ }
+ }
+ };
+});
+