From 42d6e2f2af5704f3514c9f70fa4e163ad71213f1 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 18 Jan 2022 20:24:41 +0300 Subject: [PATCH] parserlib: reimplement d9a80623 properly --- js/csslint/parserlib.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/csslint/parserlib.js b/js/csslint/parserlib.js index 55d6e0bd..546aad70 100644 --- a/js/csslint/parserlib.js +++ b/js/csslint/parserlib.js @@ -4381,18 +4381,10 @@ self.parserlib = (() => { let next, tt; while ((next = stream.get(true)).value !== '}' && (tt = next.type)) { try { - // Pre-check to avoid calling _ws too much as it's wasteful - if (tt === Tokens.S || - tt === Tokens.COMMENT || - tt === Tokens.USO_VAR) { - this._ws(next, true); - tt = 0; - } if (tt === Tokens.SEMICOLON || + this._ws(next, true) || readMargins && this._margin() || - (tt && stream.unget(), this._declaration(true, Props)) || - (next = stream.LT(1)).value === ';' || - this._ws(null, true)) { + (stream.unget(), this._declaration(true, Props))) { continue; } break; @@ -4427,6 +4419,14 @@ self.parserlib = (() => { } _ws(start, skipUsoVar) { + const tt = start && start.type; + if (tt && !( + tt === Tokens.S || + tt === Tokens.COMMENT || + tt === Tokens.USO_VAR && skipUsoVar + )) { + return ''; + } const stream = this._tokenStream; const tokens = skipUsoVar ? TT.usoS : Tokens.S; let ws = start ? start.value : '';