@@ -104,7 +104,7 @@ export class SCSSParser extends cssParser.Parser {
104104 return this . _parseInterpolation ( ) || super . _parseMediaCondition ( ) ;
105105 }
106106
107- public _parseMediaFeatureRangeOperator ( ) : boolean {
107+ public _parseMediaFeatureRangeOperator ( ) : boolean {
108108 return this . accept ( scssScanner . SmallerEqualsOperator ) || this . accept ( scssScanner . GreaterEqualsOperator ) || super . _parseMediaFeatureRangeOperator ( ) ;
109109 }
110110
@@ -816,33 +816,41 @@ export class SCSSParser extends cssParser.Parser {
816816 }
817817
818818 if ( this . acceptIdent ( 'with' ) ) {
819- if ( ! this . accept ( TokenType . ParenthesisL ) ) {
819+ if ( ! node . setParameters ( this . _parseModuleConfig ( ) ) ) {
820820 return this . finish ( node , ParseError . LeftParenthesisExpected , [ TokenType . ParenthesisR ] ) ;
821821 }
822+ }
823+ }
822824
823- // First variable statement, no comma.
824- if ( ! node . getParameters ( ) . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
825- return this . finish ( node , ParseError . VariableNameExpected ) ;
826- }
825+ if ( ! this . accept ( TokenType . SemiColon ) && ! this . accept ( TokenType . EOF ) ) {
826+ return this . finish ( node , ParseError . SemiColonExpected ) ;
827+ }
827828
828- while ( this . accept ( TokenType . Comma ) ) {
829- if ( this . peek ( TokenType . ParenthesisR ) ) {
830- break ;
831- }
832- if ( ! node . getParameters ( ) . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
833- return this . finish ( node , ParseError . VariableNameExpected ) ;
834- }
835- }
829+ return this . finish ( node ) ;
830+ }
836831
837- if ( ! this . accept ( TokenType . ParenthesisR ) ) {
838- return this . finish ( node , ParseError . RightParenthesisExpected ) ;
839- }
832+ public _parseModuleConfig ( ) : nodes . Node | null {
833+ const node = this . createNode ( nodes . NodeType . ModuleConfig ) ;
834+ if ( ! this . accept ( TokenType . ParenthesisL ) ) {
835+ return null ;
836+ }
840837
838+ // First variable statement, no comma.
839+ if ( ! node . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
840+ return this . finish ( node , ParseError . VariableNameExpected ) ;
841+ }
842+
843+ while ( this . accept ( TokenType . Comma ) ) {
844+ if ( this . peek ( TokenType . ParenthesisR ) ) {
845+ break ;
846+ }
847+ if ( ! node . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
848+ return this . finish ( node , ParseError . VariableNameExpected ) ;
841849 }
842850 }
843851
844- if ( ! this . accept ( TokenType . SemiColon ) && ! this . accept ( TokenType . EOF ) ) {
845- return this . finish ( node , ParseError . SemiColonExpected ) ;
852+ if ( ! this . accept ( TokenType . ParenthesisR ) ) {
853+ return this . finish ( node , ParseError . RightParenthesisExpected ) ;
846854 }
847855
848856 return this . finish ( node ) ;
@@ -894,28 +902,10 @@ export class SCSSParser extends cssParser.Parser {
894902 }
895903
896904 if ( this . acceptIdent ( 'with' ) ) {
897- if ( ! this . accept ( TokenType . ParenthesisL ) ) {
905+ if ( ! node . setParameters ( this . _parseModuleConfig ( ) ) ) {
898906 return this . finish ( node , ParseError . LeftParenthesisExpected , [ TokenType . ParenthesisR ] ) ;
899907 }
900908
901- // First variable statement, no comma.
902- if ( ! node . getParameters ( ) . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
903- return this . finish ( node , ParseError . VariableNameExpected ) ;
904- }
905-
906- while ( this . accept ( TokenType . Comma ) ) {
907- if ( this . peek ( TokenType . ParenthesisR ) ) {
908- break ;
909- }
910- if ( ! node . getParameters ( ) . addChild ( this . _parseModuleConfigDeclaration ( ) ) ) {
911- return this . finish ( node , ParseError . VariableNameExpected ) ;
912- }
913- }
914-
915- if ( ! this . accept ( TokenType . ParenthesisR ) ) {
916- return this . finish ( node , ParseError . RightParenthesisExpected ) ;
917- }
918-
919909 } else if ( this . peekIdent ( 'hide' ) || this . peekIdent ( 'show' ) ) {
920910 if ( ! node . addChild ( this . _parseForwardVisibility ( ) ) ) {
921911 return this . finish ( node , ParseError . IdentifierOrVariableExpected ) ;
0 commit comments