UNPKG

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