Interface WhitespacesAndCommentsBinder

All Known Subinterfaces:
WhitespacesAndCommentsBinder.RecursiveBinder

public interface WhitespacesAndCommentsBinder
Interface for defining custom element's edge processors for PSI builder. Each element has a pair of edge processors: for its left and right edge. Edge processors defines position of element start and end in token stream with recognition of whitespace and comment tokens surrounding the element.
See Also:
  • Method Details

    • getEdgePosition

      int getEdgePosition(List<? extends IElementType> tokens, boolean atStreamEdge, WhitespacesAndCommentsBinder.TokenTextGetter getter)
      Analyzes whitespace and comment tokens at element's edge and returns element's edge position relative to these tokens. Value returned by left edge processor will be used as a pointer to a first token of element. Value returned by right edge processor will be used as a pointer to a token next of element's last token.

      Example 1: if a processor for left edge wants to leave all whitespaces and comments out of element's scope (before it's start) it should return value of tokens.size() placing element's start pointer to a first token after series of whitespaces/comments.

      Example 2: if a processor for right edge wants to leave all whitespaces and comments out of element's scope (after its end) it should return value of 0 placing element's end pointer to a first whitespace or comment after element's end.

      Parameters:
      tokens - sequence of whitespace and comment tokens at the element's edge.
      atStreamEdge - true if sequence of tokens is located at the beginning or the end of token stream.
      getter - token text getter.
      Returns:
      position of element's edge relative to given tokens.