WhitespacesAndCommentsBinder (@NotNull TokenSet commentTypes) { return new WhitespacesAndCommentsBinder() { @Override public int getEdgePosition(List<? extends IElementType> tokens, boolean atStreamEdge, TokenTextGetter getter) { int i = 0; while (i < tokens.size() && !commentTypes.contains(tokens.get(i))) { i++; } return i; } }; }