11Prism . languages . scss = Prism . languages . extend ( 'css' , {
22 'comment' : {
3- pattern : / ( ^ | [ ^ \\ ] ) ( \/ \* [ \w \W ] * ?\* \/ | \/ \/ .* ? ( \r ? \n | $ ) ) / ,
3+ pattern : / ( ^ | [ ^ \\ ] ) (?: \/ \* [ \w \W ] * ?\* \/ | \/ \/ .* ) / ,
44 lookbehind : true
55 } ,
66 'atrule' : {
7- pattern : / @ [ \w - ] + (?: \( [ ^ ( ) ] + \) | [ ^ ( ] ) * ?(? = \s + ( \{ | ; ) ) / i ,
7+ pattern : / @ [ \w - ] + (?: \( [ ^ ( ) ] + \) | [ ^ ( ] ) * ?(? = \s + [ { ; ] ) / ,
88 inside : {
99 'rule' : / @ [ \w - ] + /
1010 // See rest below
1111 }
1212 } ,
1313 // url, compassified
14- 'url' : / ( [ - a - z ] + - ) * u r l (? = \( ) / i,
14+ 'url' : / (?: [ - a - z ] + - ) * u r l (? = \( ) / i,
1515 // CSS selector regex is not appropriate for Sass
1616 // since there can be lot more things (var, @ directive, nesting..)
1717 // a selector must start at the end of a property or after a brace (end of other rules or nesting)
18- // it can contain some caracters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
18+ // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
1919 // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
2020 // can "pass" as a selector- e.g: proper#{$erty})
21- // this one was ard to do, so please be careful if you edit this one :)
21+ // this one was hard to do, so please be careful if you edit this one :)
2222 'selector' : {
23- pattern : / ( [ ^ @ ; \{ \} \( \) ] ? ( [ ^ @ ; \{ \} \( \) ] | & | # \{ \$ [ - _ \w ] + \} ) + ) (? = \s * \{ ( \} | \s | [ ^ \} ] + ( : | \{ ) [ ^ \} ] + ) ) / m,
23+ // Initial look-ahead is used to prevent matching of blank selectors
24+ pattern : / (? = \S ) [ ^ @ ; \{ \} \( \) ] ? ( [ ^ @ ; \{ \} \( \) ] | & | # \{ \$ [ - _ \w ] + \} ) + (? = \s * \{ ( \} | \s | [ ^ \} ] + ( : | \{ ) [ ^ \} ] + ) ) / m,
2425 inside : {
25- 'placeholder' : / % [ - _ \w ] + / i
26+ 'placeholder' : / % [ - _ \w ] + /
2627 }
2728 }
2829} ) ;
2930
3031Prism . languages . insertBefore ( 'scss' , 'atrule' , {
31- 'keyword' : / @ ( i f | e l s e i f | e l s e | f o r | e a c h | w h i l e | i m p o r t | e x t e n d | d e b u g | w a r n | m i x i n | i n c l u d e | f u n c t i o n | r e t u r n | c o n t e n t ) | (? = @ f o r \s + \$ [ - _ \w ] + \s ) + f r o m / i
32+ 'keyword' : [
33+ / @ (?: i f | e l s e (?: i f ) ? | f o r | e a c h | w h i l e | i m p o r t | e x t e n d | d e b u g | w a r n | m i x i n | i n c l u d e | f u n c t i o n | r e t u r n | c o n t e n t ) / i,
34+ {
35+ pattern : / ( + ) (?: f r o m | t h r o u g h ) (? = ) / ,
36+ lookbehind : true
37+ }
38+ ]
3239} ) ;
3340
3441Prism . languages . insertBefore ( 'scss' , 'property' , {
3542 // var and interpolated vars
36- 'variable' : / ( ( \$ [ - _ \w ] + ) | ( # \{ \$ [ - _ \w ] + \} ) ) / i
43+ 'variable' : / \$ [ - _ \w ] + | # \{ \$ [ - _ \w ] + \} /
3744} ) ;
3845
3946Prism . languages . insertBefore ( 'scss' , 'function' , {
4047 'placeholder' : {
41- pattern : / % [ - _ \w ] + / i ,
48+ pattern : / % [ - _ \w ] + / ,
4249 alias : 'selector'
4350 } ,
44- 'statement' : / \B ! ( d e f a u l t | o p t i o n a l ) \b / i,
45- 'boolean' : / \b ( t r u e | f a l s e ) \b / ,
46- 'null' : / \b ( n u l l ) \b / ,
47- 'operator' : / \s + ( [ - + ] { 1 , 2 } | = { 1 , 2 } | ! = | \| ? \| | \? | \* | \/ | % ) \s + /
51+ 'statement' : / \B ! (?: d e f a u l t | o p t i o n a l ) \b / i,
52+ 'boolean' : / \b (?: t r u e | f a l s e ) \b / ,
53+ 'null' : / \b n u l l \b / ,
54+ 'operator' : {
55+ pattern : / ( \s ) (?: [ - + * \/ % ] | [ = ! ] = | < = ? | > = ? | a n d | o r | n o t ) (? = \s ) / ,
56+ lookbehind : true
57+ }
4858} ) ;
4959
5060Prism . languages . scss [ 'atrule' ] . inside . rest = Prism . util . clone ( Prism . languages . scss ) ;
0 commit comments