public interface PsiBuilder extends UserDataHolder, UserDataHolderUnprotected
Modifier and Type | Interface and Description |
---|---|
static interface |
PsiBuilder.Marker
A marker defines a range in the document text which becomes a node in the AST
tree.
|
Modifier and Type | Method and Description |
---|---|
void |
advanceLexer()
Advances the lexer to the next token, skipping whitespace and comment tokens.
|
void |
enforceCommentTokens(TokenSet tokens) |
boolean |
eof()
Checks if the lexer has reached the end of file.
|
void |
error(java.lang.String messageText)
Adds an error marker with the specified message text at the current position in the tree.
|
int |
getCurrentOffset()
Returns the start offset of the current token, or the file length when the token stream is over.
|
LighterASTNode |
getLatestDoneMarker() |
FlyweightCapableTreeStructure<LighterASTNode> |
getLightTree()
Same as
getTreeBuilt() but returns a light tree, which is build faster,
produces less garbage but is incapable of creating a PSI over. |
java.lang.CharSequence |
getOriginalText()
Returns the complete text being parsed.
|
Project |
getProject()
Returns a project for which PSI builder was created (see
PsiBuilderFactory ). |
java.lang.String |
getTokenText()
Returns the text of the current token from the lexer.
|
IElementType |
getTokenType()
Returns the type of current token from the lexer.
|
ASTNode |
getTreeBuilt()
Returns the result of the parsing.
|
IElementType |
lookAhead(int steps)
See what token type is in
steps ahead. |
PsiBuilder.Marker |
mark()
Creates a marker at the current parsing position.
|
IElementType |
rawLookup(int steps)
See what token type is in
steps ahead/behind. |
int |
rawTokenIndex()
Returns the index of the current token in the original sequence.
|
int |
rawTokenTypeStart(int steps)
See what token type is in
steps ahead/behind current position. |
void |
remapCurrentToken(IElementType type)
Slightly easier way to what
ITokenTypeRemapper does (i.e. |
void |
setDebugMode(boolean dbgMode)
Enables or disables the builder debug mode.
|
void |
setTokenTypeRemapper(ITokenTypeRemapper remapper)
Sets optional remapper that can change the type of tokens.
|
void |
setWhitespaceSkippedCallback(WhitespaceSkippedCallback callback)
Subscribe for notification on default whitespace and comments skipped events.
|
getUserData, putUserData
getUserDataUnprotected, putUserDataUnprotected
Project getProject()
PsiBuilderFactory
).java.lang.CharSequence getOriginalText()
void advanceLexer()
IElementType getTokenType()
null
when the token stream is over.setTokenTypeRemapper(ITokenTypeRemapper).
void setTokenTypeRemapper(ITokenTypeRemapper remapper)
getTokenType()
is affected by it.remapper
- the remapper object, or null
.void remapCurrentToken(IElementType type)
ITokenTypeRemapper
does (i.e. it just remaps current token to a given type).type
- new type for the current token.void setWhitespaceSkippedCallback(WhitespaceSkippedCallback callback)
callback
- an implementation for the callbackIElementType lookAhead(int steps)
steps
ahead.steps
- 0 is current token (i.e. the same getTokenType()
returns)getTokenType()
will return if we call advance steps
times in a rowIElementType rawLookup(int steps)
steps
ahead/behind.steps
- 0 is current token (i.e. the same getTokenType()
returns)int rawTokenTypeStart(int steps)
steps
ahead/behind current position.steps
- 0 is current token (i.e. the same getTokenType()
returns)getOriginalText().getLength()
at endint rawTokenIndex()
java.lang.String getTokenText()
null
when the token stream is over.int getCurrentOffset()
PsiBuilder.Marker mark()
void error(java.lang.String messageText)
messageText
- the text of the error message displayed to the user.boolean eof()
true
if the lexer is at end of file, false
otherwise.ASTNode getTreeBuilt()
FlyweightCapableTreeStructure<LighterASTNode> getLightTree()
getTreeBuilt()
but returns a light tree, which is build faster,
produces less garbage but is incapable of creating a PSI over.
getTreeBuilt()
was called before.void setDebugMode(boolean dbgMode)
getTreeBuilt()
.dbgMode
- the debug mode value.void enforceCommentTokens(TokenSet tokens)
LighterASTNode getLatestDoneMarker()