]>
luflow.net public git repositories - flow-web.git/blob - static/highlight/es/languages/groovy.js
1 /*! `groovy` grammar compiled for Highlight.js 11.11.1 */
2 var hljsGrammar
= (function () {
7 Author: Guillaume Laforge <glaforge@gmail.com>
8 Description: Groovy programming language implementation inspired from Vsevolod's Java mode
9 Website: https://groovy-lang.org
13 function variants(variants
, obj
= {}) {
14 obj
.variants
= variants
;
18 function groovy(hljs
) {
19 const regex
= hljs
.regex
;
20 const IDENT_RE
= '[A-Za-z0-9_$]+';
21 const COMMENT
= variants([
22 hljs
.C_LINE_COMMENT_MODE
,
23 hljs
.C_BLOCK_COMMENT_MODE
,
31 // eat up @'s in emails to prevent them to be recognized as doctags
45 begin: /~?\/[^\/\n]+\//,
46 contains: [ hljs
.BACKSLASH_ESCAPE
]
48 const NUMBER
= variants([
49 hljs
.BINARY_NUMBER_MODE
,
52 const STRING
= variants([
66 hljs
.APOS_STRING_MODE
,
67 hljs
.QUOTE_STRING_MODE
69 { className: "string" }
72 const CLASS_DEFINITION
= {
74 /(class|interface|trait|enum|record|extends|implements)/,
76 hljs
.UNDERSCORE_IDENT_RE
95 // groovy specific keywords
101 // common keywords with Java
141 "variable.language": 'this super',
142 literal: 'true false null',
162 // highlight map keys and named parameters as attrs
164 begin: IDENT_RE
+ '[ \t]*:',
168 // catch middle element of the ternary operator
169 // to avoid highlight it as a label, named parameter, or map key
182 // highlight labeled statements
184 begin: '^[ \t]*' + regex
.lookahead(IDENT_RE
+ ':'),
198 export default hljsGrammar
;