1
1
Prism . languages . groovy = Prism . languages . extend ( 'clike' , {
2
- 'keyword' : / \b ( a s | d e f | i n | a b s t r a c t | a s s e r t | b o o l e a n | b r e a k | b y t e | c a s e | c a t c h | c h a r | c l a s s | c o n s t | c o n t i n u e | d e f a u l t | d o | d o u b l e | e l s e | e n u m | e x t e n d s | f i n a l | f i n a l l y | f l o a t | f o r | g o t o | i f | i m p l e m e n t s | i m p o r t | i n s t a n c e o f | i n t | i n t e r f a c e | l o n g | n a t i v e | n e w | p a c k a g e | p r i v a t e | p r o t e c t e d | p u b l i c | r e t u r n | s h o r t | s t a t i c | s t r i c t f p | s u p e r | s w i t c h | s y n c h r o n i z e d | t h i s | t h r o w | t h r o w s | t r a i t | t r a n s i e n t | t r y | v o i d | v o l a t i l e | w h i l e ) \b / ,
2
+ 'keyword' : / \b (?: a s | d e f | i n | a b s t r a c t | a s s e r t | b o o l e a n | b r e a k | b y t e | c a s e | c a t c h | c h a r | c l a s s | c o n s t | c o n t i n u e | d e f a u l t | d o | d o u b l e | e l s e | e n u m | e x t e n d s | f i n a l | f i n a l l y | f l o a t | f o r | g o t o | i f | i m p l e m e n t s | i m p o r t | i n s t a n c e o f | i n t | i n t e r f a c e | l o n g | n a t i v e | n e w | p a c k a g e | p r i v a t e | p r o t e c t e d | p u b l i c | r e t u r n | s h o r t | s t a t i c | s t r i c t f p | s u p e r | s w i t c h | s y n c h r o n i z e d | t h i s | t h r o w | t h r o w s | t r a i t | t r a n s i e n t | t r y | v o i d | v o l a t i l e | w h i l e ) \b / ,
3
3
'string' : [
4
4
{
5
- pattern : / ( " " " | ' ' ' ) [ \s \S ] * ?\1| ( \$ \/ ) ( \$ \/ \$ | [ \s \S ] ) * ?\/ \$ / ,
5
+ pattern : / ( " " " | ' ' ' ) [ \s \S ] * ?\1| (?: \$ \/ ) (?: \$ \/ \$ | [ \s \S ] ) * ?\/ \$ / ,
6
6
greedy : true
7
7
} ,
8
8
{
9
- pattern : / ( " | ' | \/ ) (?: \\ ? . ) * ? \1/ ,
9
+ pattern : / ( [ " ' \/ ] ) (?: \\ . | (? ! \1 ) [ ^ \\ \r \n ] ) * \1/ ,
10
10
greedy : true
11
11
}
12
12
] ,
13
13
'number' : / \b (?: 0 b [ 0 1 _ ] + | 0 x [ \d a - f _ ] + (?: \. [ \d a - f _ p \- ] + ) ? | [ \d _ ] + (?: \. [ \d _ ] + ) ? (?: e [ + - ] ? [ \d ] + ) ? ) [ g l i d f ] ? \b / i,
14
14
'operator' : {
15
- pattern : / ( ^ | [ ^ . ] ) ( ~ | = = ? ~ ? | \? [ . : ] ? | \* (?: [ . = ] | \* = ? ) ? | \. [ @ & ] | \. \. < | \. { 1 , 2 } (? ! \. ) | - [ - = > ] ? | \+ [ + = ] ? | ! = ? | < (?: < = ? | = > ? ) ? | > (?: > > ? = ? | = ) ? | & [ & = ] ? | \| [ | = ] ? | \/ = ? | \^ = ? | % = ? ) / ,
15
+ pattern : / ( ^ | [ ^ . ] ) (?: ~ | = = ? ~ ? | \? [ . : ] ? | \* (?: [ . = ] | \* = ? ) ? | \. [ @ & ] | \. \. < | \. { 1 , 2 } (? ! \. ) | - [ - = > ] ? | \+ [ + = ] ? | ! = ? | < (?: < = ? | = > ? ) ? | > (?: > > ? = ? | = ) ? | & [ & = ] ? | \| [ | = ] ? | \/ = ? | \^ = ? | % = ? ) / ,
16
16
lookbehind : true
17
17
} ,
18
18
'punctuation' : / \. + | [ { } [ \] ; ( ) , : $ ] /
@@ -26,7 +26,7 @@ Prism.languages.insertBefore('groovy', 'string', {
26
26
} ) ;
27
27
28
28
Prism . languages . insertBefore ( 'groovy' , 'punctuation' , {
29
- 'spock-block' : / \b ( s e t u p | g i v e n | w h e n | t h e n | a n d | c l e a n u p | e x p e c t | w h e r e ) : /
29
+ 'spock-block' : / \b (?: s e t u p | g i v e n | w h e n | t h e n | a n d | c l e a n u p | e x p e c t | w h e r e ) : /
30
30
} ) ;
31
31
32
32
Prism . languages . insertBefore ( 'groovy' , 'function' , {
@@ -43,9 +43,9 @@ Prism.hooks.add('wrap', function(env) {
43
43
var delimiter = env . content [ 0 ] ;
44
44
45
45
if ( delimiter != "'" ) {
46
- var pattern = / ( [ ^ \\ ] ) ( \$ ( \{ .* ?\} | [ \w \ .] + ) ) / ;
46
+ var pattern = / ( [ ^ \\ ] ) (?: \$ (?: \{ .* ?\} | [ \w . ] + ) ) / ;
47
47
if ( delimiter === '$' ) {
48
- pattern = / ( [ ^ \$ ] ) ( \$ ( \{ .* ?\} | [ \w \ .] + ) ) / ;
48
+ pattern = / ( [ ^ \$ ] ) (?: \$ (?: \{ .* ?\} | [ \w . ] + ) ) / ;
49
49
}
50
50
51
51
// To prevent double HTML-encoding we have to decode env.content first
0 commit comments