/** * Returns the token type associated with the given text, if the given * text is in this token map. If it isn't, <code>-1</code> is returned. * * @param text The segment from which to get the text to compare. * @param start The starting index in the segment of the text. * @param end The ending index in the segment of the text. * @return The token type associated with the given text, or * <code>-1</code> if this token was not specified in this map. */ public int get(Segment text, int start, int end) { return get(text.array, start, end); }
/** * Checks the token to give it the exact ID it deserves before * being passed up to the super method. * * @param segment <code>Segment</code> to get text from. * @param start Start offset in <code>segment</code> of token. * @param end End offset in <code>segment</code> of token. * @param tokenType The token's type. * @param startOffset The offset in the document at which the token occurs. */ @Override public void addToken(Segment segment, int start, int end, int tokenType, int startOffset) { switch (tokenType) { // Since reserved words, functions, and data types are all passed // into here as "identifiers," we have to see what the token // really is... case Token.IDENTIFIER: int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value; break; } super.addToken(segment, start, end, tokenType, startOffset); }
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
/** * Checks for a token in a token map, and makes sure it is mapped to the * expected token type. * * @param tm The token map. * @param token The token. * @param tokenType The expected token type. */ private void assertTokenMapContains(TokenMap tm, String token, int tokenType) { int actualType = tm.get(token.toCharArray(), 0, token.length() - 1); Assert.assertEquals("Token mapped to unexpected type: " + token, tokenType, actualType); }
/** * Checks for a token in a token map, and makes sure it is mapped to the * expected token type. * * @param tm The token map. * @param token The token. * @param tokenType The expected token type. */ private void assertTokenMapContains(TokenMap tm, String token, int tokenType) { int actualType = tm.get(token.toCharArray(), 0, token.length() - 1); Assert.assertEquals("Token mapped to unexpected type: " + token, tokenType, actualType); }
/** * Returns the token type associated with the given text, if the given * text is in this token map. If it isn't, <code>-1</code> is returned. * * @param text The segment from which to get the text to compare. * @param start The starting index in the segment of the text. * @param end The ending index in the segment of the text. * @return The token type associated with the given text, or * <code>-1</code> if this token was not specified in this map. */ public int get(Segment text, int start, int end) { return get(text.array, start, end); }
/** * Returns the token type associated with the given text, if the given * text is in this token map. If it isn't, <code>-1</code> is returned. * * @param text The segment from which to get the text to compare. * @param start The starting index in the segment of the text. * @param end The ending index in the segment of the text. * @return The token type associated with the given text, or * <code>-1</code> if this token was not specified in this map. */ public int get(Segment text, int start, int end) { return get(text.array, start, end); }
/** * Returns the token type associated with the given text, if the given * text is in this token map. If it isn't, <code>-1</code> is returned. * * @param text The segment from which to get the text to compare. * @param start The starting index in the segment of the text. * @param end The ending index in the segment of the text. * @return The token type associated with the given text, or * <code>-1</code> if this token was not specified in this map. */ public int get(Segment text, int start, int end) { return get(text.array, start, end); }
/** * Checks the token to give it the exact ID it deserves before * being passed up to the super method. * * @param segment <code>Segment</code> to get text from. * @param start Start offset in <code>segment</code> of token. * @param end End offset in <code>segment</code> of token. * @param tokenType The token's type. * @param startOffset The offset in the document at which the token occurs. */ @Override public void addToken(Segment segment, int start, int end, int tokenType, int startOffset) { switch (tokenType) { // Since reserved words, functions, and data types are all passed // into here as "identifiers," we have to see what the token // really is... case Token.IDENTIFIER: int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value; break; } super.addToken(segment, start, end, tokenType, startOffset); }
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
int value = wordsToHighlight.get(segment, start,end); if (value!=-1) tokenType = value;
case Token.RESERVED_WORD: { if (RSyntaxUtilities.isWhitespace(c) || !RSyntaxUtilities.isLetterOrDigit(c)) { final int value = wordsToHighlight.get(text, currentTokenStart, i - 1); if (value < 0) { addToken(text, currentTokenStart, i - 1, Token.IDENTIFIER, newStartOffset + currentTokenStart); case Token.RESERVED_WORD: case Token.IDENTIFIER: { final int value = wordsToHighlight.get(text, currentTokenStart, end - 1); if (value < 0) { addToken(text, currentTokenStart, end - 1, Token.IDENTIFIER, newStartOffset + currentTokenStart);