( selector, parseOnly )
| 2266 | Expr.setFilters = new setFilters(); |
| 2267 | |
| 2268 | function tokenize( selector, parseOnly ) { |
| 2269 | var matched, match, tokens, type, |
| 2270 | soFar, groups, preFilters, |
| 2271 | cached = tokenCache[ selector + " " ]; |
| 2272 | |
| 2273 | if ( cached ) { |
| 2274 | return parseOnly ? 0 : cached.slice( 0 ); |
| 2275 | } |
| 2276 | |
| 2277 | soFar = selector; |
| 2278 | groups = []; |
| 2279 | preFilters = Expr.preFilter; |
| 2280 | |
| 2281 | while ( soFar ) { |
| 2282 | |
| 2283 | // Comma and first run |
| 2284 | if ( !matched || (match = rcomma.exec( soFar )) ) { |
| 2285 | if ( match ) { |
| 2286 | // Don't consume trailing commas as valid |
| 2287 | soFar = soFar.slice( match[0].length ) || soFar; |
| 2288 | } |
| 2289 | groups.push( tokens = [] ); |
| 2290 | } |
| 2291 | |
| 2292 | matched = false; |
| 2293 | |
| 2294 | // Combinators |
| 2295 | if ( (match = rcombinators.exec( soFar )) ) { |
| 2296 | matched = match.shift(); |
| 2297 | tokens.push({ |
| 2298 | value: matched, |
| 2299 | // Cast descendant combinators to space |
| 2300 | type: match[0].replace( rtrim, " " ) |
| 2301 | }); |
| 2302 | soFar = soFar.slice( matched.length ); |
| 2303 | } |
| 2304 | |
| 2305 | // Filters |
| 2306 | for ( type in Expr.filter ) { |
| 2307 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
| 2308 | (match = preFilters[ type ]( match ))) ) { |
| 2309 | matched = match.shift(); |
| 2310 | tokens.push({ |
| 2311 | value: matched, |
| 2312 | type: type, |
| 2313 | matches: match |
| 2314 | }); |
| 2315 | soFar = soFar.slice( matched.length ); |
| 2316 | } |
| 2317 | } |
| 2318 | |
| 2319 | if ( !matched ) { |
| 2320 | break; |
| 2321 | } |
| 2322 | } |
| 2323 | |
| 2324 | // Return the length of the invalid excess |
| 2325 | // if we're just parsing |
no outgoing calls
no test coverage detected