Skip to content

Commit

Permalink
Erlang: Fixed quoted functions and quoted atoms. Fixed variables patt…
Browse files Browse the repository at this point in the history
…ern so that it does not break atoms. Fixed operator <=.
  • Loading branch information
Golmote committed Jul 17, 2015
1 parent 7d1b8d7 commit fa286aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions components/prism-erlang.js
Expand Up @@ -2,11 +2,11 @@ Prism.languages.erlang = {
'comment': /%.+/,
'string': /"(?:\\?.)*?"/,
'quoted-function': {
pattern: /'[^']+'(?=\()/,
pattern: /'(?:\\.|[^'\\])+'(?=\()/,
alias: 'function'
},
'quoted-atom': {
pattern: /'[^']+'/,
pattern: /'(?:\\.|[^'\\])+'/,
alias: 'atom'
},
'boolean': /\b(?:true|false)\b/,
Expand All @@ -17,15 +17,21 @@ Prism.languages.erlang = {
/(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
],
'function': /\b[a-z][\w@]*(?=\()/,
'variable': /(?:\b|\?)[A-Z_][\w@]*/,
'variable': {
// Look-behind is used to prevent wrong highlighting of atoms containing "@"
pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
lookbehind: true
},
'operator': [
/[=\/>:]=|>=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
/[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
{
pattern: /(^|(?!<).)<(?!<)/,
// We don't want to match <<
pattern: /(^|[^<])<(?!<)/,
lookbehind: true
},
{
pattern: /(^|(?!>).)>(?!>)/,
// We don't want to match >>
pattern: /(^|[^>])>(?!>)/,
lookbehind: true
}
],
Expand Down
2 changes: 1 addition & 1 deletion components/prism-erlang.min.js

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

0 comments on commit fa286aa

Please sign in to comment.