]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/languages/wren.js
1 /*! `wren` grammar compiled for Highlight.js 11.11.1 */
3 var hljsGrammar
= (function () {
8 Description: Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a familiar, modern syntax.
11 Maintainer: @joshgoebel
12 Website: https://wren.io/
15 /** @type LanguageFn */
17 const regex
= hljs
.regex
;
18 const IDENT_RE
= /[a-zA-Z]\w*/;
42 const LANGUAGE_VARS
= [
46 const CORE_CLASSES
= [
89 match: regex
.concat(/\b(?!(if|while|for|else|super)\b)/, IDENT_RE
, /(?=\s*[({])/),
90 className: "title.function"
92 const FUNCTION_DEFINITION
= {
95 regex
.concat(/\b(?!(if|while|for|else|super)\b)/, IDENT_RE
),
96 regex
.either(...OPERATORS
)
98 /(?=\s*\([^)]+\)\s*\{)/),
99 className: "title.function",
100 starts: { contains: [
114 const CLASS_DEFINITION
= {
129 4: "title.class.inherited"
136 match: regex
.either(...OPERATORS
),
137 className: "operator"
140 const TRIPLE_STRING
= {
147 className: "property",
148 begin: regex
.concat(/\./, regex
.lookahead(IDENT_RE
)),
156 match: regex
.concat(/\b_/, IDENT_RE
),
161 const CLASS_REFERENCE
= {
163 match: /\b[A-Z]+[a-z]+([A-Z]+[a-z]+)*/,
164 scope: "title.class",
165 keywords: { _: CORE_CLASSES
}
168 // TODO: add custom number modes
169 const NUMBER
= hljs
.C_NUMBER_MODE
;
188 const COMMENT_DOCS
= hljs
.COMMENT(
218 scope: "char.escape",
220 { match: /\\\\|\\["0%abefnrtv]/ },
221 { match: /\\x[0-9A-F]{2}/ },
222 { match: /\\u[0-9A-F]{4}/ },
223 { match: /\\U[0-9A-F]{8}/ }
228 SUBST
.contains
.push(STRING
);
241 /[a-zA-Z_]\w*(?:[?!]|\b)/
243 className: "variable"
246 // TODO: reconsider this in the future
259 keywords: { literal: LITERALS
},
283 "variable.language": LANGUAGE_VARS
,
292 hljs
.C_LINE_COMMENT_MODE
,
293 hljs
.C_BLOCK_COMMENT_MODE
,
311 hljs
.registerLanguage('wren', hljsGrammar
);