update to higlight.js 8.4
This commit is contained in:
@@ -3,6 +3,7 @@ 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
|
||||
*/
|
||||
|
||||
function(hljs) {
|
||||
@@ -25,7 +26,6 @@ function(hljs) {
|
||||
'npm require console print module global window document'
|
||||
};
|
||||
var JS_IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';
|
||||
var TITLE = hljs.inherit(hljs.TITLE_MODE, {begin: JS_IDENT_RE});
|
||||
var SUBST = {
|
||||
className: 'subst',
|
||||
begin: /#\{/, end: /}/,
|
||||
@@ -67,7 +67,9 @@ function(hljs) {
|
||||
relevance: 0
|
||||
},
|
||||
{
|
||||
begin: '/\\S(\\\\.|[^\\n])*?/[gim]*(?=\\s|\\W|$)' // \S is required to parse x / 2 / 3 as two divisions
|
||||
// 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]*(?=\W|$)/
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -83,31 +85,47 @@ function(hljs) {
|
||||
];
|
||||
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,
|
||||
contains: ['self'].concat(EXPRESSIONS)
|
||||
}]
|
||||
};
|
||||
|
||||
return {
|
||||
aliases: ['coffee', 'cson', 'iced'],
|
||||
keywords: KEYWORDS,
|
||||
illegal: /\/\*/,
|
||||
contains: EXPRESSIONS.concat([
|
||||
{
|
||||
className: 'comment',
|
||||
begin: '###', end: '###'
|
||||
begin: '###', end: '###',
|
||||
contains: [hljs.PHRASAL_WORDS_MODE]
|
||||
},
|
||||
hljs.HASH_COMMENT_MODE,
|
||||
{
|
||||
className: 'function',
|
||||
begin: '(' + JS_IDENT_RE + '\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>', end: '[-=]>',
|
||||
begin: '^\\s*' + JS_IDENT_RE + '\\s*=\\s*' + PARAMS_RE, end: '[-=]>',
|
||||
returnBegin: true,
|
||||
contains: [TITLE, PARAMS]
|
||||
},
|
||||
{
|
||||
// anonymous function start
|
||||
begin: /[:\(,=]\s*/,
|
||||
relevance: 0,
|
||||
contains: [
|
||||
TITLE,
|
||||
{
|
||||
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,
|
||||
contains: ['self'].concat(EXPRESSIONS)
|
||||
}]
|
||||
className: 'function',
|
||||
begin: PARAMS_RE, end: '[-=]>',
|
||||
returnBegin: true,
|
||||
contains: [PARAMS]
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -129,7 +147,7 @@ function(hljs) {
|
||||
{
|
||||
className: 'attribute',
|
||||
begin: JS_IDENT_RE + ':', end: ':',
|
||||
returnBegin: true, excludeEnd: true,
|
||||
returnBegin: true, returnEnd: true,
|
||||
relevance: 0
|
||||
}
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user