From 0b540fbabd1691c7e5c02f5057d1cacaa9cff059 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 9 Dec 2020 10:38:28 +0300 Subject: [PATCH] parserlib: up to 10% faster first run * inline generation of trivial tokens * remove Tokens.CUSTOM_PROP * allow fit-content keyword as it's used in the wild * add color-scheme * add path() * don't try to validate props with vars * auto-compile function grammar * remove CSS4 color functions * show full error stack --- vendor-overwrites/csslint/parserlib.js | 792 +++++++++++-------------- 1 file changed, 336 insertions(+), 456 deletions(-) diff --git a/vendor-overwrites/csslint/parserlib.js b/vendor-overwrites/csslint/parserlib.js index 11a2889c..5c18bff3 100644 --- a/vendor-overwrites/csslint/parserlib.js +++ b/vendor-overwrites/csslint/parserlib.js @@ -172,7 +172,7 @@ self.parserlib = (() => { 'caret-color': 'auto | ', 'caption-side': 'top | bottom | inline-start | inline-end', 'clear': 'none | right | left | both | inline-start | inline-end', - 'clip': 'rect() | inset-rect() | auto', + 'clip': 'rect( [ | auto ]#{4} ) | auto', 'clip-path': ' | | none', 'clip-rule': 'nonzero | evenodd', 'color': '', @@ -180,6 +180,7 @@ self.parserlib = (() => { 'color-interpolation-filters': 'auto | sRGB | linearRGB', 'color-profile': 1, 'color-rendering': 'auto | optimizeSpeed | optimizeQuality', + 'color-scheme': 'normal | [ light | dark ]+', 'column-count': ' | auto', 'column-fill': 'auto | balance', 'column-gap': '', @@ -197,7 +198,6 @@ self.parserlib = (() => { 'counter-increment': '', 'counter-reset': '', 'counter-set': '', - 'crop': 'rect() | inset-rect() | auto', 'cue': 'cue-after | cue-before', 'cue-after': 1, 'cue-before': 1, @@ -695,9 +695,8 @@ self.parserlib = (() => { '': p => p.type === 'angle' || p.isCalc, '': p => p.text === '0' || p.type === 'angle' || p.isCalc, '': p => p.units && lowerCmp(p.units, 'ar'), - '': p => !p.isAttr, + '': vtIsAttr, '': 'scroll | fixed | local', - '': 'inset() | circle() | ellipse() | polygon()', '': ' | none', '': 'normal | multiply | screen | overlay | darken | lighten | color-dodge | ' + 'color-burn | hard-light | soft-light | difference | exclusion | hue | ' + @@ -707,12 +706,9 @@ self.parserlib = (() => { '': ' | thin | medium | thick', '': 'padding-box | border-box | content-box', '': '', - '': ' | rgb() | rgba() | hsl() | hsla() | hwb() | gray() | ' + - 'device-cmyk() | color() | ', '': 'normal | ', '': 'space-between | space-around | space-evenly | stretch', '': 'center | start | end | flex-start | flex-end', - '': 'ease | ease-in | ease-out | ease-in-out | cubic-bezier()', '': 'contents | none', '': 'flow | flow-root | table | flex | grid | ruby', '': 'table-row-group | table-header-group | table-footer-group | ' + @@ -721,9 +717,6 @@ self.parserlib = (() => { '': 'inline-block | inline-table | inline-flex | inline-grid', '': 'block | inline | run-in', '': p => p.type === 'function' && /^[A-Z0-9]{4}$/i.test(p), - // custom() isn't actually in the spec - '': 'blur() | brightness() | contrast() | custom() | drop-shadow() | ' + - 'grayscale() | hue-rotate() | invert() | opacity() | saturate() | sepia()', '': p => p.type === 'grid' && p.value >= 0 || p.isCalc, '': '', '': 'row | row-reverse | column | column-reverse', @@ -788,22 +781,15 @@ self.parserlib = (() => { '': 'none | forwards | backwards | both', '': p => vtIsIdent(p) && /^(?!(none|unset|initial|inherit)$)-?[a-z_][-a-z0-9_]+$/i.test(p), - '': 'step-start | step-end | steps()', '': p => p.type === 'string', '': 'start | end | left | right | center | justify | match-parent', '': 'solid | double | dotted | dashed | wavy', '