Skip to content

Commit

Permalink
Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gordalina committed Feb 23, 2021
1 parent 6b61080 commit 4d7d9b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
20 changes: 10 additions & 10 deletions components/prism-elixir.js
@@ -1,6 +1,6 @@
Prism.languages.elixir = {
'doc': {
pattern: /@(?:doc|moduledoc)\s+(?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|.*)/,
pattern: /@(?:doc|moduledoc)\s+(?:("""|''')(?:\\[\s\S]|(?!\1)[^\\])+\1|.*)/,
alias: 'doc-comment'
},
'comment': /#.*/m,
Expand Down Expand Up @@ -40,10 +40,10 @@ Prism.languages.elixir = {
lookbehind: true,
alias: 'symbol'
},
'atom-module': {
pattern: /\b[A-Z]\w*\b/,
alias: 'class-name'
},
'atom-module': {
pattern: /\b[A-Z]\w*\b/,
alias: 'class-name'
},
// Look-ahead prevents bad highlighting of the :: operator
'attr-name': /\w+\??:(?!:)/,
'capture': {
Expand All @@ -52,10 +52,6 @@ Prism.languages.elixir = {
lookbehind: true,
alias: 'function'
},
'function-call': {
pattern: /[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\?|!)?(?:(?=\s*(?:\.\s*)?\()|\/\d+)/,
alias: 'function'
},
'argument': {
// Look-behind prevents bad highlighting of the && operator
pattern: /(^|[^&])&\d+/,
Expand All @@ -68,6 +64,10 @@ Prism.languages.elixir = {
},
'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|delegate)?|do|else|end|fn|for|if|import|not|or|raise|require|rescue|try|unless|use|when)\b/,
'function-call': {
pattern: /\b[_a-zA-Z]\w*[?!]?(?:(?=\s*(?:\.\s*)?\()|\/\d+)/,
alias: 'function'
},
'boolean': /\b(?:true|false|nil)\b/,
'operator': [
/\bin\b|&&?|\|[|>]?|\\\\|::|\.\.\.?|\+\+?|-[->]?|<[-=>]|>=|!==?|\B!|=(?:==?|[>~])?|[*\/^]/,
Expand All @@ -82,7 +82,7 @@ Prism.languages.elixir = {
lookbehind: true
}
],
'punctuation': /<<|>>|[.,%\[\]{}()]/,
'punctuation': /<<|>>|[.,%\[\]{}()]/
};

Prism.languages.insertBefore('elixir', 'keyword', {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-elixir.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/languages/elixir/capture_feature.test
Expand Up @@ -10,7 +10,9 @@ fun = &(&1 + 1)
["operator", "&"],
["atom-module", "Math"],
["punctuation", "."],
["function-call", "zero?/1"],
"zero?",
["operator", "/"],
["number", "1"],
["punctuation", "("],
["capture", "&is_function/1"],
["punctuation", ")"],
Expand Down
2 changes: 1 addition & 1 deletion tests/languages/elixir/module_feature.test
Expand Up @@ -10,7 +10,7 @@ end
["keyword", "defmodule"], ["atom-module", "Math"], ["keyword", "do"],

["keyword", "def"],
["function-call", "sum"],
["function", "sum"],
["punctuation", "("],
"a",
["punctuation", ","],
Expand Down

0 comments on commit 4d7d9b3

Please sign in to comment.