/** * Skip over any whitespace so that the matcher region starts at the next * token. */ private void skipWhitespace() { matcher.usePattern(WHITESPACE); if (matcher.lookingAt()) { matcher.region(matcher.end(), matcher.regionEnd()); } }
private boolean setHeadTokenRegion(int findIndex) { int tokenStartIndex; int tokenEndIndex; boolean setSuccess = false; // If no delimiter exists, but something exists in this scanner if (findIndex == -1 && preStartIndex != bufferLength) { tokenStartIndex = preStartIndex; tokenEndIndex = bufferLength; findStartIndex = bufferLength; matcher.region(tokenStartIndex, tokenEndIndex); setSuccess = true; } // If the first delimiter of scanner is not at the find start position if (-1 != findIndex && preStartIndex != matcher.start()) { tokenStartIndex = preStartIndex; tokenEndIndex = matcher.start(); findStartIndex = matcher.start(); // set match region and return matcher.region(tokenStartIndex, tokenEndIndex); setSuccess = true; } return setSuccess; }
matcher.region(matcher.end(), text.length());
Matcher parameter = PARAMETER.matcher(string); for (int s = typeSubtype.end(); s < string.length(); s = parameter.end()) { parameter.region(s, string.length()); if (!parameter.lookingAt()) { throw new IllegalArgumentException("Parameter is not formatted correctly: \""
/** * Skip over any whitespace so that the matcher region starts at the next * token. */ private void skipWhitespace() { matcher.usePattern(WHITESPACE); if (matcher.lookingAt()) { matcher.region(matcher.end(), matcher.regionEnd()); } }
/** * If RE matches at current index in the input, advance index and return the match; otherwise return null. */ private String match(Pattern re) { if (index >= input.length()) { return null; } Matcher matcher = re.matcher(input); matcher.region(index, input.length()); boolean m = matcher.find(); if (m) { index = matcher.end(); return matcher.group(); } else { return null; } }
Strategy currentStrategy = getStrategy(currentFormatField, definingCalendar); for (; ; ) { patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd()); if (!patternMatcher.lookingAt()) { nextStrategy = null;
matcher.region(pos, end);
Strategy currentStrategy = getStrategy(currentFormatField, definingCalendar); for (; ; ) { patternMatcher.region(patternMatcher.end(), patternMatcher.regionEnd()); if (!patternMatcher.lookingAt()) { nextStrategy = null;
Matcher parameter = PARAMETER.matcher(string); for (int s = typeSubtype.end(); s < string.length(); s = parameter.end()) { parameter.region(s, string.length()); if (!parameter.lookingAt()) return null; // This is not a well-formed media type.
private void resetMatcher() { if (matcher == null) { matcher = delimiter.matcher(buffer); } else { matcher.reset(buffer); } matcher.useTransparentBounds(true); matcher.useAnchoringBounds(false); matcher.region(findStartIndex, bufferLength); }
Matcher matcher = pattern.matcher(text); List<IntPair> offsets = null; matcher.region(start,end); int i = (matcher.find())? matcher.start():-1; if (i >= 0 && i < end) { offsets = new ArrayList<>(); }
matcher.region(pos, end);
matcher.region( fromIndex, matchString.length() );
Matcher parameter = PARAMETER.matcher(string); for (int s = typeSubtype.end(); s < string.length(); s = parameter.end()) { parameter.region(s, string.length()); if (!parameter.lookingAt()) { throw new IllegalArgumentException("Parameter is not formatted correctly: \""
matcher.region(pos, end);
private boolean setTokenRegion() { // The position where token begins int tokenStartIndex = 0; // The position where token ends int tokenEndIndex = 0; // Use delimiter pattern matcher.usePattern(delimiter); matcher.region(findStartIndex, bufferLength); tokenStartIndex = findPreDelimiter(); if (setHeadTokenRegion(tokenStartIndex)) { return true; } tokenEndIndex = findDelimiterAfter(); // If the second delimiter is not found if (tokenEndIndex == -1) { // Just first Delimiter Exists if (findStartIndex == bufferLength) { return false; } tokenEndIndex = bufferLength; findStartIndex = bufferLength; } matcher.region(tokenStartIndex, tokenEndIndex); return true; }
@Signature({ @Arg("start"), @Arg("end") }) public Memory region(Environment env, Memory... args) { matcher.region(args[0].toInteger(), args[1].toInteger()); return new ObjectMemory(this); }