(input)
| 114 | * @returns {string} input reconstructed from token source slices |
| 115 | */ |
| 116 | const tokenRoundtrip = (input) => { |
| 117 | let out = ""; |
| 118 | for (let pos = 0; ; ) { |
| 119 | const t = readToken( |
| 120 | input, |
| 121 | pos, |
| 122 | /** @type {import("../lib/css/syntax").MutableToken} */ ({}) |
| 123 | ); |
| 124 | if (t === undefined) break; |
| 125 | pos = t.end; |
| 126 | out += input.slice(t.start, t.end); |
| 127 | } |
| 128 | return out; |
| 129 | }; |
| 130 | |
| 131 | // Regressions from the css-parsing-tests corpus: each input previously hung |
| 132 | // the parser or dropped bytes from the token stream. |
no test coverage detected