java.lang.Object
com.intellij.lang.PsiBuilderUtil
-
方法概要
修饰符和类型方法说明static voidadvance(PsiBuilder builder, int count) Advances lexer by given number of tokens (but not beyond the end of token stream).static voiddrop(PsiBuilder.Marker... markers) Release group of allocated markers.static booleanexpect(PsiBuilder builder, IElementType expectedType) Advances lexer if current token is of expected type, does nothing otherwise.static booleanexpect(PsiBuilder builder, TokenSet expectedTypes) Advances lexer if current token is of expected type, does nothing otherwise.static booleanhasProperBraceBalance(@NotNull CharSequence text, @NotNull Lexer lexer, @NotNull IElementType leftBrace, @NotNull IElementType rightBrace) Checks if `text` looks like a proper block.static PsiBuilder.MarkerparseBlockLazy(@NotNull PsiBuilder builder, @NotNull IElementType leftBrace, @NotNull IElementType rightBrace, @NotNull IElementType codeBlock) tries to parse a code block with corresponding left and right braces.static @NotNull CharSequencerawTokenText(PsiBuilder builder, int index) static voidrollbackTo(PsiBuilder.Marker marker) Rolls the lexer back to position before given marker - if not null.
-
方法详细资料
-
advance
Advances lexer by given number of tokens (but not beyond the end of token stream).- 参数:
builder- PSI builder to operate on.count- number of tokens to skip.
-
expect
Advances lexer if current token is of expected type, does nothing otherwise.- 参数:
builder- PSI builder to operate on.expectedType- expected token.- 返回:
- true if token matches, false otherwise.
-
expect
Advances lexer if current token is of expected type, does nothing otherwise.- 参数:
builder- PSI builder to operate on.expectedTypes- expected token types.- 返回:
- true if token matches, false otherwise.
-
drop
Release group of allocated markers.- 参数:
markers- markers to drop.
-
rollbackTo
Rolls the lexer back to position before given marker - if not null.- 参数:
marker- marker to roll back to.
-
rawTokenText
-
parseBlockLazy
@Nullable public static PsiBuilder.Marker parseBlockLazy(@NotNull @NotNull PsiBuilder builder, @NotNull @NotNull IElementType leftBrace, @NotNull @NotNull IElementType rightBrace, @NotNull @NotNull IElementType codeBlock) tries to parse a code block with corresponding left and right braces.- 返回:
- collapsed marker of the block or `null` if there is no code block at all.
-
hasProperBraceBalance
public static boolean hasProperBraceBalance(@NotNull @NotNull CharSequence text, @NotNull @NotNull Lexer lexer, @NotNull @NotNull IElementType leftBrace, @NotNull @NotNull IElementType rightBrace) Checks if `text` looks like a proper block. In particular it (1) checks brace balance (2) verifies that the block's closing brace is the last token- 参数:
text- - text to checklexer- - lexer to useleftBrace- - left brace element typerightBrace- - right brace element type- 返回:
- true if `text` passes the checks
-