@@ -923,11 +923,20 @@ abstract class StylesheetParser extends Parser {
923
923
deprecation: Deprecation .cssFunctionMixin,
924
924
message:
925
925
'Sass @function names beginning with -- are deprecated for forward-'
926
- 'compatibility with plain CSS mixins .\n '
926
+ 'compatibility with plain CSS functions .\n '
927
927
'\n '
928
928
'For details, see https://sass-lang.com/d/css-function-mixin' ,
929
929
span: scanner.spanFrom (beforeName),
930
930
));
931
+ } else if (equalsIgnoreCase (name, 'type' )) {
932
+ warnings.add ((
933
+ deprecation: Deprecation .typeFunction,
934
+ message: 'Sass @functions named "type" are deprecated for forward-'
935
+ 'compatibility with the plain CSS type() function.\n '
936
+ '\n '
937
+ 'For details, see https://sass-lang.com/d/type-function' ,
938
+ span: scanner.spanFrom (beforeName),
939
+ ));
931
940
}
932
941
933
942
whitespace (consumeNewlines: true );
@@ -2079,7 +2088,6 @@ abstract class StylesheetParser extends Parser {
2079
2088
operators.last.precedence >= operator .precedence) {
2080
2089
resolveOneOperation ();
2081
2090
}
2082
- operators.add (operator );
2083
2091
2084
2092
var singleExpression = singleExpression_;
2085
2093
if (singleExpression == null ) {
@@ -2089,9 +2097,16 @@ abstract class StylesheetParser extends Parser {
2089
2097
length: operator .operator .length,
2090
2098
);
2091
2099
}
2092
- operands.add (singleExpression);
2093
2100
whitespace (consumeNewlines: true );
2094
- singleExpression_ = _singleExpression ();
2101
+
2102
+ if (operator == BinaryOperator .modulo && ! _lookingAtExpression ()) {
2103
+ addSingleExpression (StringExpression .plain (
2104
+ '%' , scanner.spanFromPosition (scanner.position - 1 )));
2105
+ } else {
2106
+ operators.add (operator );
2107
+ operands.add (singleExpression);
2108
+ singleExpression_ = _singleExpression ();
2109
+ }
2095
2110
}
2096
2111
2097
2112
void resolveSpaceExpressions () {
@@ -2353,6 +2368,7 @@ abstract class StylesheetParser extends Parser {
2353
2368
$plus => _plusExpression (),
2354
2369
$minus => _minusExpression (),
2355
2370
$exclamation => _importantExpression (),
2371
+ $percent => _percentExpression (),
2356
2372
// dart-lang/sdk#52740
2357
2373
// ignore: non_constant_relational_pattern_expression
2358
2374
$u || $U when scanner.peekChar (1 ) == $plus => _unicodeRange (),
@@ -2553,6 +2569,15 @@ abstract class StylesheetParser extends Parser {
2553
2569
return StringExpression .plain ("!important" , scanner.spanFrom (start));
2554
2570
}
2555
2571
2572
+ /// Consumes a `%` expression.
2573
+ Expression _percentExpression () {
2574
+ assert (scanner.peekChar () == $percent);
2575
+
2576
+ var start = scanner.state;
2577
+ scanner.readChar ();
2578
+ return StringExpression .plain ("%" , scanner.spanFrom (start));
2579
+ }
2580
+
2556
2581
/// Consumes a unary operation expression.
2557
2582
UnaryOperationExpression _unaryOperation () {
2558
2583
var start = scanner.state;
@@ -3799,6 +3824,7 @@ abstract class StylesheetParser extends Parser {
3799
3824
$backslash ||
3800
3825
$dollar ||
3801
3826
$ampersand ||
3827
+ $percent ||
3802
3828
int (isNameStart: true ) ||
3803
3829
int (isDigit: true ) =>
3804
3830
true ,
0 commit comments