@@ -923,11 +923,20 @@ abstract class StylesheetParser extends Parser {
923923 deprecation: Deprecation .cssFunctionMixin,
924924 message:
925925 'Sass @function names beginning with -- are deprecated for forward-'
926- 'compatibility with plain CSS mixins .\n '
926+ 'compatibility with plain CSS functions .\n '
927927 '\n '
928928 'For details, see https://sass-lang.com/d/css-function-mixin' ,
929929 span: scanner.spanFrom (beforeName),
930930 ));
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+ ));
931940 }
932941
933942 whitespace (consumeNewlines: true );
@@ -2079,7 +2088,6 @@ abstract class StylesheetParser extends Parser {
20792088 operators.last.precedence >= operator .precedence) {
20802089 resolveOneOperation ();
20812090 }
2082- operators.add (operator );
20832091
20842092 var singleExpression = singleExpression_;
20852093 if (singleExpression == null ) {
@@ -2089,9 +2097,16 @@ abstract class StylesheetParser extends Parser {
20892097 length: operator .operator .length,
20902098 );
20912099 }
2092- operands.add (singleExpression);
20932100 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+ }
20952110 }
20962111
20972112 void resolveSpaceExpressions () {
@@ -2353,6 +2368,7 @@ abstract class StylesheetParser extends Parser {
23532368 $plus => _plusExpression (),
23542369 $minus => _minusExpression (),
23552370 $exclamation => _importantExpression (),
2371+ $percent => _percentExpression (),
23562372 // dart-lang/sdk#52740
23572373 // ignore: non_constant_relational_pattern_expression
23582374 $u || $U when scanner.peekChar (1 ) == $plus => _unicodeRange (),
@@ -2553,6 +2569,15 @@ abstract class StylesheetParser extends Parser {
25532569 return StringExpression .plain ("!important" , scanner.spanFrom (start));
25542570 }
25552571
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+
25562581 /// Consumes a unary operation expression.
25572582 UnaryOperationExpression _unaryOperation () {
25582583 var start = scanner.state;
@@ -3799,6 +3824,7 @@ abstract class StylesheetParser extends Parser {
37993824 $backslash ||
38003825 $dollar ||
38013826 $ampersand ||
3827+ $percent ||
38023828 int (isNameStart: true ) ||
38033829 int (isDigit: true ) =>
38043830 true ,
0 commit comments