From fc39f0d5a631f62a9127d8b46a638a3e452c7df7 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 19 Oct 2022 19:15:53 +0300 Subject: [PATCH] parserlib: dot-separated layer names --- js/csslint/parserlib.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/csslint/parserlib.js b/js/csslint/parserlib.js index d01ff18d..002ac356 100644 --- a/js/csslint/parserlib.js +++ b/js/csslint/parserlib.js @@ -3503,7 +3503,7 @@ self.parserlib = (() => { do { this._ws(); if ((t = stream.get(true)).type === Tokens.IDENT) { - ids.push(t.value); + ids.push(this._layerName(t)); this._ws(); t = stream.get(true); } @@ -3521,6 +3521,16 @@ self.parserlib = (() => { this._ws(); } + _layerName(start) { + let res = ''; + const stream = this._tokenStream; + for (let t; (t = start || stream.match(Tokens.IDENT));) { + res += t.value + (stream.match(Tokens.DOT) ? '.' : ''); + start = false; + } + return res; + } + _stylesheet() { const stream = this._tokenStream; this.fire('startstylesheet'); @@ -3590,7 +3600,7 @@ self.parserlib = (() => { this._ws(); t = stream.get(true); if (/^layer(\()?$/i.test(t.value)) { - layer = RegExp.$1 ? stream.mustMatch(Tokens.IDENT) : ''; + layer = RegExp.$1 ? this._layerName() : ''; if (layer) stream.mustMatch(Tokens.RPAREN); this._ws(); t = stream.get(true);