( selector, parseOnly )
| 5012 | } |
| 5013 | |
| 5014 | function tokenize( selector, parseOnly ) { |
| 5015 | var matched, match, tokens, type, |
| 5016 | soFar, groups, preFilters, |
| 5017 | cached = tokenCache[ selector + " " ]; |
| 5018 | |
| 5019 | if ( cached ) { |
| 5020 | return parseOnly ? 0 : cached.slice( 0 ); |
| 5021 | } |
| 5022 | |
| 5023 | soFar = selector; |
| 5024 | groups = []; |
| 5025 | preFilters = Expr.preFilter; |
| 5026 | |
| 5027 | while ( soFar ) { |
| 5028 | |
| 5029 | // Comma and first run |
| 5030 | if ( !matched || (match = rcomma.exec( soFar )) ) { |
| 5031 | if ( match ) { |
| 5032 | // Don't consume trailing commas as valid |
| 5033 | soFar = soFar.slice( match[0].length ) || soFar; |
| 5034 | } |
| 5035 | groups.push( tokens = [] ); |
| 5036 | } |
| 5037 | |
| 5038 | matched = false; |
| 5039 | |
| 5040 | // Combinators |
| 5041 | if ( (match = rcombinators.exec( soFar )) ) { |
| 5042 | matched = match.shift(); |
| 5043 | tokens.push( { |
| 5044 | value: matched, |
| 5045 | // Cast descendant combinators to space |
| 5046 | type: match[0].replace( rtrim, " " ) |
| 5047 | } ); |
| 5048 | soFar = soFar.slice( matched.length ); |
| 5049 | } |
| 5050 | |
| 5051 | // Filters |
| 5052 | for ( type in Expr.filter ) { |
| 5053 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
| 5054 | (match = preFilters[ type ]( match ))) ) { |
| 5055 | matched = match.shift(); |
| 5056 | tokens.push( { |
| 5057 | value: matched, |
| 5058 | type: type, |
| 5059 | matches: match |
| 5060 | } ); |
| 5061 | soFar = soFar.slice( matched.length ); |
| 5062 | } |
| 5063 | } |
| 5064 | |
| 5065 | if ( !matched ) { |
| 5066 | break; |
| 5067 | } |
| 5068 | } |
| 5069 | |
| 5070 | // Return the length of the invalid excess |
| 5071 | // if we're just parsing |
no outgoing calls
no test coverage detected