caffeine-mc
Version:
Select, configure and extend your to-JavaScript compiler, with arbitrary code, on a per file bases from within the file.
5 lines (4 loc) • 1.49 kB
JavaScript
let Caf = require('caffeine-script-runtime');
Caf.defMod(module, () => {return {highlight: function(js) {let terminalColors, cardinal, keywordColor, operatorColor, functionDeclarationColor, identifierColor, options; terminalColors = require('art-standard-lib').TerminalColors; cardinal = require('cardinal'); keywordColor = terminalColors.yellow; operatorColor = terminalColors.magenta; functionDeclarationColor = terminalColors.blue; identifierColor = (str) => str; options = {linenos: true, theme: {Identifier: {undefined: keywordColor, null: keywordColor, _default: (s, info) => {let prevToken, nextToken; prevToken = info.tokens[info.tokenIndex - 1]; nextToken = info.tokens[info.tokenIndex + 1]; return ((Caf.exists(nextToken) && nextToken.type) === "Punctuator" && ((Caf.exists(nextToken) && nextToken.value) === "(" && (Caf.exists(prevToken) && prevToken.type) === "Keyword" && (Caf.exists(prevToken) && prevToken.value) === "function")) ? functionDeclarationColor(s) : ((Caf.exists(nextToken) && nextToken.value) === ":") ? functionDeclarationColor(s) : identifierColor(s);}}, Line: {_default: terminalColors.grey}, Block: {_default: terminalColors.grey}, Boolean: {_default: keywordColor}, Null: {_default: keywordColor}, Numeric: {_default: terminalColors.red}, String: {_default: terminalColors.green}, Keyword: {_default: keywordColor}, Punctuator: {_default: operatorColor}}}; return cardinal.highlight(js, options);}};});
//# sourceMappingURL=Highlight.js.map