]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/livescript.js
1 /*! `livescript` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
36 // JS handles these with a special rule
47 // It's reached stage 3, which is "recommended for implementation":
59 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
61 // Fundamental objects
74 // Indexed collections
98 // Control abstraction objects
106 // Internationalization
112 const ERROR_TYPES
= [
123 const BUILT_IN_GLOBALS
= [
138 "decodeURIComponent",
140 "encodeURIComponent",
145 const BUILT_INS
= [].concat(
153 Author: Taneli Vatanen <taneli.vatanen@gmail.com>
154 Contributors: Jen Evers-Corvina <jen@sevvie.net>
155 Origin: coffeescript.js
156 Description: LiveScript is a programming language that transcompiles to JavaScript. For info about language see http://livescript.net/
157 Website: https://livescript.net
162 function livescript(hljs
) {
163 const LIVESCRIPT_BUILT_INS
= [
167 const LIVESCRIPT_LITERALS
= [
176 const LIVESCRIPT_KEYWORDS
= [
208 keyword: KEYWORDS
.concat(LIVESCRIPT_KEYWORDS
),
209 literal: LITERALS
.concat(LIVESCRIPT_LITERALS
),
210 built_in: BUILT_INS
.concat(LIVESCRIPT_BUILT_INS
)
212 const JS_IDENT_RE
= '[A-Za-z$_](?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*';
213 const TITLE
= hljs
.inherit(hljs
.TITLE_MODE
, { begin: JS_IDENT_RE
});
220 const SUBST_SIMPLE
= {
222 begin: /#[A-Za-z$_]/,
223 end: /(?:-[0-9A-Za-z$_]|[0-9A-Za-z$_])*/,
226 const EXPRESSIONS
= [
227 hljs
.BINARY_NUMBER_MODE
,
230 begin: '(\\b0[xX][a-fA-F0-9_]+)|(\\b\\d(\\d|_\\d)*(\\.(\\d(\\d|_\\d)*)?)?(_*[eE]([-+]\\d(_\\d|\\d)*)?)?[_a-z]*)',
235 } // a number tries to eat the following slash to prevent treating it as a regexp
243 contains: [ hljs
.BACKSLASH_ESCAPE
]
248 contains: [ hljs
.BACKSLASH_ESCAPE
]
254 hljs
.BACKSLASH_ESCAPE
,
263 hljs
.BACKSLASH_ESCAPE
,
283 hljs
.HASH_COMMENT_MODE
287 // regex can't start with space to parse x / 2 / 3 as two divisions
288 // regex can't start with *, and it supports an "illegal" in the main mode
289 begin: /\/(?![ *])(\\.|[^\\\n])*?\/[gim]*(?=\W)/ }
292 { begin: '@' + JS_IDENT_RE
},
298 subLanguage: 'javascript'
301 SUBST
.contains
= EXPRESSIONS
;
307 /* We need another contained nameless mode to not have every nested
308 pair of parens to be called "params" */
313 keywords: KEYWORDS
$1,
314 contains: [ 'self' ].concat(EXPRESSIONS
)
319 const SYMBOLS
= { begin: '(#=>|=>|\\|>>|-?->|!->)' };
321 const CLASS_DEFINITION
= {
336 4: "title.class.inherited"
344 keywords: KEYWORDS
$1,
346 contains: EXPRESSIONS
.concat([
347 hljs
.COMMENT('\\/\\*', '\\*\\/'),
348 hljs
.HASH_COMMENT_MODE
,
349 SYMBOLS
, // relevance booster
351 className: 'function',
359 begin: '(' + JS_IDENT_RE
+ '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B->\\*?',
363 begin: '(' + JS_IDENT_RE
+ '\\s*(?:=|:=)\\s*)?!?(\\(.*\\)\\s*)?\\B[-~]{1,2}>\\*?',
364 end: '[-~]{1,2}>\\*?'
367 begin: '(' + JS_IDENT_RE
+ '\\s*(?:=|:=)\\s*)?(\\(.*\\)\\s*)?\\B!?[-~]{1,2}>\\*?',
368 end: '!?[-~]{1,2}>\\*?'
374 begin: JS_IDENT_RE
+ ':',
388 export default hljsGrammar
;