static int nextTokenType(CeylonParseController cpc, CommonToken token) { for (int i = token.getTokenIndex() + 1; i < cpc.getTokens().size(); i++) { CommonToken tok = cpc.getTokens().get(i); if (tok.getChannel() != CommonToken.HIDDEN_CHANNEL) { return tok.getType(); } } return -1; }
private CommonToken getPreviousNonHiddenToken(int offset) { int index = getTokenIndexAtCharacter(tokens, offset); if (index < 0) index = -index; for (; index >= 0; index--) { CommonToken token = getTokens().get(index); if (token.getChannel() != HIDDEN_CHANNEL && token.getStopIndex() < offset) { return token; } } return null; }
private CommonToken getNextNonHiddenToken(int offset, int end) { int index = getTokenIndexAtCharacter(tokens, offset); if (index < 0) index = 1 - index; int size = getTokens().size(); for (; index < size; index++) { CommonToken token = getTokens().get(index); if (token.getStartIndex() >= end) { return null; } if (token.getChannel() != HIDDEN_CHANNEL && token.getStartIndex() >= offset) { return token; } } return null; }