(
input,
pos,
options = {}
)
| 2204 | * @returns {ComponentValue[][]} comma-separated groups of component values |
| 2205 | */ |
| 2206 | const parseACommaSeparatedListOfComponentValues = ( |
| 2207 | input, |
| 2208 | pos, |
| 2209 | options = {} |
| 2210 | ) => { |
| 2211 | // 1. Normalize input, and set input to the result. |
| 2212 | const ts = normalizeIntoTokenStream(input, pos, options.comment); |
| 2213 | useObjectBackend(ts.locConverter); |
| 2214 | // 2. Let groups be an empty list. |
| 2215 | /** @type {ComponentValue[][]} */ |
| 2216 | const groups = []; |
| 2217 | // 3. While input is not empty: |
| 2218 | while (ts.next().type !== TT_EOF) { |
| 2219 | // 3.1. Consume a list of component values from input, with <comma-token> as the stop token, and append the result to groups. |
| 2220 | groups.push(consumeAListOfComponentValues(ts, TT_COMMA)); |
| 2221 | // 3.2 Discard a token from input. |
| 2222 | ts.discard(); |
| 2223 | } |
| 2224 | // 4. Return groups. |
| 2225 | return groups; |
| 2226 | }; |
| 2227 | |
| 2228 | // === Parser algorithms (CSS Syntax Level 3 §5.4) === |
| 2229 | // The mutually-recursive consume algorithms the `parse*` entry points drive: |
no test coverage detected