(ts, stopToken, nested = false)
| 2693 | * @returns {ComponentValue[]} consumed component values |
| 2694 | */ |
| 2695 | const 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. |
no test coverage detected