MCPcopy
hub / github.com/webpack/webpack / consumeAListOfComponentValues

Function consumeAListOfComponentValues

lib/css/syntax.js:2695–2720  ·  view source on GitHub ↗
(ts, stopToken, nested = false)

Source from the content-addressed store, hash-verified

2693 * @returns {ComponentValue[]} consumed component values
2694 */
2695const consumeAListOfComponentValues = (ts, stopToken, nested = false) => {
2696 /** @type {ComponentValue[]} */
2697 const values = [];
2698 // Process input
2699 for (;;) {
2700 const t = ts.next();
2701
2702 // <eof-token>
2703 // stop token (if passed)
2704 // Return values.
2705 if (t.type === TT_EOF || t.type === stopToken) {
2706 return values;
2707 }
2708 // <}-token>
2709 // If nested is true, return values.
2710 // Otherwise, this is a parse error. Consume a token from input and append the result to values.
2711 if (t.type === TT_RIGHT_CURLY_BRACKET) {
2712 if (nested) return values;
2713 values.push(consumeATokenAsNode(ts));
2714 continue;
2715 }
2716 // anything else
2717 // Consume a component value from input, and append the result to values.
2718 values.push(consumeAComponentValue(ts, t));
2719 }
2720};
2721
2722/**
2723 * Consume a component value, CSS Syntax Level 3 [§5.4.8](https://drafts.csswg.org/css-syntax/#consume-component-value) — consumes the next value (simple block, function, or single token); callers guard against EOF before calling.

Calls 4

consumeATokenAsNodeFunction · 0.85
consumeAComponentValueFunction · 0.85
nextMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected