(match, loopNdx, quantifierRecurse)
| 849 | var maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr ? ndxIntlzr.slice() : [ 0 ], matches = [], insertStop = false, latestMatch, cacheDependency = ndxIntlzr ? ndxIntlzr.join("") : ""; |
| 850 | function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) { |
| 851 | function handleMatch(match, loopNdx, quantifierRecurse) { |
| 852 | function isFirstMatch(latestMatch, tokenGroup) { |
| 853 | var firstMatch = $.inArray(latestMatch, tokenGroup.matches) === 0; |
| 854 | if (!firstMatch) { |
| 855 | $.each(tokenGroup.matches, function(ndx, match) { |
| 856 | if (match.isQuantifier === true) firstMatch = isFirstMatch(latestMatch, tokenGroup.matches[ndx - 1]); else if (match.hasOwnProperty("matches")) firstMatch = isFirstMatch(latestMatch, match); |
| 857 | if (firstMatch) return false; |
| 858 | }); |
| 859 | } |
| 860 | return firstMatch; |
| 861 | } |
| 862 | function resolveNdxInitializer(pos, alternateNdx, targetAlternation) { |
| 863 | var bestMatch, indexPos; |
| 864 | if (getMaskSet().tests[pos] || getMaskSet().validPositions[pos]) { |
| 865 | $.each(getMaskSet().tests[pos] || [ getMaskSet().validPositions[pos] ], function(ndx, lmnt) { |
| 866 | if (lmnt.mloc[alternateNdx]) { |
| 867 | bestMatch = lmnt; |
| 868 | return false; |
| 869 | } |
| 870 | var alternation = targetAlternation !== undefined ? targetAlternation : lmnt.alternation, ndxPos = lmnt.locator[alternation] !== undefined ? lmnt.locator[alternation].toString().indexOf(alternateNdx) : -1; |
| 871 | if ((indexPos === undefined || ndxPos < indexPos) && ndxPos !== -1) { |
| 872 | bestMatch = lmnt; |
| 873 | indexPos = ndxPos; |
| 874 | } |
| 875 | }); |
| 876 | } |
| 877 | if (bestMatch) { |
| 878 | var bestMatchAltIndex = bestMatch.locator[bestMatch.alternation]; |
| 879 | var locator = bestMatch.mloc[alternateNdx] || bestMatch.mloc[bestMatchAltIndex] || bestMatch.locator; |
| 880 | return locator.slice((targetAlternation !== undefined ? targetAlternation : bestMatch.alternation) + 1); |
| 881 | } else { |
| 882 | return targetAlternation !== undefined ? resolveNdxInitializer(pos, alternateNdx) : undefined; |
| 883 | } |
| 884 | } |
| 885 | function isSubsetOf(source, target) { |
| 886 | function expand(pattern) { |
| 887 | var expanded = [], start, end; |
| 888 | for (var i = 0, l = pattern.length; i < l; i++) { |
| 889 | if (pattern.charAt(i) === "-") { |
| 890 | end = pattern.charCodeAt(i + 1); |
| 891 | while (++start < end) expanded.push(String.fromCharCode(start)); |
| 892 | } else { |
| 893 | start = pattern.charCodeAt(i); |
| 894 | expanded.push(pattern.charAt(i)); |
| 895 | } |
| 896 | } |
| 897 | return expanded.join(""); |
| 898 | } |
| 899 | if (opts.regex && source.match.fn !== null && target.match.fn !== null) { |
| 900 | return expand(target.match.def.replace(/[\[\]]/g, "")).indexOf(expand(source.match.def.replace(/[\[\]]/g, ""))) !== -1; |
| 901 | } |
| 902 | return source.match.def === target.match.nativeDef; |
| 903 | } |
| 904 | function staticCanMatchDefinition(source, target) { |
| 905 | var sloc = source.locator.slice(source.alternation).join(""), tloc = target.locator.slice(target.alternation).join(""), canMatch = sloc == tloc; |
| 906 | canMatch = canMatch && source.match.fn === null && target.match.fn !== null ? target.match.fn.test(source.match.def, getMaskSet(), pos, false, opts, false) : false; |
| 907 | return canMatch; |
| 908 | } |
no test coverage detected