blob: 76bce0755357cce8b911b42f74f46a0863af068e [file] [log] [blame]
exports.ids = ["react-syntax-highlighter_languages_highlight_coffeescript"];
exports.modules = {
/***/ "./node_modules/react-syntax-highlighter/node_modules/highlight.js/lib/languages/coffeescript.js":
/*!*******************************************************************************************************!*\
!*** ./node_modules/react-syntax-highlighter/node_modules/highlight.js/lib/languages/coffeescript.js ***!
\*******************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
const KEYWORDS = [
"as", // for exports
"in",
"of",
"if",
"for",
"while",
"finally",
"var",
"new",
"function",
"do",
"return",
"void",
"else",
"break",
"catch",
"instanceof",
"with",
"throw",
"case",
"default",
"try",
"switch",
"continue",
"typeof",
"delete",
"let",
"yield",
"const",
"class",
// JS handles these with a special rule
// "get",
// "set",
"debugger",
"async",
"await",
"static",
"import",
"from",
"export",
"extends"
];
const LITERALS = [
"true",
"false",
"null",
"undefined",
"NaN",
"Infinity"
];
const TYPES = [
"Intl",
"DataView",
"Number",
"Math",
"Date",
"String",
"RegExp",
"Object",
"Function",
"Boolean",
"Error",
"Symbol",
"Set",
"Map",
"WeakSet",
"WeakMap",
"Proxy",
"Reflect",
"JSON",
"Promise",
"Float64Array",
"Int16Array",
"Int32Array",
"Int8Array",
"Uint16Array",
"Uint32Array",
"Float32Array",
"Array",
"Uint8Array",
"Uint8ClampedArray",
"ArrayBuffer"
];
const ERROR_TYPES = [
"EvalError",
"InternalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError"
];
const BUILT_IN_GLOBALS = [
"setInterval",
"setTimeout",
"clearInterval",
"clearTimeout",
"require",
"exports",
"eval",
"isFinite",
"isNaN",
"parseFloat",
"parseInt",
"decodeURI",
"decodeURIComponent",
"encodeURI",
"encodeURIComponent",
"escape",
"unescape"
];
const BUILT_IN_VARIABLES = [
"arguments",
"this",
"super",
"console",
"window",
"document",
"localStorage",
"module",
"global" // Node.js
];
const BUILT_INS = [].concat(
BUILT_IN_GLOBALS,
BUILT_IN_VARIABLES,
TYPES,
ERROR_TYPES
);
/*
Language: CoffeeScript
Author: Dmytrii Nagirniak <dnagir@gmail.com>
Contributors: Oleg Efimov <efimovov@gmail.com>, Cédric Néhémie <cedric.nehemie@gmail.com>
Description: CoffeeScript is a programming language that transcompiles to JavaScript. For info about language see http://coffeescript.org/
Category: common, scripting
Website: https://coffeescript.org
*/
/** @type LanguageFn */
function coffeescript(hljs) {
var COFFEE_BUILT_INS = [
'npm',
'print'
];
var COFFEE_LITERALS = [
'yes',
'no',
'on',
'off'
];
var COFFEE_KEYWORDS = [
'then',
'unless',
'until',
'loop',
'by',
'when',
'and',
'or',
'is',
'isnt',
'not'
];
var NOT_VALID_KEYWORDS = [
"var",
"const",
"let",
"function",
"static"
];
var excluding = (list) =>
(kw) => !list.includes(kw);
var KEYWORDS$1 = {
keyword: KEYWORDS.concat(COFFEE_KEYWORDS).filter(excluding(NOT_VALID_KEYWORDS)).join(" "),
literal: LITERALS.concat(COFFEE_LITERALS).join(" "),
built_in: BUILT_INS.concat(COFFEE_BUILT_INS).join(" ")
};
var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
var SUBST = {
className: 'subst',
begin: /#\{/, end: /}/,
keywords: KEYWORDS$1
};
var EXPRESSIONS = [
hljs.BINARY_NUMBER_MODE,
hljs.inherit(hljs.C_NUMBER_MODE, {starts: {end: '(\\s*/)?', relevance: 0}}), // a number tries to eat the following slash to prevent treating it as a regexp
{
className: 'string',
variants: [
{
begin: /'''/, end: /'''/,
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: /'/, end: /'/,
contains: [hljs.BACKSLASH_ESCAPE]
},
{
begin: /"""/, end: /"""/,
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
},
{
begin: /"/, end: /"/,
contains: [hljs.BACKSLASH_ESCAPE, SUBST]
}
]
},
{
className: 'regexp',
variants: [
{
begin: '///', end: '///',
contains: [SUBST, hljs.HASH_COMMENT_MODE]
},
{
begin: '//[gim]{0,3}(?=\\W)',
relevance: 0
},
{
// regex can't start with space to parse x / 2 / 3 as two divisions
// regex can't start with *, and it supports an "illegal" in the main mode
begin: /\/(?![ *]).*?(?![\\]).\/[gim]{0,3}(?=\W)/
}
]
},
{
begin: '@' + JS_IDENT_RE // relevance booster
},
{
subLanguage: 'javascript',
excludeBegin: true, excludeEnd: true,
variants: [
{
begin: '```', end: '```',
},
{
begin: '`', end: '`',
}
]
}
];
SUBST.contains = EXPRESSIONS;
var TITLE = hljs.inherit(hljs.TITLE_MODE, {begin: JS_IDENT_RE});
var PARAMS_RE = '(\\(.*\\))?\\s*\\B[-=]>';
var PARAMS = {
className: 'params',
begin: '\\([^\\(]', returnBegin: true,
/* We need another contained nameless mode to not have every nested
pair of parens to be called "params" */
contains: [{
begin: /\(/, end: /\)/,
keywords: KEYWORDS$1,
contains: ['self'].concat(EXPRESSIONS)
}]
};
return {
name: 'CoffeeScript',
aliases: ['coffee', 'cson', 'iced'],
keywords: KEYWORDS$1,
illegal: /\/\*/,
contains: EXPRESSIONS.concat([
hljs.COMMENT('###', '###'),
hljs.HASH_COMMENT_MODE,
{
className: 'function',
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, end: '[-=]>',
returnBegin: true,
contains: [TITLE, PARAMS]
},
{
// anonymous function start
begin: /[:\(,=]\s*/,
relevance: 0,
contains: [
{
className: 'function',
begin: PARAMS_RE, end: '[-=]>',
returnBegin: true,
contains: [PARAMS]
}
]
},
{
className: 'class',
beginKeywords: 'class',
end: '$',
illegal: /[:="\[\]]/,
contains: [
{
beginKeywords: 'extends',
endsWithParent: true,
illegal: /[:="\[\]]/,
contains: [TITLE]
},
TITLE
]
},
{
begin: JS_IDENT_RE + ':', end: ':',
returnBegin: true, returnEnd: true,
relevance: 0
}
])
};
}
module.exports = coffeescript;
/***/ })
};;
//# sourceMappingURL=react-syntax-highlighter_languages_highlight_coffeescript.render-page.js.map