MCPcopy Index your code
hub / github.com/sql-js/sql.js / tokenize

Function tokenize

documentation/javascript/application.js:5545–5631  ·  view source on GitHub ↗
( selector, context, xml, parseOnly )

Source from the content-addressed store, hash-verified

5543};
5544
5545function tokenize( selector, context, xml, parseOnly ) {
5546 var matched, match, tokens, type,
5547 soFar, groups, group, i,
5548 preFilters, filters,
5549 checkContext = !xml && context !== document,
5550 // Token cache should maintain spaces
5551 key = ( checkContext ? "<s>" : "" ) + selector.replace( rtrim, "$1<s>" ),
5552 cached = tokenCache[ expando ][ key ];
5553
5554 if ( cached ) {
5555 return parseOnly ? 0 : slice.call( cached, 0 );
5556 }
5557
5558 soFar = selector;
5559 groups = [];
5560 i = 0;
5561 preFilters = Expr.preFilter;
5562 filters = Expr.filter;
5563
5564 while ( soFar ) {
5565
5566 // Comma and first run
5567 if ( !matched || (match = rcomma.exec( soFar )) ) {
5568 if ( match ) {
5569 soFar = soFar.slice( match[0].length );
5570 tokens.selector = group;
5571 }
5572 groups.push( tokens = [] );
5573 group = "";
5574
5575 // Need to make sure we're within a narrower context if necessary
5576 // Adding a descendant combinator will generate what is needed
5577 if ( checkContext ) {
5578 soFar = " " + soFar;
5579 }
5580 }
5581
5582 matched = false;
5583
5584 // Combinators
5585 if ( (match = rcombinators.exec( soFar )) ) {
5586 group += match[0];
5587 soFar = soFar.slice( match[0].length );
5588
5589 // Cast descendant combinators to space
5590 matched = tokens.push({
5591 part: match.pop().replace( rtrim, " " ),
5592 string: match[0],
5593 captures: match
5594 });
5595 }
5596
5597 // Filters
5598 for ( type in filters ) {
5599 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
5600 ( match = preFilters[ type ](match, context, xml) )) ) {
5601
5602 group += match[0];

Callers 2

application.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…