- 所有已知子接口:
PsiBuilder.Marker
- 所有已知实现类:
DelegateMarker,IndentPsiBuilder.MyMarker
- 封闭接口:
- SyntaxTreeBuilder
public static interface SyntaxTreeBuilder.Marker
A marker defines a range in the document text which becomes a node in the AST
tree. The ranges defined by markers within the text range of the current marker
become child nodes of the node defined by the current marker.
-
方法概要
修饰符和类型方法说明voidcollapse(@NotNull IElementType type) Like done(IElementType), but collapses all tokens between start and end markers into single leaf node of given type.voiddone(@NotNull IElementType type) Completes this marker and labels it with the specified AST node type.voiddoneBefore(@NotNull IElementType type, @NotNull SyntaxTreeBuilder.Marker before) Like done(IElementType), but the marker is completed (end marker inserted) before specified one.voiddoneBefore(@NotNull IElementType type, @NotNull SyntaxTreeBuilder.Marker before, @NotNull String errorMessage) Like doneBefore(IElementType, Marker), but in addition an error element with given text is inserted right before this marker's end.voiddrop()Drops this marker.voidCompletes this marker and labels it as error element with specified message.voiderrorBefore(@NotNull String message, @NotNull SyntaxTreeBuilder.Marker before) Like error(String), but the marker is completed before specified one.@NotNull SyntaxTreeBuilder.Markerprecede()Creates and returns a new marker starting immediately before the start of this marker and extending after its end.voidDrops this marker and all markers added after it, and reverts the lexer position to the position of this marker.voidsetCustomEdgeTokenBinders(@Nullable WhitespacesAndCommentsBinder left, @Nullable WhitespacesAndCommentsBinder right) Allows to define custom edge token binders instead of default ones.
-
方法详细资料
-
precede
Creates and returns a new marker starting immediately before the start of this marker and extending after its end. Can be called on a completed or a currently active marker.- 返回:
- the new marker instance.
-
drop
void drop()Drops this marker. Can be called after other markers have been added and completed after this marker. Does not affect lexer position or markers added after this marker. -
rollbackTo
void rollbackTo()Drops this marker and all markers added after it, and reverts the lexer position to the position of this marker. -
done
Completes this marker and labels it with the specified AST node type. Before calling this method, all markers added after the beginning of this marker must be either dropped or completed.- 参数:
type- the type of the node in the AST tree.
-
collapse
Like done(IElementType), but collapses all tokens between start and end markers into single leaf node of given type.- 参数:
type- the type of the node in the AST tree.
-
doneBefore
void doneBefore(@NotNull @NotNull IElementType type, @NotNull @NotNull SyntaxTreeBuilder.Marker before) Like done(IElementType), but the marker is completed (end marker inserted) before specified one. All markers added between start of this marker and the marker specified as end one must be either dropped or completed.- 参数:
type- the type of the node in the AST tree.before- marker to complete this one before.
-
doneBefore
void doneBefore(@NotNull @NotNull IElementType type, @NotNull @NotNull SyntaxTreeBuilder.Marker before, @NotNull @NotNull String errorMessage) Like doneBefore(IElementType, Marker), but in addition an error element with given text is inserted right before this marker's end.- 参数:
type- the type of the node in the AST tree.before- marker to complete this one before.errorMessage- for error element.
-
error
Completes this marker and labels it as error element with specified message. Before calling this method, all markers added after the beginning of this marker must be either dropped or completed.- 参数:
message- for error element.
-
errorBefore
void errorBefore(@NotNull @NotNull String message, @NotNull @NotNull SyntaxTreeBuilder.Marker before) Like error(String), but the marker is completed before specified one.- 参数:
message- for error element.before- marker to complete this one before.
-
setCustomEdgeTokenBinders
void setCustomEdgeTokenBinders(@Nullable @Nullable WhitespacesAndCommentsBinder left, @Nullable @Nullable WhitespacesAndCommentsBinder right) Allows to define custom edge token binders instead of default ones. If any of parameters is null then corresponding token binder won't be changed (keeping previously set or default token binder). It is an error to set right token binder for not-done marker.- 参数:
left- new left edge token binder.right- new right edge token binder.
-