MCPcopy Index your code
hub / github.com/frank-lam/fullstack-tutorial / tokenize

Function tokenize

notes/docsify/unpkg/gotop/jquery-2.1.0.js:1982–2047  ·  view source on GitHub ↗
( selector, parseOnly )

Source from the content-addressed store, hash-verified

1980Expr.setFilters = new setFilters();
1981
1982function tokenize( selector, parseOnly ) {
1983 var matched, match, tokens, type,
1984 soFar, groups, preFilters,
1985 cached = tokenCache[ selector + " " ];
1986
1987 if ( cached ) {
1988 return parseOnly ? 0 : cached.slice( 0 );
1989 }
1990
1991 soFar = selector;
1992 groups = [];
1993 preFilters = Expr.preFilter;
1994
1995 while ( soFar ) {
1996
1997 // Comma and first run
1998 if ( !matched || (match = rcomma.exec( soFar )) ) {
1999 if ( match ) {
2000 // Don't consume trailing commas as valid
2001 soFar = soFar.slice( match[0].length ) || soFar;
2002 }
2003 groups.push( (tokens = []) );
2004 }
2005
2006 matched = false;
2007
2008 // Combinators
2009 if ( (match = rcombinators.exec( soFar )) ) {
2010 matched = match.shift();
2011 tokens.push({
2012 value: matched,
2013 // Cast descendant combinators to space
2014 type: match[0].replace( rtrim, " " )
2015 });
2016 soFar = soFar.slice( matched.length );
2017 }
2018
2019 // Filters
2020 for ( type in Expr.filter ) {
2021 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2022 (match = preFilters[ type ]( match ))) ) {
2023 matched = match.shift();
2024 tokens.push({
2025 value: matched,
2026 type: type,
2027 matches: match
2028 });
2029 soFar = soFar.slice( matched.length );
2030 }
2031 }
2032
2033 if ( !matched ) {
2034 break;
2035 }
2036 }
2037
2038 // Return the length of the invalid excess
2039 // if we're just parsing

Callers 3

SizzleFunction · 0.85
jquery-2.1.0.jsFile · 0.85
selectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…