]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/moonscript.js
1 /*! `moonscript` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
7 Author: Billy Quith <chinbillybilbo@gmail.com>
8 Description: MoonScript is a programming language that transcompiles to Lua.
9 Origin: coffeescript.js
10 Website: http://moonscript.org/
14 function moonscript(hljs
) {
17 // Moonscript keywords
18 'if then not for in while do return else elseif break continue switch and or '
19 + 'unless when class extends super local import export from using',
23 '_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load '
24 + 'loadfile loadstring module next pairs pcall print rawequal rawget rawset require '
25 + 'select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug '
26 + 'io math os package string table'
28 const JS_IDENT_RE
= '[A-Za-z$_][0-9A-Za-z$_]*';
36 hljs
.inherit(hljs
.C_NUMBER_MODE
,
40 } }), // a number tries to eat the following slash to prevent treating it as a regexp
47 contains: [ hljs
.BACKSLASH_ESCAPE
]
53 hljs
.BACKSLASH_ESCAPE
,
60 className: 'built_in',
61 begin: '@__' + hljs
.IDENT_RE
63 { begin: '@' + hljs
.IDENT_RE
// relevance booster on par with CoffeeScript
65 { begin: hljs
.IDENT_RE
+ '\\\\' + hljs
.IDENT_RE
// inst\method
68 SUBST
.contains
= EXPRESSIONS
;
70 const TITLE
= hljs
.inherit(hljs
.TITLE_MODE
, { begin: JS_IDENT_RE
});
71 const POSSIBLE_PARAMS_RE
= '(\\(.*\\)\\s*)?\\B[-=]>';
76 /* We need another contained nameless mode to not have every nested
77 pair of parens to be called "params" */
83 contains: [ 'self' ].concat(EXPRESSIONS
)
93 contains: EXPRESSIONS
.concat([
94 hljs
.COMMENT('--', '$'),
96 className: 'function', // function: -> =>
97 begin: '^\\s*' + JS_IDENT_RE
+ '\\s*=\\s*' + POSSIBLE_PARAMS_RE
,
106 begin: /[\(,:=]\s*/, // anonymous function start
110 className: 'function',
111 begin: POSSIBLE_PARAMS_RE
,
120 beginKeywords: 'class',
122 illegal: /[:="\[\]]/,
125 beginKeywords: 'extends',
126 endsWithParent: true,
127 illegal: /[:="\[\]]/,
134 className: 'name', // table
135 begin: JS_IDENT_RE
+ ':',
149 export default hljsGrammar
;