(str, max, isTop)
| 143 | return i >= y; |
| 144 | } |
| 145 | function expand_(str, max, isTop) { |
| 146 | const expansions = []; |
| 147 | const m = (0, balanced_match_1.balanced)("{", "}", str); |
| 148 | if (!m) |
| 149 | return [str]; |
| 150 | const pre = m.pre; |
| 151 | const post = m.post.length ? expand_(m.post, max, false) : [""]; |
| 152 | if (/\$$/.test(m.pre)) { |
| 153 | for (let k = 0; k < post.length && k < max; k++) { |
| 154 | const expansion = pre + "{" + m.body + "}" + post[k]; |
| 155 | expansions.push(expansion); |
| 156 | } |
| 157 | } else { |
| 158 | const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); |
| 159 | const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); |
| 160 | const isSequence = isNumericSequence || isAlphaSequence; |
| 161 | const isOptions = m.body.indexOf(",") >= 0; |
| 162 | if (!isSequence && !isOptions) { |
| 163 | if (m.post.match(/,(?!,).*\}/)) { |
| 164 | str = m.pre + "{" + m.body + escClose + m.post; |
| 165 | return expand_(str, max, true); |
| 166 | } |
| 167 | return [str]; |
| 168 | } |
| 169 | let n; |
| 170 | if (isSequence) { |
| 171 | n = m.body.split(/\.\./); |
| 172 | } else { |
| 173 | n = parseCommaParts(m.body); |
| 174 | if (n.length === 1 && n[0] !== void 0) { |
| 175 | n = expand_(n[0], max, false).map(embrace); |
| 176 | if (n.length === 1) { |
| 177 | return post.map((p) => m.pre + n[0] + p); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | let N; |
| 182 | if (isSequence && n[0] !== void 0 && n[1] !== void 0) { |
| 183 | const x = numeric(n[0]); |
| 184 | const y = numeric(n[1]); |
| 185 | const width = Math.max(n[0].length, n[1].length); |
| 186 | let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1; |
| 187 | let test = lte; |
| 188 | const reverse = y < x; |
| 189 | if (reverse) { |
| 190 | incr *= -1; |
| 191 | test = gte; |
| 192 | } |
| 193 | const pad = n.some(isPadded); |
| 194 | N = []; |
| 195 | for (let i = x; test(i, y); i += incr) { |
| 196 | let c; |
| 197 | if (isAlphaSequence) { |
| 198 | c = String.fromCharCode(i); |
| 199 | if (c === "\\") { |
| 200 | c = ""; |
| 201 | } |
| 202 | } else { |
no test coverage detected
searching dependent graphs…