speed up regex for block comments
This commit is contained in:
parent
484ff24950
commit
00b732177f
|
@ -622,7 +622,7 @@ function SectionsEditor() {
|
|||
const text = event.clipboardData.getData('text') || '';
|
||||
if (/@-moz-document/i.test(text) &&
|
||||
/@-moz-document\s+(url|url-prefix|domain|regexp)\(/i
|
||||
.test(text.replace(/\/\*([^*]|\*(?!\/))*(\*\/|$)/g, ''))
|
||||
.test(text.replace(/\/\*([^*]+|\*(?!\/))*(\*\/|$)/g, ''))
|
||||
) {
|
||||
event.preventDefault();
|
||||
showMozillaFormatImport(text);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
'(?=[\\s;(){}[\\]/"!]|$)' +
|
||||
')', 'gi');
|
||||
const RX_DETECT_FUNC = /((rgb|hsl)a?|hwb)\(/iy;
|
||||
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
|
||||
const RX_COMMENT = /\/\*([^*]+|\*(?!\/))*(\*\/|$)/g;
|
||||
const SPACE1K = ' '.repeat(1000);
|
||||
|
||||
// milliseconds to work on invisible colors per one run
|
||||
|
|
|
@ -112,7 +112,7 @@ class Reporter {
|
|||
//eslint-disable-next-line no-var
|
||||
var CSSLint = (() => {
|
||||
|
||||
const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]|\*(?!\/))+?)\*\//ig;
|
||||
const RX_EMBEDDED = /\/\*\s*csslint\s+((?:[^*]+|\*(?!\/))+?)\*\//ig;
|
||||
const EBMEDDED_RULE_VALUE_MAP = {
|
||||
// error
|
||||
'true': 2,
|
||||
|
|
|
@ -3104,7 +3104,7 @@ self.parserlib = (() => {
|
|||
readComment(first) {
|
||||
return first +
|
||||
this._reader.readCount(2 - first.length) +
|
||||
this._reader.readMatch(/([^*]|\*(?!\/))*(\*\/|$)/y);
|
||||
this._reader.readMatch(/([^*]+|\*(?!\/))*(\*\/|$)/y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,7 @@ function styleCodeEmpty(code) {
|
|||
return true;
|
||||
}
|
||||
let lastIndex = 0;
|
||||
const rx = /\s+|\/\*([^*]|\*(?!\/))*(\*\/|$)|@namespace[^;]+;|@charset[^;]+;/giyu;
|
||||
const rx = /\s+|\/\*([^*]+|\*(?!\/))*(\*\/|$)|@namespace[^;]+;|@charset[^;]+;/giyu;
|
||||
while (rx.exec(code)) {
|
||||
lastIndex = rx.lastIndex;
|
||||
if (lastIndex === code.length) {
|
||||
|
|
|
@ -8,7 +8,7 @@ function testGlobalCss() {
|
|||
const css = fs.readFileSync('global.css', {encoding: 'utf8'});
|
||||
const ERR = 'global.css: missing the transition suppressor rule';
|
||||
const RX_SUPPRESSOR = /[^{}]+#\\1\s?transition-suppressor[^{}]+{\s*transition:\s*none\s*!\s*important/i;
|
||||
const RX_COMMENT = /\/\*([^*]|\*(?!\/))*(\*\/|$)/g;
|
||||
const RX_COMMENT = /\/\*([^*]+|\*(?!\/))*(\*\/|$)/g;
|
||||
if (!RX_SUPPRESSOR.test(css.replace(RX_COMMENT, ''))) {
|
||||
console.error(ERR);
|
||||
process.exit(1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user