(expression: string)
| 177 | } |
| 178 | |
| 179 | function splitByFallback(expression: string): string[] { |
| 180 | const segments: string[] = []; |
| 181 | let current = ''; |
| 182 | let quote: '"' | "'" | null = null; |
| 183 | for (let i = 0; i < expression.length; i += 1) { |
| 184 | const ch = expression[i]; |
| 185 | if ((ch === '"' || ch === "'") && !isEscapedQuote(expression, i)) { |
| 186 | quote = updateQuoteState(quote, ch); |
| 187 | current += ch; |
| 188 | continue; |
| 189 | } |
| 190 | if (!quote && ch === '|' && expression[i + 1] === '|') { |
| 191 | const segment = current.trim(); |
| 192 | if (!segment) { |
| 193 | throw new AppError('INVALID_ARGS', `Invalid selector fallback expression: ${expression}`); |
| 194 | } |
| 195 | segments.push(segment); |
| 196 | current = ''; |
| 197 | i += 1; |
| 198 | continue; |
| 199 | } |
| 200 | current += ch; |
| 201 | } |
| 202 | const finalSegment = current.trim(); |
| 203 | if (!finalSegment) { |
| 204 | throw new AppError('INVALID_ARGS', `Invalid selector fallback expression: ${expression}`); |
| 205 | } |
| 206 | segments.push(finalSegment); |
| 207 | return segments; |
| 208 | } |
| 209 | |
| 210 | function tokenize(segment: string): string[] { |
| 211 | const tokens: string[] = []; |
no test coverage detected
searching dependent graphs…