接口 SyntaxTreeBuilder

所有已知子接口:
PsiBuilder
所有已知实现类:
FleetPsiBuilder, GeneratedParserUtilBase.Builder, IndentPsiBuilder, MarkerPsiBuilder, PsiBuilderAdapter, SyntaxTreeBuilderAdapter

public interface SyntaxTreeBuilder
  • 方法详细资料

    • getOriginalText

      @NotNull @NotNull CharSequence getOriginalText()
      Returns the complete text being parsed.
      返回:
      the text being parsed
    • advanceLexer

      void advanceLexer()
      Advances the lexer to the next token, skipping whitespace and comment tokens.
    • getTokenType

      @Nullable @Nullable IElementType getTokenType()
      Returns the type of current token from the lexer.
      返回:
      the token type, or null when the token stream is over.
    • setTokenTypeRemapper

      void setTokenTypeRemapper(@Nullable @Nullable ITokenTypeRemapper remapper)
      Sets optional remapper that can change the type of tokens. Output of getTokenType() is affected by it.
      参数:
      remapper - the remapper object, or null.
    • remapCurrentToken

      void remapCurrentToken(IElementType type)
      Slightly easier way to what ITokenTypeRemapper does (i.e. it just remaps current token to a given type).
      参数:
      type - new type for the current token.
    • setWhitespaceSkippedCallback

      void setWhitespaceSkippedCallback(@Nullable @Nullable WhitespaceSkippedCallback callback)
      Subscribe for notification on default whitespace and comments skipped events.
      参数:
      callback - an implementation for the callback
    • lookAhead

      @Nullable @Nullable IElementType lookAhead(int steps)
      See what token type is in steps ahead.
      参数:
      steps - 0 is current token (i.e. the same getTokenType() returns)
      返回:
      type element which getTokenType() will return if we call advance steps times in a row
    • rawLookup

      @Nullable @Nullable IElementType rawLookup(int steps)
      See what token type is in steps ahead/behind.
      参数:
      steps - 0 is current token (i.e. the same getTokenType() returns)
      返回:
      type element ahead or behind, including whitespace/comment tokens
    • rawTokenTypeStart

      int rawTokenTypeStart(int steps)
      See what token type is in steps ahead/behind current position.
      参数:
      steps - 0 is current token (i.e. the same getTokenType() returns)
      返回:
      offset type element ahead or behind, including whitespace/comment tokens, -1 if first token, getOriginalText().getLength() at end
    • rawTokenIndex

      int rawTokenIndex()
      Returns the index of the current token in the original sequence.
      返回:
      token index
    • getTokenText

      @NonNls @Nullable @NonNls @Nullable String getTokenText()
      Returns the text of the current token from the lexer.
      返回:
      the token text, or null when the token stream is over.
    • getCurrentOffset

      int getCurrentOffset()
      Returns the start offset of the current token, or the file length when the token stream is over.
      返回:
      the token offset.
    • mark

      @NotNull @NotNull SyntaxTreeBuilder.Marker mark()
      Creates a marker at the current parsing position.
      返回:
      the new marker instance.
    • error

      void error(@NotNull @NotNull String messageText)
      Adds 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.
      参数:
      messageText - the text of the error message displayed to the user.
    • eof

      boolean eof()
      Checks if the lexer has reached the end of file.
      返回:
      true if the lexer is at end of file, false otherwise.
    • setDebugMode

      void setDebugMode(boolean dbgMode)
      Enables 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().
      参数:
      dbgMode - the debug mode value.
    • enforceCommentTokens

      void enforceCommentTokens(@NotNull @NotNull TokenSet tokens)
    • getLatestDoneMarker

      @Nullable @Nullable LighterASTNode getLatestDoneMarker()
      返回:
      latest left done node for context dependent parsing.
    • isWhitespaceOrComment

      default boolean isWhitespaceOrComment(@NotNull @NotNull IElementType elementType)