java.lang.Object
com.intellij.lang.impl.PsiBuilderAdapter
- All Implemented Interfaces:
PsiBuilder,SyntaxTreeBuilder,UserDataHolder
- Direct Known Subclasses:
GeneratedParserUtilBase.Builder,IndentPsiBuilder
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.intellij.lang.PsiBuilder
PsiBuilder.Marker -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdvances the lexer to the next token, skipping whitespace and comment tokens.voidenforceCommentTokens(@NotNull TokenSet tokens) booleaneof()Checks if the lexer has reached the end of file.voidAdds an error marker with the specified message text at the current position in the tree.intReturns the start offset of the current token, or the file length when the token stream is over.@NotNull PsiBuilder@Nullable LighterASTNode@NotNull CharSequenceReturns the complete text being parsed.@Nullable @NonNls StringReturns the text of the current token from the lexer.@Nullable IElementTypeReturns the type of current token from the lexer.<T> TgetUserData(@NotNull Key<T> key) booleanisWhitespaceOrComment(@NotNull IElementType elementType) lookAhead(int steps) See what token type is instepsahead.@NotNull PsiBuilder.Markermark()Creates a marker at the current parsing position.<T> voidputUserData(@NotNull Key<T> key, T value) Add a new user data value to this object.rawLookup(int steps) See what token type is instepsahead/behind.intReturns the index of the current token in the original sequence.intrawTokenTypeStart(int steps) See what token type is instepsahead/behind current position.voidSlightly easier way to whatITokenTypeRemapperdoes (i.e.voidsetDebugMode(boolean dbgMode) Enables or disables the builder debug mode.voidsetTokenTypeRemapper(ITokenTypeRemapper remapper) Sets optional remapper that can change the type of tokens.voidsetWhitespaceSkippedCallback(@Nullable WhitespaceSkippedCallback callback) Subscribe for notification on default whitespace and comments skipped events.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.intellij.lang.PsiBuilder
getTreeBuilt
-
Field Details
-
myDelegate
-
-
Constructor Details
-
PsiBuilderAdapter
-
-
Method Details
-
getDelegate
-
getOriginalText
Description copied from interface:SyntaxTreeBuilderReturns the complete text being parsed.- Specified by:
getOriginalTextin interfaceSyntaxTreeBuilder- Returns:
- the text being parsed
-
advanceLexer
public void advanceLexer()Description copied from interface:SyntaxTreeBuilderAdvances the lexer to the next token, skipping whitespace and comment tokens.- Specified by:
advanceLexerin interfaceSyntaxTreeBuilder
-
getTokenType
Description copied from interface:SyntaxTreeBuilderReturns the type of current token from the lexer.- Specified by:
getTokenTypein interfaceSyntaxTreeBuilder- Returns:
- the token type, or
nullwhen the token stream is over.
-
setTokenTypeRemapper
Description copied from interface:SyntaxTreeBuilderSets optional remapper that can change the type of tokens. Output ofSyntaxTreeBuilder.getTokenType()is affected by it.- Specified by:
setTokenTypeRemapperin interfaceSyntaxTreeBuilder- Parameters:
remapper- the remapper object, ornull.
-
setWhitespaceSkippedCallback
Description copied from interface:SyntaxTreeBuilderSubscribe for notification on default whitespace and comments skipped events.- Specified by:
setWhitespaceSkippedCallbackin interfaceSyntaxTreeBuilder- Parameters:
callback- an implementation for the callback
-
isWhitespaceOrComment
- Specified by:
isWhitespaceOrCommentin interfaceSyntaxTreeBuilder
-
remapCurrentToken
Description copied from interface:SyntaxTreeBuilderSlightly easier way to whatITokenTypeRemapperdoes (i.e. it just remaps current token to a given type).- Specified by:
remapCurrentTokenin interfaceSyntaxTreeBuilder- Parameters:
type- new type for the current token.
-
lookAhead
Description copied from interface:SyntaxTreeBuilderSee what token type is instepsahead.- Specified by:
lookAheadin interfaceSyntaxTreeBuilder- Parameters:
steps- 0 is current token (i.e. the sameSyntaxTreeBuilder.getTokenType()returns)- Returns:
- type element which
SyntaxTreeBuilder.getTokenType()will return if we call advancestepstimes in a row
-
rawLookup
Description copied from interface:SyntaxTreeBuilderSee what token type is instepsahead/behind.- Specified by:
rawLookupin interfaceSyntaxTreeBuilder- Parameters:
steps- 0 is current token (i.e. the sameSyntaxTreeBuilder.getTokenType()returns)- Returns:
- type element ahead or behind, including whitespace/comment tokens
-
rawTokenTypeStart
public int rawTokenTypeStart(int steps) Description copied from interface:SyntaxTreeBuilderSee what token type is instepsahead/behind current position.- Specified by:
rawTokenTypeStartin interfaceSyntaxTreeBuilder- Parameters:
steps- 0 is current token (i.e. the sameSyntaxTreeBuilder.getTokenType()returns)- Returns:
- offset type element ahead or behind, including whitespace/comment tokens, -1 if first token,
getOriginalText().getLength()at end
-
rawTokenIndex
public int rawTokenIndex()Description copied from interface:SyntaxTreeBuilderReturns the index of the current token in the original sequence.- Specified by:
rawTokenIndexin interfaceSyntaxTreeBuilder- Returns:
- token index
-
getTokenText
Description copied from interface:SyntaxTreeBuilderReturns the text of the current token from the lexer.- Specified by:
getTokenTextin interfaceSyntaxTreeBuilder- Returns:
- the token text, or
nullwhen the token stream is over.
-
getCurrentOffset
public int getCurrentOffset()Description copied from interface:SyntaxTreeBuilderReturns the start offset of the current token, or the file length when the token stream is over.- Specified by:
getCurrentOffsetin interfaceSyntaxTreeBuilder- Returns:
- the token offset.
-
mark
Description copied from interface:SyntaxTreeBuilderCreates a marker at the current parsing position.- Specified by:
markin interfacePsiBuilder- Specified by:
markin interfaceSyntaxTreeBuilder- Returns:
- the new marker instance.
-
error
Description copied from interface:SyntaxTreeBuilderAdds an error marker with the specified message text at the current position in the tree.
Note: from series of subsequent errors messages only first will be part of resulting tree.- Specified by:
errorin interfaceSyntaxTreeBuilder- Parameters:
messageText- the text of the error message displayed to the user.
-
eof
public boolean eof()Description copied from interface:SyntaxTreeBuilderChecks if the lexer has reached the end of file.- Specified by:
eofin interfaceSyntaxTreeBuilder- Returns:
trueif the lexer is at end of file,falseotherwise.
-
setDebugMode
public void setDebugMode(boolean dbgMode) Description copied from interface:SyntaxTreeBuilderEnables or disables the builder debug mode. In debug mode, the builder will print stack trace to marker allocation position if one is not done when calling#getTreeBuilt().- Specified by:
setDebugModein interfaceSyntaxTreeBuilder- Parameters:
dbgMode- the debug mode value.
-
enforceCommentTokens
- Specified by:
enforceCommentTokensin interfaceSyntaxTreeBuilder
-
getLatestDoneMarker
- Specified by:
getLatestDoneMarkerin interfaceSyntaxTreeBuilder- Returns:
- latest left done node for context dependent parsing.
-
getUserData
- Specified by:
getUserDatain interfacePsiBuilder- Specified by:
getUserDatain interfaceUserDataHolder- Returns:
- a user data value associated with this object. Doesn't require read action.
-
putUserData
Description copied from interface:PsiBuilderAdd a new user data value to this object. Doesn't require write action.- Specified by:
putUserDatain interfacePsiBuilder- Specified by:
putUserDatain interfaceUserDataHolder
-