@throws ParseException

@example
"@user{1..10}" => new RangeName('user', 1, 10)
773735
private function buildRange(Token $token): RangeName
    {
        $matches = [];
        $name = substr($token->getValue(), 1);

        if (1 !== preg_match(self::REGEX, (string) $name, $matches)) {
            throw ExpressionLanguageExceptionFactory::createForUnparsableToken($token);
        }

        $reference = str_replace(sprintf('{%s}', $matches['range']), $this->token, $name);

        $step = 1;

        if (isset($matches['step'])) {
            $step = ((int) $matches['step']) ?: 1;
        }

        return new RangeName($reference, (int) $matches['from'], (int) $matches['to'], $step);
    }
439169
public void addTransientRange(String id, RowRange range) {
    String start = DatatypeConverter.printHexBinary(range.getStart().toArray());
    String end = DatatypeConverter.printHexBinary(range.getEnd().toArray());

    appConfig.setProperty(PREFIX + id, start + ":" + end);
  }
666473
public static boolean isRange(String value) {
        if (value == null) {
            return false;
        }
        try {
            Set<Integer> values = parseRange(value);
            return values.size() > 0;
        } catch (Exception e) {
            return false;
        }
    }
931418
function username(value, fromIndex) {
  var index = fromIndex
  var length = value.length
  var size

  /* First character of username cannot be a dash. */
  if (value.charCodeAt(index) === CC_DASH) {
    return -1
  }

  while (index < length) {
    if (!usernameCharacter(value.charCodeAt(index))) {
      break
    }

    index++
  }

  size = index - fromIndex

  /* Last character of username can no longer be a dash, but could be (GH-13). */
  if (!size || size > MAX_USER_LENGTH) {
    return -1
  }

  return index
}
131986
@Override
    protected void parse() {
		getConnectionParam().load(getConfig());
	    getProxyParam().load(getConfig());
		getCertificateParam().load(getConfig());
		getViewParam().load(getConfig());
		getCheckForUpdatesParam().load(getConfig());
		getApiParam().load(getConfig());
		getGlobalExcludeURLParam().load(getConfig());
		getExperimentalFeaturesParam().load(getConfig());
        getDatabaseParam().load(getConfig());
        getExtensionParam().load(getConfig());
		
		String userDir = null;
		try {
			userDir = getConfig().getString(USER_DIR);
			if (userDir != null) {
				this.userDirectory = new File(userDir);
			}
		} catch (Exception e) {
			// In a previous release the userdir was set as a file
			try {
				File file = (File) getConfig().getProperty(USER_DIR);
				if (file != null && file.isDirectory()) {
					this.userDirectory = file;
				}
			} catch (Exception e1) {
				logger.error(e1.getMessage(), e1);
			}
		}
    }
1008779
static int parsePeriod(
        String period,
        char symbol
    ) throws ParseException {

        if (period.isEmpty()) {
            throw new ParseException("Empty period.", 0);
        }

        boolean negative = false;
        int index = 0;
        int len = period.length();

        if (period.charAt(0) == '-') {
            index++;
            negative = true;
        }

        if ((index < len) && (period.charAt(index) != 'P')) {
            throw new ParseException("Missing P-literal: " + period, index);
        }

        index++;
        long total = 0;
        int old = index;

        for (int i = index, n = Math.min(len, 10); i < n; i++) {
            char c = period.charAt(i);
            if ((c >= '0') && (c <= '9')) {
                int digit = (c - '0');
                total = total * 10 + digit;
                index++;
            } else {
                break;
            }
        }

        if (index == old) {
            throw new ParseException("Missing digits: " + period, index);
        }

        if ((len == index + 1) && (period.charAt(index) == symbol)) {
            index++; // consume unit symbol
            try {
                if (negative) {
                    total = MathUtils.safeNegate(total);
                }
                return MathUtils.safeCast(total);
            } catch (ArithmeticException ae) {
                throw new ParseException(ae.getMessage(), index);
            }
        }

        throw new ParseException("Unparseable format: " + period, index);

    }
62622
function(value, range) {
      var
        intRegExp = $.fn.form.settings.regExp.integer,
        min,
        max,
        parts
      ;
      if( !range || ['', '..'].indexOf(range) !== -1) {
        // do nothing
      }
      else if(range.indexOf('..') == -1) {
        if(intRegExp.test(range)) {
          min = max = range - 0;
        }
      }
      else {
        parts = range.split('..', 2);
        if(intRegExp.test(parts[0])) {
          min = parts[0] - 0;
        }
        if(intRegExp.test(parts[1])) {
          max = parts[1] - 0;
        }
      }
      return (
        intRegExp.test(value) &&
        (min === undefined || value >= min) &&
        (max === undefined || value <= max)
      );
    }
823273
private static List<String> expandRange(String expression) throws IllegalArgumentException {
		int first = 0;
		int last = 0;
		try {
			String[] range = expression.split("-");
			first = Integer.parseInt(range[0]);
			last = Integer.parseInt(range[1]);
		} catch (Exception e) {
			throw new IllegalArgumentException("Invalid range specification in oper_expression: " + expression);
		}

		List<String> expandedExpression = new ArrayList<String>(last-first+1);
		for (int i = first; i <= last; i++) {
			expandedExpression.add(String.valueOf(i));
		}
		return expandedExpression;
	}
449399
public void setRange(String range) {
        String single = range.trim();
        int hyphenIndex = range.indexOf('-');

        if (hyphenIndex > 0) {
            this.start = rangeSingle(range.substring(0, hyphenIndex));
            this.end = rangeSingle(range.substring(hyphenIndex + 1));
        } else {
            int number = rangeSingle(range);
            if (number >= 0) { // first n attributes
                this.start = 0;
                this.end = number;
            } else { // last n attributes
                this.start = this.upperLimit + number > 0 ? this.upperLimit + number : 0;
                this.end = this.upperLimit - 1;
            }
        }
    }
135101
def parse_range_header(ranges_specifier)
      if /^bytes=(.*)/ =~ ranges_specifier
        byte_range_set = split_header_value($1)
        byte_range_set.collect{|range_spec|
          case range_spec
          when /^(\d+)-(\d+)/ then $1.to_i .. $2.to_i
          when /^(\d+)-/      then $1.to_i .. -1
          when /^-(\d+)/      then -($1.to_i) .. -1
          else return nil
          end
        }
      end
    end
859260
function (jqXHR) {
            var range = jqXHR.getResponseHeader('Range'),
                parts = range && range.split('-'),
                upperBytesPos = parts && parts.length > 1 &&
                    parseInt(parts[1], 10);
            return upperBytesPos && upperBytesPos + 1;
        }
638822
public IntegerRanges getRange(String name) {
    String valueString = get(name);
    Preconditions.checkNotNull(valueString);
    return new IntegerRanges(valueString);
  }
893408
private void parseEnumeration(boolean isNames) throws Exception {
        dataBufferAppend('(');

        // Read the first token.
        skipWhitespace();
        dataBufferAppend(readNmtoken(isNames));
        // Read the remaining tokens.
        skipWhitespace();
        while (!tryRead(')')) {
            require('|');
            dataBufferAppend('|');
            skipWhitespace();
            dataBufferAppend(readNmtoken(isNames));
            skipWhitespace();
        }
        dataBufferAppend(')');
    }
696969
private static void rangeCheck(int length, int fromIndex, int toIndex) {
        if (fromIndex > toIndex) {
            throw new IllegalArgumentException("fromIndex(" + fromIndex + ") > toIndex(" + toIndex + ")");
        }
        if (fromIndex < 0) {
            throw new ArrayIndexOutOfBoundsException(fromIndex);
        }
        if (toIndex > length) {
            throw new ArrayIndexOutOfBoundsException(toIndex);
        }
    }
915183
void assignToRangeVariables() {

        for (int i = 0; i < rangeVariables.length; i++) {
            boolean isOuter = rangeVariables[i].isLeftJoin
                              || rangeVariables[i].isRightJoin;

            if (isOuter) {
                assignToRangeVariable(rangeVariables[i], i,
                                      joinExpressions[i], true);
                assignToRangeVariable(rangeVariables[i], i,
                                      whereExpressions[i], false);
            } else {
                joinExpressions[i].addAll(whereExpressions[i]);
                assignToRangeVariable(rangeVariables[i], i,
                                      joinExpressions[i], true);
            }

            // A VoltDB extension to disable
            // Turn off some weird rewriting of in expressions based on index support for the query.
            // This makes it simpler to parse on the VoltDB side,
            // at the expense of HSQL performance.
            // Also fixed an apparent join/where confusion?
            if (inExpressions[i] != null) {
                if (!flags[i] && isOuter) {
                    rangeVariables[i].addJoinCondition(inExpressions[i]);
                } else {
                    rangeVariables[i].addWhereCondition(inExpressions[i]);
                }
            /* disable 7 lines ...
            if (rangeVariables[i].hasIndexCondition()
                    && inExpressions[i] != null) {
                if (!flags[i] && isOuter) {
                    rangeVariables[i].addWhereCondition(inExpressions[i]);
                } else {
                    rangeVariables[i].addJoinCondition(inExpressions[i]);
                }
            ... disabled 7 lines */
            // End of VoltDB extension

                inExpressions[i] = null;

                inExpressionCount--;
            }
        }

        if (inExpressionCount != 0) {
            // A VoltDB extension to disable
            // This will never be called because of the change made to the block above
            assert(false);
            // End of VoltDB extension
            setInConditionsAsTables();
        }
    }
466249
protected ArrayList<Range> parseRange(final HttpServletRequest request, final HttpServletResponse response, final Attributes resourceAttributes)
			throws IOException {

		// Checking If-Range
		final String headerValue = request.getHeader("If-Range");

		if (headerValue != null) {

			long headerValueTime = (-1L);
			try {
				headerValueTime = request.getDateHeader("If-Range");
			} catch (final IllegalArgumentException e) {
				// Ignore
			}

			final String eTag = resourceAttributes.getETag();
			final long lastModified = resourceAttributes.getLastModified();

			if (headerValueTime == (-1L)) {

				// If the ETag the client gave does not match the entity
				// etag, then the entire entity is returned.
				if (!eTag.equals(headerValue.trim()))
					return FULL;

			} else {

				// If the timestamp of the entity the client got is older than
				// the last modification date of the entity, the entire entity
				// is returned.
				if (lastModified > (headerValueTime + 1000))
					return FULL;

			}

		}

		final long fileLength = resourceAttributes.getContentLength();

		if (fileLength == 0)
			return null;

		// Retrieving the range header (if any is specified
		String rangeHeader = request.getHeader("Range");

		if (rangeHeader == null)
			return null;
		// bytes is the only range unit supported (and I don't see the point
		// of adding new ones).
		if (!rangeHeader.startsWith("bytes")) {
			response.addHeader("Content-Range", "bytes */" + fileLength);
			response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
			return null;
		}

		rangeHeader = rangeHeader.substring(6);

		// Vector which will contain all the ranges which are successfully
		// parsed.
		final ArrayList<Range> result = new ArrayList<Range>();
		final StringTokenizer commaTokenizer = new StringTokenizer(rangeHeader, ",");

		// Parsing the range list
		while (commaTokenizer.hasMoreTokens()) {
			final String rangeDefinition = commaTokenizer.nextToken().trim();

			final Range currentRange = new Range();
			currentRange.length = fileLength;

			final int dashPos = rangeDefinition.indexOf('-');

			if (dashPos == -1) {
				response.addHeader("Content-Range", "bytes */" + fileLength);
				response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
				return null;
			}

			if (dashPos == 0) {

				try {
					final long offset = Long.parseLong(rangeDefinition);
					currentRange.start = fileLength + offset;
					currentRange.end = fileLength - 1;
				} catch (final NumberFormatException e) {
					response.addHeader("Content-Range", "bytes */" + fileLength);
					response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
					return null;
				}

			} else {

				try {
					currentRange.start = Long.parseLong(rangeDefinition.substring(0, dashPos));
					if (dashPos < rangeDefinition.length() - 1)
						currentRange.end = Long.parseLong(rangeDefinition.substring(dashPos + 1, rangeDefinition.length()));
					else
						currentRange.end = fileLength - 1;
				} catch (final NumberFormatException e) {
					response.addHeader("Content-Range", "bytes */" + fileLength);
					response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
					return null;
				}

			}

			if (!currentRange.validate()) {
				response.addHeader("Content-Range", "bytes */" + fileLength);
				response.sendError(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE);
				return null;
			}

			result.add(currentRange);
		}

		return result;
	}
931752
public static void parse(final String range, final RangeConfig tc) throws RangeException {
        if (range == null) {
            throw new RangeException("Range can't be null");
        }
        ROOT_STAGE.parse(range, tc);
        checkBoundaries(tc);
    }