main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | (function (Prism) {
|
---|
| 2 | var interpolation = {
|
---|
| 3 | pattern: /((?:^|[^\\$])(?:\\{2})*)\$(?:\w+|\{[^{}]*\})/,
|
---|
| 4 | lookbehind: true,
|
---|
| 5 | inside: {
|
---|
| 6 | 'interpolation-punctuation': {
|
---|
| 7 | pattern: /^\$\{?|\}$/,
|
---|
| 8 | alias: 'punctuation',
|
---|
| 9 | },
|
---|
| 10 | 'expression': {
|
---|
| 11 | pattern: /[\s\S]+/,
|
---|
| 12 | inside: null,
|
---|
| 13 | },
|
---|
| 14 | },
|
---|
| 15 | };
|
---|
| 16 |
|
---|
| 17 | Prism.languages.gradle = Prism.languages.extend('clike', {
|
---|
| 18 | 'string': {
|
---|
| 19 | pattern: /'''(?:[^\\]|\\[\s\S])*?'''|'(?:\\.|[^\\'\r\n])*'/,
|
---|
| 20 | greedy: true,
|
---|
| 21 | },
|
---|
| 22 | 'keyword':
|
---|
| 23 | /\b(?:apply|def|dependencies|else|if|implementation|import|plugin|plugins|project|repositories|repository|sourceSets|tasks|val)\b/,
|
---|
| 24 | 'number': /\b(?:0b[01_]+|0x[\da-f_]+(?:\.[\da-f_p\-]+)?|[\d_]+(?:\.[\d_]+)?(?:e[+-]?\d+)?)[glidf]?\b/i,
|
---|
| 25 | 'operator': {
|
---|
| 26 | pattern:
|
---|
| 27 | /(^|[^.])(?:~|==?~?|\?[.:]?|\*(?:[.=]|\*=?)?|\.[@&]|\.\.<|\.\.(?!\.)|-[-=>]?|\+[+=]?|!=?|<(?:<=?|=>?)?|>(?:>>?=?|=)?|&[&=]?|\|[|=]?|\/=?|\^=?|%=?)/,
|
---|
| 28 | lookbehind: true,
|
---|
| 29 | },
|
---|
| 30 | 'punctuation': /\.+|[{}[\];(),:$]/,
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | Prism.languages.insertBefore('gradle', 'string', {
|
---|
| 34 | 'shebang': {
|
---|
| 35 | pattern: /#!.+/,
|
---|
| 36 | alias: 'comment',
|
---|
| 37 | greedy: true,
|
---|
| 38 | },
|
---|
| 39 | 'interpolation-string': {
|
---|
| 40 | pattern:
|
---|
| 41 | /"""(?:[^\\]|\\[\s\S])*?"""|(["/])(?:\\.|(?!\1)[^\\\r\n])*\1|\$\/(?:[^/$]|\$(?:[/$]|(?![/$]))|\/(?!\$))*\/\$/,
|
---|
| 42 | greedy: true,
|
---|
| 43 | inside: {
|
---|
| 44 | 'interpolation': interpolation,
|
---|
| 45 | 'string': /[\s\S]+/,
|
---|
| 46 | },
|
---|
| 47 | },
|
---|
| 48 | });
|
---|
| 49 |
|
---|
| 50 | Prism.languages.insertBefore('gradle', 'punctuation', {
|
---|
| 51 | 'spock-block': /\b(?:and|cleanup|expect|given|setup|then|when|where):/,
|
---|
| 52 | });
|
---|
| 53 |
|
---|
| 54 | Prism.languages.insertBefore('gradle', 'function', {
|
---|
| 55 | 'annotation': {
|
---|
| 56 | pattern: /(^|[^.])@\w+/,
|
---|
| 57 | lookbehind: true,
|
---|
| 58 | alias: 'punctuation',
|
---|
| 59 | },
|
---|
| 60 | });
|
---|
| 61 |
|
---|
| 62 | interpolation.inside.expression.inside = Prism.languages.gradle;
|
---|
| 63 | }(Prism));
|
---|
Note:
See
TracBrowser
for help on using the repository browser.