Class DelegateLexer

Direct Known Subclasses:
LayeredLexer, MergingLexerAdapterBase

public class DelegateLexer extends LexerBase
  • Field Details

    • myDelegate

      protected final Lexer myDelegate
  • Constructor Details

    • DelegateLexer

      public DelegateLexer(@NotNull @NotNull Lexer delegate)
  • Method Details

    • getDelegate

      public final Lexer getDelegate()
    • start

      public void start(@NotNull @NotNull CharSequence buffer, int startOffset, int endOffset, int initialState)
      Description copied from class: Lexer
      Prepare for lexing character data from buffer passed. Internal lexer state is supposed to be initialState. It is guaranteed that the value of initialState is the same as returned by Lexer.getState() method of this lexer at condition startOffset=getTokenStart(). This method is used to incrementally re-lex changed characters using lexing data acquired from this particular lexer sometime in the past.
      Specified by:
      start in class Lexer
      Parameters:
      buffer - character data for lexing.
      startOffset - offset to start lexing from
      endOffset - offset to stop lexing at
      initialState - the initial state of the lexer.
    • getState

      public int getState()
      Description copied from class: Lexer
      Returns the current state of the lexer.
      Specified by:
      getState in class Lexer
      Returns:
      the lexer state.
    • getTokenType

      @Nullable public @Nullable IElementType getTokenType()
      Description copied from class: Lexer
      Returns the token at the current position of the lexer or null if lexing is finished.
      Specified by:
      getTokenType in class Lexer
      Returns:
      the current token.
    • getTokenStart

      public int getTokenStart()
      Description copied from class: Lexer
      Returns the start offset of the current token.
      Specified by:
      getTokenStart in class Lexer
      Returns:
      the current token start offset.
    • getTokenEnd

      public int getTokenEnd()
      Description copied from class: Lexer
      Returns the end offset of the current token.
      Specified by:
      getTokenEnd in class Lexer
      Returns:
      the current token end offset.
    • advance

      public void advance()
      Description copied from class: Lexer
      Advances the lexer to the next token.
      Specified by:
      advance in class Lexer
    • getBufferSequence

      @NotNull public final @NotNull CharSequence getBufferSequence()
      Description copied from class: Lexer
      Returns the buffer sequence over which the lexer is running. This method should return the same buffer instance which was passed to the start() method.
      Specified by:
      getBufferSequence in class Lexer
      Returns:
      the lexer buffer.
    • getBufferEnd

      public int getBufferEnd()
      Description copied from class: Lexer
      Returns the offset at which the lexer will stop lexing. This method should return the length of the buffer or the value passed in the endOffset parameter to the start() method.
      Specified by:
      getBufferEnd in class Lexer
      Returns:
      the lexing end offset