Extracts the optional modifier (<, <=, =, >=, >, ~, ~>) and version
components from `range`.

For example, given `range` ">= 1.2.3" returns an object with a `modifier` of
`">="` and `components` of `[1, 2, 3]`.

@param {string} range
@returns {object}
511508
function getModifierAndComponents(range) {
  const rangeComponents = range.split(componentRegex);
  const matches = rangeComponents[0].match(modifierRegex);
  invariant(matches, 'expected regex to match but it did not');

  return {
    modifier: matches[1],
    rangeComponents: [matches[2]].concat(rangeComponents.slice(1)),
  };
}
454318
function compile(input) {
  var res = input.match(REGEX);
  if (!res) throw new Error('Invalid expression: "' + input + '"');

  var range = res[3];
  var parsedRange;
  if (range) {
    parsedRange = parser(range);
    if (parsedRange === null) throw new Error('Invalid range expression: "' + range + '" in "' + input + '"');
  }

  var path = res[2];
  var source = path.split('.');

  // TODO support ranges
  if (parsedRange) console.warn('data-hyper-repeat ranges are not supported at this time');

  return {
    target: res[1],
    path: path,
    source: source[source.length - 1],
    range: parsedRange
  };
}
494660
function( range, start )
					{
						// Creates a collapsed range at the requested boundary.
						range = range.duplicate();
						range.collapse( start );

						// Gets the element that encloses the range entirely.
						var parent = range.parentElement(),
							doc = parent.ownerDocument;

						// Empty parent element, e.g. <i>^</i>
						if ( !parent.hasChildNodes() )
							return  { container : parent, offset : 0 };

						var siblings = parent.children,
							child,
							sibling,
							testRange = range.duplicate(),
							startIndex = 0,
							endIndex = siblings.length - 1,
							index = -1,
							position,
							distance;

						// Binary search over all element childs to test the range to see whether
						// range is right on the boundary of one element.
						while ( startIndex <= endIndex )
						{
							index = Math.floor( ( startIndex + endIndex ) / 2 );
							child = siblings[ index ];
							testRange.moveToElementText( child );
							position = testRange.compareEndPoints( 'StartToStart', range );

							if ( position > 0 )
								endIndex = index - 1;
							else if ( position < 0 )
								startIndex = index + 1;
							else
							{
								// IE9 report wrong measurement with compareEndPoints when range anchors between two BRs.
								// e.g. <p>text<br />^<br /></p> (#7433)
								if ( CKEDITOR.env.ie9Compat && child.tagName == 'BR' )
								{
									var bmId = 'cke_range_marker';
									range.execCommand( 'CreateBookmark', false, bmId );
									child = doc.getElementsByName( bmId )[ 0 ];
									var offset = getNodeIndex( child );
									parent.removeChild( child );
									return { container : parent, offset : offset };
								}
								else
									return { container : parent, offset : getNodeIndex( child ) };
							}
						}

						// All childs are text nodes,
						// or to the right hand of test range are all text nodes. (#6992)
						if ( index == -1 || index == siblings.length - 1 && position < 0 )
						{
							// Adapt test range to embrace the entire parent contents.
							testRange.moveToElementText( parent );
							testRange.setEndPoint( 'StartToStart', range );

							// IE report line break as CRLF with range.text but
							// only LF with textnode.nodeValue, normalize them to avoid
							// breaking character counting logic below. (#3949)
							distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;

							siblings = parent.childNodes;

							// Actual range anchor right beside test range at the boundary of text node.
							if ( !distance )
							{
								child = siblings[ siblings.length - 1 ];

								if ( child.nodeType == CKEDITOR.NODE_ELEMENT )
									return { container : parent, offset : siblings.length };
								else
									return { container : child, offset : child.nodeValue.length };
							}

							// Start the measuring until distance overflows, meanwhile count the text nodes.
							var i = siblings.length;
							while ( distance > 0 )
								distance -= siblings[ --i ].nodeValue.length;

							return  { container : siblings[ i ], offset : -distance };
						}
						// Test range was one offset beyond OR behind the anchored text node.
						else
						{
							// Adapt one side of test range to the actual range
							// for measuring the offset between them.
							testRange.collapse( position > 0 ? true : false );
							testRange.setEndPoint( position > 0 ? 'StartToStart' : 'EndToStart', range );

							// IE report line break as CRLF with range.text but
							// only LF with textnode.nodeValue, normalize them to avoid
							// breaking character counting logic below. (#3949)
							distance = testRange.text.replace( /(\r\n|\r)/g, '\n' ).length;

							// Actual range anchor right beside test range at the inner boundary of text node.
							if ( !distance )
								return { container : parent, offset : getNodeIndex( child ) + ( position > 0 ? 0 : 1 ) };

							// Start the measuring until distance overflows, meanwhile count the text nodes.
							while ( distance > 0 )
							{
								try
								{
									sibling = child[ position > 0 ? 'previousSibling' : 'nextSibling' ];
									distance -= sibling.nodeValue.length;
									child = sibling;
								}
								// Measurement in IE could be somtimes wrong because of <select> element. (#4611)
								catch( e )
								{
									return { container : parent, offset : getNodeIndex( child ) };
								}
							}

							return { container : child, offset : position > 0 ? -distance : child.nodeValue.length + distance };
						}
					}
1014097
function range(start, length) {
      var rgArr = [];
      if (isNum(start)) {
        function rangeLoop(isAdd) {
          if (length >= 0) {
            for (var i = 0; i < length; i++) rgArr.push(isAdd ? i + start : i);
          } else if (length < 0) {
            for (var i = 0; i > length; i--) rgArr.push(isAdd ? i + start : i);
          }
        };
        if (isUdf(length)) {
          length = start, start = UDF;
          rangeLoop(false);
        } else if (isNum(length)) {
          rangeLoop(true);
        }
      }
      return rgArr;
    }
840335
function range(begin, end) {
  var interval = arguments.length <= 2 || arguments[2] === undefined ? 1 : arguments[2];

  var a = [];

  for (var i = begin; i < begin + end; i += interval) {
    a.push(i);
  }

  return a;
}
85788
function packageVersion (rangeString) {
  if (!rangeString || typeof rangeString !== 'string') {
    // 默认装 latest
    return 'latest'
  }

  const range = semverUtils.parseRange(rangeString)[0]
  const version = [
    range.major,
    range.minor,
    range.patch
  ].join('.')

  return range.release
    ? `${version}-${range.release}`
    : version
}
185161
public static IdRange parseRange(String range) {
        int pos = range.indexOf(':');
        try {
            if (pos == -1) {
                long value = parseLong(range);
                return new IdRange(value);
            } else {
                long lowVal = parseLong(range.substring(0, pos));
                long highVal = parseLong(range.substring(pos + 1));
                return new IdRange(lowVal, highVal);
            }
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException("Invalid message set " + range);
        }
    }
733116
function range(begin, end, interval = 1) {
  var a = [];

  for (let i = begin; i < (begin+end); i += interval) {
    a.push(i);
  }

  return a;
}
855279
function(domain, range, value) {

            var domainSpan = domain[1] - domain[0];
            var rangeSpan = range[1] - range[0];
            return (((value - domain[0]) / domainSpan) * rangeSpan + range[0]) || 0;
        }
277476
function rangeToLines(range) {
    range = (range || '').split(':');
    if (range.length != 2) {
        return null;
    }

    return {
        start: Number(range[0]) - 1,
        end: Number(range[1]) - 1
    }
}
326244
function getRange(node) {
    if (isScope(node)) {
        return node.nodes
            .map(getRange)
            .reduce(reduceRanges);
    } else if (node.type === 'rule') {
        return specificity.calculate(node.selector)
            .map(result => {
                return result.specificity.split(',').map(v => Number(v));
            })
            .reduce(reduceRange, Object.assign({}, DEFAULT_RANGE));
    }
    return null;
}
573584
function satisfies(version, range) {
  range = range.trim();

  // Range '<=99.999.99999' means "all versions", but fails on "2014.10.20-1"
  if (range === '<=99.999.99999') return true;

  // If semver satisfies, we return true
  if (semver.satisfies(version, range)) return true;

  // If range is a specific version, return eq
  if (semver.valid(range)) return semver.eq(version, range);

  if (range.includes('||')) {
    // Multiple ranges, "or"
    return range.split('||').some(sub => satisfies(version, sub.trim()));
  }

  if (range.includes(' ')) {
    // Multiple ranges, "and"
    return range.split(' ')
      .map(x => x.trim())
      .filter(x => x)
      .every(sub => satisfies(version, sub));
  }

  // Comparison
  if (range.startsWith('>=')) {
    const sub = range.slice(2).trim();
    if (semver.valid(sub)) return semver.gte(version, sub);
  } else if (range.startsWith('<=')) {
    const sub = range.slice(2).trim();
    if (semver.valid(sub)) return semver.lte(version, sub);
  } else if (range.startsWith('>')) {
    const sub = range.slice(1).trim();
    if (semver.valid(sub)) return semver.gt(version, sub);
  } else if (range.startsWith('<')) {
    const sub = range.slice(1).trim();
    if (semver.valid(sub)) return semver.lt(version, sub);
  }

  console.error(`Unprocessed version/range: ${version}, ${JSON.stringify(range)}`);

  return false;
}
639824
private Hashable find(Range<Token> range)
    {
        try
        {
            return findHelper(root, new Range<Token>(fullRange.left, fullRange.right), range);
        }
        catch (StopRecursion e)
        {
            return new Leaf();
        }
    }
689003
function headingRange(node, options, callback) {
  var test = options
  var ignoreFinalDefinitions = false

  // Object, not regex.
  if (test && typeof test === 'object' && !('exec' in test)) {
    ignoreFinalDefinitions = test.ignoreFinalDefinitions === true
    test = test.test
  }

  if (typeof test === 'string') {
    test = toExpression(test)
  }

  // Regex
  if (test && 'exec' in test) {
    test = wrapExpression(test)
  }

  if (typeof test !== 'function') {
    throw new Error(
      'Expected `string`, `regexp`, or `function` for `test`, not `' +
        test +
        '`'
    )
  }

  search(node, test, ignoreFinalDefinitions, callback)
}
394236
public static Set<Integer> parseRange(String range) {
        if (range == null) {
            return Collections.emptySet();
        }
        Set<Integer> ret = new LinkedHashSet<>();
        StringTokenizer stringTokenizer = new StringTokenizer(range, String.format("%s%s", COMMA, DASH), true);
        Integer from = null;
        Integer to = null;
        boolean rangeStarted = false;
        while (stringTokenizer.hasMoreTokens()) {
            String token = stringTokenizer.nextToken();
            if (isValueDelimiter(token)) {
                ret.addAll(fromToAsSet(from, to));
                from = null;
                to = null;
                rangeStarted = false;
            } else if (isRangeDelimiter(token)) {
                rangeStarted = true;
            } else {
                String trimmedValue = token.trim();
                if (!isPositiveInt(trimmedValue)) {
                    throw new IllegalArgumentException("Range values should be positive numbers.");
                }
                Integer parsedInteger = Integer.parseUnsignedInt(trimmedValue);
                if (rangeStarted) {
                    to = parsedInteger;
                } else {
                    from = parsedInteger;
                }
            }
            if (from != null) {
                ret.addAll(fromToAsSet(from, to));
            }
        }

        return ret;
    }
182560
function getNextRange(ranges, anchor) {
	for (let i = 0; i < ranges.length; i++) {
		if (anchor.isEqual(ranges[i])) {
			// NB may return `undefined`, which is totally fine and means that
			// we should move to next element
			return ranges[i + 1];
		}
	}

	// Keep ranges which are not on the left of given selection
	ranges = ranges.filter(r => anchor.end.isLessThanOrEqual(r.start));

	return ranges[0];
}
1182809
function getCellByRange(range) {
  let cell = range.startContainer;

  if (domUtils.getNodeName(cell) === 'TD' || domUtils.getNodeName(cell) === 'TH') {
    cell = $(cell);
  } else {
    cell = $(cell).parentsUntil('tr');
  }

  return cell;
}