UNPKG

1 kBJavaScriptView Raw
1Prism.languages.erlang = {
2 'comment': /%.+/,
3 'string': /"(?:\\?.)*?"/,
4 'quoted-function': {
5 pattern: /'(?:\\.|[^'\\])+'(?=\()/,
6 alias: 'function'
7 },
8 'quoted-atom': {
9 pattern: /'(?:\\.|[^'\\])+'/,
10 alias: 'atom'
11 },
12 'boolean': /\b(?:true|false)\b/,
13 'keyword': /\b(?:fun|when|case|of|end|if|receive|after|try|catch)\b/,
14 'number': [
15 /\$\\?./,
16 /\d+#[a-z0-9]+/i,
17 /(?:\b|-)\d*\.?\d+([Ee][+-]?\d+)?\b/
18 ],
19 'function': /\b[a-z][\w@]*(?=\()/,
20 'variable': {
21 // Look-behind is used to prevent wrong highlighting of atoms containing "@"
22 pattern: /(^|[^@])(?:\b|\?)[A-Z_][\w@]*/,
23 lookbehind: true
24 },
25 'operator': [
26 /[=\/<>:]=|=[:\/]=|\+\+?|--?|[=*\/!]|\b(?:bnot|div|rem|band|bor|bxor|bsl|bsr|not|and|or|xor|orelse|andalso)\b/,
27 {
28 // We don't want to match <<
29 pattern: /(^|[^<])<(?!<)/,
30 lookbehind: true
31 },
32 {
33 // We don't want to match >>
34 pattern: /(^|[^>])>(?!>)/,
35 lookbehind: true
36 }
37 ],
38 'atom': /\b[a-z][\w@]*/,
39 'punctuation': /[()[\]{}:;,.#|]|<<|>>/
40
41};
\No newline at end of file