Skip to content

Commit

Permalink
parserlib: dot-separated layer names
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Oct 19, 2022
1 parent 1725c0e commit fc39f0d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions js/csslint/parserlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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');
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fc39f0d

Please sign in to comment.