/usr/lib/nodejs/highlight/erlang.js is in node-highlight 7.4+ds-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | module.exports = function(hljs) {
var BASIC_ATOM_RE = '[a-z\'][a-zA-Z0-9_\']*';
var FUNCTION_NAME_RE = '(' + BASIC_ATOM_RE + ':' + BASIC_ATOM_RE + '|' + BASIC_ATOM_RE + ')';
var ERLANG_RESERVED = {
keyword:
'after and andalso|10 band begin bnot bor bsl bzr bxor case catch cond div end fun let ' +
'not of orelse|10 query receive rem try when xor',
literal:
'false true'
};
var COMMENT = {
className: 'comment',
begin: '%', end: '$',
relevance: 0
};
var NUMBER = {
className: 'number',
begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)',
relevance: 0
};
var NAMED_FUN = {
begin: 'fun\\s+' + BASIC_ATOM_RE + '/\\d+'
};
var FUNCTION_CALL = {
begin: FUNCTION_NAME_RE + '\\(', end: '\\)',
returnBegin: true,
relevance: 0,
contains: [
{
className: 'function_name', begin: FUNCTION_NAME_RE,
relevance: 0
},
{
begin: '\\(', end: '\\)', endsWithParent: true,
returnEnd: true,
relevance: 0
// "contains" defined later
}
]
};
var TUPLE = {
className: 'tuple',
begin: '{', end: '}',
relevance: 0
// "contains" defined later
};
var VAR1 = {
className: 'variable',
begin: '\\b_([A-Z][A-Za-z0-9_]*)?',
relevance: 0
};
var VAR2 = {
className: 'variable',
begin: '[A-Z][a-zA-Z0-9_]*',
relevance: 0
};
var RECORD_ACCESS = {
begin: '#', end: '}',
illegal: '.',
relevance: 0,
returnBegin: true,
contains: [
{
className: 'record_name',
begin: '#' + hljs.UNDERSCORE_IDENT_RE,
relevance: 0
},
{
begin: '{', endsWithParent: true,
relevance: 0
// "contains" defined later
}
]
};
var BLOCK_STATEMENTS = {
keywords: ERLANG_RESERVED,
begin: '(fun|receive|if|try|case)', end: 'end'
};
BLOCK_STATEMENTS.contains = [
COMMENT,
NAMED_FUN,
hljs.inherit(hljs.APOS_STRING_MODE, {className: ''}),
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
var BASIC_MODES = [
COMMENT,
NAMED_FUN,
BLOCK_STATEMENTS,
FUNCTION_CALL,
hljs.QUOTE_STRING_MODE,
NUMBER,
TUPLE,
VAR1, VAR2,
RECORD_ACCESS
];
FUNCTION_CALL.contains[1].contains = BASIC_MODES;
TUPLE.contains = BASIC_MODES;
RECORD_ACCESS.contains[1].contains = BASIC_MODES;
var PARAMS = {
className: 'params',
begin: '\\(', end: '\\)',
contains: BASIC_MODES
};
return {
keywords: ERLANG_RESERVED,
illegal: '(</|\\*=|\\+=|-=|/=|/\\*|\\*/|\\(\\*|\\*\\))',
contains: [
{
className: 'function',
begin: '^' + BASIC_ATOM_RE + '\\s*\\(', end: '->',
returnBegin: true,
illegal: '\\(|#|//|/\\*|\\\\|:',
contains: [
PARAMS,
{
className: 'title', begin: BASIC_ATOM_RE
}
],
starts: {
end: ';|\\.',
keywords: ERLANG_RESERVED,
contains: BASIC_MODES
}
},
COMMENT,
{
className: 'pp',
begin: '^-', end: '\\.',
relevance: 0,
excludeEnd: true,
returnBegin: true,
lexems: '-' + hljs.IDENT_RE,
keywords:
'-module -record -undef -export -ifdef -ifndef -author -copyright -doc -vsn ' +
'-import -include -include_lib -compile -define -else -endif -file -behaviour ' +
'-behavior',
contains: [PARAMS]
},
NUMBER,
hljs.QUOTE_STRING_MODE,
RECORD_ACCESS,
VAR1, VAR2,
TUPLE
]
};
};
|