public class PsiBuilderUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
advance(PsiBuilder builder,
int count)
Advances lexer by given number of tokens (but not beyond the end of token stream).
|
static void |
drop(PsiBuilder.Marker... markers)
Release group of allocated markers.
|
static boolean |
expect(PsiBuilder builder,
IElementType expectedType)
Advances lexer if current token is of expected type, does nothing otherwise.
|
static boolean |
expect(PsiBuilder builder,
TokenSet expectedTypes)
Advances lexer if current token is of expected type, does nothing otherwise.
|
static boolean |
hasProperBraceBalance(java.lang.CharSequence text,
Lexer lexer,
IElementType leftBrace,
IElementType rightBrace)
Checks if `text` looks like a proper block.
|
static PsiBuilder.Marker |
parseBlockLazy(PsiBuilder builder,
IElementType leftBrace,
IElementType rightBrace,
IElementType codeBlock)
tries to parse a code block with corresponding left and right braces.
|
static java.lang.CharSequence |
rawTokenText(PsiBuilder builder,
int index) |
static void |
rollbackTo(PsiBuilder.Marker marker)
Rolls the lexer back to position before given marker - if not null.
|
public static void advance(PsiBuilder builder, int count)
builder
- PSI builder to operate on.count
- number of tokens to skip.public static boolean expect(PsiBuilder builder, IElementType expectedType)
builder
- PSI builder to operate on.expectedType
- expected token.public static boolean expect(PsiBuilder builder, TokenSet expectedTypes)
builder
- PSI builder to operate on.expectedTypes
- expected token types.public static void drop(PsiBuilder.Marker... markers)
markers
- markers to drop.public static void rollbackTo(PsiBuilder.Marker marker)
marker
- marker to roll back to.public static java.lang.CharSequence rawTokenText(PsiBuilder builder, int index)
public static PsiBuilder.Marker parseBlockLazy(PsiBuilder builder, IElementType leftBrace, IElementType rightBrace, IElementType codeBlock)
public static boolean hasProperBraceBalance(java.lang.CharSequence text, Lexer lexer, IElementType leftBrace, IElementType rightBrace)
text
- - text to checklexer
- - lexer to useleftBrace
- - left brace element typerightBrace
- - right brace element type