/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>Character.isWhitespace(fDocument.getChar(pos))</code> evaluates to <code>false</code> * and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @return the highest position of a non-whitespace character in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int findNonWhitespaceBackward(int position, int bound) { return scanBackward(position, bound, fNonWSDefaultPart); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>Character.isWhitespace(fDocument.getChar(pos))</code> evaluates to <code>false</code> * and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @return the highest position of a non-whitespace character in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int findNonWhitespaceBackward(int position, int bound) { return scanBackward(position, bound, fNonWSDefaultPart); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>Character.isWhitespace(fDocument.getChar(pos))</code> evaluates to <code>false</code> * and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @return the highest position of a non-whitespace character in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int findNonWhitespaceBackward(int position, int bound) { return scanBackward(position, bound, fNonWSDefaultPart); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= * <code>position</code> and > <code>bound</code> and * <code>Character.isWhitespace(fDocument.getChar(pos))</code> evaluates to <code>false</code> * and the position can be in any partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with * <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @return the highest position of a non-whitespace character in (<code>bound</code>, * <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if * none can be found * @since 3.7 */ public int findNonWhitespaceBackwardInAnyPartition(int position, int bound) { return scanBackward(position, bound, fNonWS); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= * <code>position</code> and > <code>bound</code> and * <code>Character.isWhitespace(fDocument.getChar(pos))</code> evaluates to <code>false</code> * and the position can be in any partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with * <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @return the highest position of a non-whitespace character in (<code>bound</code>, * <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if * none can be found * @since 3.7 */ public int findNonWhitespaceBackwardInAnyPartition(int position, int bound) { return scanBackward(position, bound, fNonWS); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param chars an array of <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char[] chars) { return scanBackward(position, bound, new CharacterMatch(chars)); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param ch the <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char ch) { return scanBackward(position, bound, new CharacterMatch(ch)); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param chars an array of <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char[] chars) { return scanBackward(position, bound, new CharacterMatch(chars)); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param ch the <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char ch) { return scanBackward(position, bound, new CharacterMatch(ch)); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param chars an array of <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char[] chars) { return scanBackward(position, bound, new CharacterMatch(chars)); }
/** * Finds the highest position in <code>fDocument</code> such that the position is <= <code>position</code> * and > <code>bound</code> and <code>fDocument.getChar(position) == ch</code> evaluates to <code>true</code> for at least one * ch in <code>chars</code> and the position is in the default partition. * * @param position the first character position in <code>fDocument</code> to be considered * @param bound the first position in <code>fDocument</code> to not consider any more, with <code>bound</code> < <code>position</code>, or <code>UNBOUND</code> * @param ch the <code>char</code> to search for * @return the highest position of one element in <code>chars</code> in (<code>bound</code>, <code>position</code>] that resides in a Java partition, or <code>NOT_FOUND</code> if none can be found */ public int scanBackward(int position, int bound, char ch) { return scanBackward(position, bound, new CharacterMatch(ch)); }
/** * Checks whether the content of <code>document</code> at <code>position</code> looks like an * anonymous class definition. <code>position</code> must be to the left of the opening * parenthesis of the definition's parameter list. * * @param document the document being modified * @param position the first character position in <code>document</code> to be considered * @param partitioning the document partitioning * @return <code>true</code> if the content of <code>document</code> looks like an anonymous class definition, <code>false</code> otherwise */ private static boolean looksLikeAnonymousClassDef(IDocument document, String partitioning, JavaHeuristicScanner scanner, int position) { int previousCommaParenEqual= scanner.scanBackward(position - 1, JavaHeuristicScanner.UNBOUND, new char[] {',', '(', '='}); if (previousCommaParenEqual == -1 || position < previousCommaParenEqual + 5) // 2 for borders, 3 for "new" return false; if (isNewMatch(document, previousCommaParenEqual + 1, position - previousCommaParenEqual - 2, partitioning)) return true; return false; }
/** * Checks whether the content of <code>document</code> at <code>position</code> looks like an * anonymous class definition. <code>position</code> must be to the left of the opening * parenthesis of the definition's parameter list. * * @param document the document being modified * @param partitioning the document partitioning * @param scanner the scanner * @param position the first character position in <code>document</code> to be considered * @return <code>true</code> if the content of <code>document</code> looks like an anonymous class definition, <code>false</code> otherwise */ private static boolean looksLikeAnonymousClassDef(IDocument document, String partitioning, JavaHeuristicScanner scanner, int position) { int previousCommaParenEqual= scanner.scanBackward(position - 1, JavaHeuristicScanner.UNBOUND, new char[] {',', '(', '='}); if (previousCommaParenEqual == -1 || position < previousCommaParenEqual + 5) // 2 for borders, 3 for "new" return false; if (isNewMatch(document, previousCommaParenEqual + 1, position - previousCommaParenEqual - 2, partitioning)) return true; return false; }
/** * Checks whether the content of <code>document</code> at <code>position</code> looks like an * anonymous class definition. <code>position</code> must be to the left of the opening * parenthesis of the definition's parameter list. * * @param document the document being modified * @param partitioning the document partitioning * @param scanner the scanner * @param position the first character position in <code>document</code> to be considered * @return <code>true</code> if the content of <code>document</code> looks like an anonymous class definition, <code>false</code> otherwise */ private static boolean looksLikeAnonymousClassDef(IDocument document, String partitioning, JavaHeuristicScanner scanner, int position) { int previousCommaParenEqual= scanner.scanBackward(position - 1, JavaHeuristicScanner.UNBOUND, new char[] {',', '(', '='}); if (previousCommaParenEqual == -1 || position < previousCommaParenEqual + 5) // 2 for borders, 3 for "new" return false; if (isNewMatch(document, previousCommaParenEqual + 1, position - previousCommaParenEqual - 2, partitioning)) return true; return false; }
int pos= scanBackward(start, bound, fNonWSDefaultPart); if (pos == NOT_FOUND) return TokenEOF; pos= scanBackward(pos - 1, bound, fNonIdent); if (pos == NOT_FOUND) from= bound == UNBOUND ? 0 : bound + 1;
int pos= scanBackward(start, bound, fNonWSDefaultPart); if (pos == NOT_FOUND) return TokenEOF; pos= scanBackward(pos - 1, bound, fNonIdent); if (pos == NOT_FOUND) from= bound == UNBOUND ? 0 : bound + 1;
int pos= scanBackward(start, bound, fNonWSDefaultPart); if (pos == NOT_FOUND) return TokenEOF; pos= scanBackward(pos - 1, bound, fNonIdent); if (pos == NOT_FOUND) from= bound == UNBOUND ? 0 : bound + 1;
start += 1; while (true) { start= scanBackward(start - 1, bound, match); if (start == NOT_FOUND) return NOT_FOUND;
start += 1; while (true) { start= scanBackward(start - 1, bound, match); if (start == NOT_FOUND) return NOT_FOUND;
start += 1; while (true) { start= scanBackward(start - 1, bound, match); if (start == NOT_FOUND) return NOT_FOUND;