diff --git a/src/parser/cssParser.ts b/src/parser/cssParser.ts index 4653f70c..5811965f 100644 --- a/src/parser/cssParser.ts +++ b/src/parser/cssParser.ts @@ -950,11 +950,10 @@ export class Parser { public _parseLayerName(): nodes.Node | null { // = [ '.' ]* - if (!this.peek(TokenType.Ident)) { + const node = this.createNode(nodes.NodeType.LayerName); + if (!node.addChild(this._parseIdent()) ) { return null; } - const node = this.createNode(nodes.NodeType.LayerName); - node.addChild(this._parseIdent()); while (!this.hasWhitespace() && this.acceptDelim('.')) { if (this.hasWhitespace() || !node.addChild(this._parseIdent())) { return this.finish(node, ParseError.IdentifierExpected); diff --git a/src/parser/cssScanner.ts b/src/parser/cssScanner.ts index e8058e2d..049c18ed 100644 --- a/src/parser/cssScanner.ts +++ b/src/parser/cssScanner.ts @@ -47,8 +47,8 @@ export enum TokenType { Comment, SingleLineComment, EOF, - CustomToken, - ContainerQueryLength + ContainerQueryLength, + CustomToken // must be last token type } export interface IToken { diff --git a/src/test/scss/parser.test.ts b/src/test/scss/parser.test.ts index a7b4161e..f17874ad 100644 --- a/src/test/scss/parser.test.ts +++ b/src/test/scss/parser.test.ts @@ -283,6 +283,16 @@ suite('SCSS - Parser', () => { assertNode('@import url("override.css") layer;', parser, parser._parseStylesheet.bind(parser)); }); + test('@layer', function () { + const parser = new SCSSParser(); + assertNode('@layer #{$layer} { }', parser, parser._parseLayer.bind(parser)); + }); + + test('@container', function () { + const parser = new SCSSParser(); + assertNode(`@container (min-width: #{$minWidth}) { .scss-interpolation { line-height: 10cqh; } }`, parser, parser._parseStylesheet.bind(parser)); + }); + test('@use', function () { const parser = new SCSSParser(); assertNode('@use "test"', parser, parser._parseUse.bind(parser));