MCPcopy Create free account
hub / github.com/ceph/ceph / tokenize

Function tokenize

qa/workunits/erasure-code/jquery.js:4683–4744  ·  view source on GitHub ↗
( selector, parseOnly )

Source from the content-addressed store, hash-verified

4681};
4682
4683function tokenize( selector, parseOnly ) {
4684 var matched, match, tokens, type,
4685 soFar, groups, preFilters,
4686 cached = tokenCache[ expando ][ selector + " " ];
4687
4688 if ( cached ) {
4689 return parseOnly ? 0 : cached.slice( 0 );
4690 }
4691
4692 soFar = selector;
4693 groups = [];
4694 preFilters = Expr.preFilter;
4695
4696 while ( soFar ) {
4697
4698 // Comma and first run
4699 if ( !matched || (match = rcomma.exec( soFar )) ) {
4700 if ( match ) {
4701 // Don't consume trailing commas as valid
4702 soFar = soFar.slice( match[0].length ) || soFar;
4703 }
4704 groups.push( tokens = [] );
4705 }
4706
4707 matched = false;
4708
4709 // Combinators
4710 if ( (match = rcombinators.exec( soFar )) ) {
4711 tokens.push( matched = new Token( match.shift() ) );
4712 soFar = soFar.slice( matched.length );
4713
4714 // Cast descendant combinators to space
4715 matched.type = match[0].replace( rtrim, " " );
4716 }
4717
4718 // Filters
4719 for ( type in Expr.filter ) {
4720 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
4721 (match = preFilters[ type ]( match ))) ) {
4722
4723 tokens.push( matched = new Token( match.shift() ) );
4724 soFar = soFar.slice( matched.length );
4725 matched.type = type;
4726 matched.matches = match;
4727 }
4728 }
4729
4730 if ( !matched ) {
4731 break;
4732 }
4733 }
4734
4735 // Return the length of the invalid excess
4736 // if we're just parsing
4737 // Otherwise, throw an error or return tokens
4738 return parseOnly ?
4739 soFar.length :
4740 soFar ?

Callers 2

jquery.jsFile · 0.85
selectFunction · 0.85

Calls 4

execMethod · 0.45
pushMethod · 0.45
replaceMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected