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.
-
嵌套类概要
嵌套类修饰符和类型接口说明static interfaceRecursive binder is allowed to adjust nested elements positions.static interfaceProvides an ability for the processor to get a text of any of given tokens. -
方法概要
修饰符和类型方法说明intgetEdgePosition(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.
-
方法详细资料
-
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
0placing element's end pointer to a first whitespace or comment after element's end.- 参数:
tokens- sequence of whitespace and comment tokens at the element's edge.atStreamEdge-trueif sequence of tokens is located at the beginning or the end of token stream.getter- token text getter.- 返回:
- position of element's edge relative to given tokens.
-