/usr/lib/nodejs/highlight/python.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 | module.exports = function(hljs) {
var PROMPT = {
className: 'prompt', begin: /^(>>>|\.\.\.) /
}
var STRINGS = [
{
className: 'string',
begin: /(u|b)?r?'''/, end: /'''/,
contains: [PROMPT],
relevance: 10
},
{
className: 'string',
begin: /(u|b)?r?"""/, end: /"""/,
contains: [PROMPT],
relevance: 10
},
{
className: 'string',
begin: /(u|r|ur)'/, end: /'/,
contains: [hljs.BACKSLASH_ESCAPE],
relevance: 10
},
{
className: 'string',
begin: /(u|r|ur)"/, end: /"/,
contains: [hljs.BACKSLASH_ESCAPE],
relevance: 10
},
{
className: 'string',
begin: /(b|br)'/, end: /'/,
contains: [hljs.BACKSLASH_ESCAPE]
},
{
className: 'string',
begin: /(b|br)"/, end: /"/,
contains: [hljs.BACKSLASH_ESCAPE]
}
].concat([
hljs.APOS_STRING_MODE,
hljs.QUOTE_STRING_MODE
]);
var TITLE = {
className: 'title', begin: hljs.UNDERSCORE_IDENT_RE
};
var PARAMS = {
className: 'params',
begin: /\(/, end: /\)/,
contains: ['self', hljs.C_NUMBER_MODE, PROMPT].concat(STRINGS)
};
var FUNC_CLASS_PROTO = {
beginWithKeyword: true, end: /:/,
illegal: /[${=;\n]/,
contains: [TITLE, PARAMS],
relevance: 10
};
return {
keywords: {
keyword:
'and elif is global as in if from raise for except finally print import pass return ' +
'exec else break not with class assert yield try while continue del or def lambda ' +
'nonlocal|10',
built_in:
'None True False Ellipsis NotImplemented'
},
illegal: /(<\/|->|\?)/,
contains: STRINGS.concat([
PROMPT,
hljs.HASH_COMMENT_MODE,
hljs.inherit(FUNC_CLASS_PROTO, {className: 'function', keywords: 'def'}),
hljs.inherit(FUNC_CLASS_PROTO, {className: 'class', keywords: 'class'}),
hljs.C_NUMBER_MODE,
{
className: 'decorator',
begin: /@/, end: /$/
},
{
begin: /\b(print|exec)\(/ // don’t highlight keywords-turned-functions in Python 3
}
])
};
};
|