Packages

c

org.antlr.intellij.adaptor.lexer

ANTLRLexerAdaptor

class ANTLRLexerAdaptor extends LexerBase

This is the adaptor class for implementations of com.intellij.lexer.Lexer backed by an ANTLR 4 lexer. It supports any ANTLR 4 lexer that does not store extra information for use in custom actions. For lexers that do not store custom state information, this default implementation is sufficient. Otherwise, subclass and override: {#getInitialState} and {#getLexerState}.

Intellij lexers need to track state as they must be able to restart lexing in the middle of the input buffer. From Intellij doc:

"A lexer that can be used incrementally may need to return its state, which means the context corresponding to each position in a file. For example, a Java lexer could have separate states for top level context, comment context and string literal context. An important requirement for a syntax highlighting lexer is that its state must be represented by a single integer number returned from Lexer.getState(). That state will be passed to the Lexer.start() method, along with the start offset of the fragment to process, when lexing is resumed from the middle of a file."

This implementation supports single- as well as multi-mode lexers.

Linear Supertypes
LexerBase, Lexer, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ANTLRLexerAdaptor
  2. LexerBase
  3. Lexer
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ANTLRLexerAdaptor(language: Language, lexer: Lexer)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def advance(): Unit
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  5. def applyLexerState(input: CharStream, state: ANTLRLexerState): Unit

    Update the current lexer to use the specified input stream starting in the specified state.

    Update the current lexer to use the specified input stream starting in the specified state.

    The current lexer may be obtained by calling #getLexer. The default implementation calls Lexer#setInputStream to set the input stream, followed by ANTLRLexerState#apply to initialize the state of the lexer.

    input

    The new input stream for the lexer.

    state

    A ANTLRLexerState instance containing the starting state for the lexer.

    Attributes
    protected[adaptor.lexer]
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def getBufferEnd(): Int
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  11. def getBufferSequence(): CharSequence
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  13. def getCurrentPosition(): LexerPosition
    Definition Classes
    LexerBase → Lexer
  14. def getCurrentToken(): Token

    Gets the Token object providing information for calls to #getTokenStart, #getTokenType, etc.

    Gets the Token object providing information for calls to #getTokenStart, #getTokenType, etc.

    returns

    The current Token instance.

    Attributes
    protected[adaptor.lexer]
  15. def getInitialState(): ANTLRLexerState

    Get the initial ANTLRLexerState of the lexer.

    Get the initial ANTLRLexerState of the lexer.

    returns

    a ANTLRLexerState instance representing the state of the lexer at the beginning of an input.

    Attributes
    protected[adaptor.lexer]
  16. def getLexer(): Lexer

    Gets the ANTLR Lexer used for actual tokenization of the input.

    Gets the ANTLR Lexer used for actual tokenization of the input.

    returns

    the ANTLR Lexer instance

    Attributes
    protected[adaptor.lexer]
  17. def getLexerState(lexer: Lexer): ANTLRLexerState

    Get a ANTLRLexerState instance representing the current state of the specified lexer.

    Get a ANTLRLexerState instance representing the current state of the specified lexer.

    lexer

    The lexer.

    returns

    A ANTLRLexerState instance containing the current state of the lexer.

    Attributes
    protected[adaptor.lexer]
  18. def getState(): Int
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  19. def getTokenEnd(): Int
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  20. def getTokenSequence(): CharSequence
    Definition Classes
    Lexer
  21. def getTokenStart(): Int
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  22. def getTokenText(): String
    Definition Classes
    Lexer
  23. def getTokenType(antlrTokenType: Int): IElementType
    Annotations
    @Nullable()
  24. def getTokenType(): IElementType
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Nullable() @Override()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  26. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  30. def restore(arg0: LexerPosition): Unit
    Definition Classes
    LexerBase → Lexer
  31. def start(buffer: CharSequence, startOffset: Int, endOffset: Int, initialState: Int): Unit
    Definition Classes
    ANTLRLexerAdaptor → Lexer
    Annotations
    @Override()
  32. final def start(arg0: CharSequence): Unit
    Definition Classes
    Lexer
  33. final def start(arg0: CharSequence, arg1: Int, arg2: Int): Unit
    Definition Classes
    Lexer
  34. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  35. def toLexerState(state: Int): ANTLRLexerState

    Gets the ANTLRLexerState corresponding to the specified IntelliJ state.

    Gets the ANTLRLexerState corresponding to the specified IntelliJ state.

    state

    The lexer state provided by IntelliJ.

    returns

    The ANTLRLexerState instance corresponding to the specified state.

    Attributes
    protected[adaptor.lexer]
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from LexerBase

Inherited from Lexer

Inherited from AnyRef

Inherited from Any

Ungrouped