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.
- Alphabetic
- By Inheritance
- ANTLRLexerAdaptor
- LexerBase
- Lexer
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ANTLRLexerAdaptor(language: Language, lexer: Lexer)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def advance(): Unit
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- def applyLexerState(input: CharStream, state: ANTLRLexerState): Unit
Update the current lexer to use the specified
input
stream starting in the specifiedstate
.Update the current lexer to use the specified
input
stream starting in the specifiedstate
.The current lexer may be obtained by calling
#getLexer
. The default implementation callsLexer#setInputStream
to set the input stream, followed byANTLRLexerState#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]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def getBufferEnd(): Int
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- def getBufferSequence(): CharSequence
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def getCurrentPosition(): LexerPosition
- Definition Classes
- LexerBase → Lexer
- 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]
- 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]
- 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]
- 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]
- def getState(): Int
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- def getTokenEnd(): Int
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- def getTokenSequence(): CharSequence
- Definition Classes
- Lexer
- def getTokenStart(): Int
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- def getTokenText(): String
- Definition Classes
- Lexer
- def getTokenType(antlrTokenType: Int): IElementType
- Annotations
- @Nullable()
- def getTokenType(): IElementType
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Nullable() @Override()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- def restore(arg0: LexerPosition): Unit
- Definition Classes
- LexerBase → Lexer
- def start(buffer: CharSequence, startOffset: Int, endOffset: Int, initialState: Int): Unit
- Definition Classes
- ANTLRLexerAdaptor → Lexer
- Annotations
- @Override()
- final def start(arg0: CharSequence): Unit
- Definition Classes
- Lexer
- final def start(arg0: CharSequence, arg1: Int, arg2: Int): Unit
- Definition Classes
- Lexer
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toLexerState(state: Int): ANTLRLexerState
Gets the
ANTLRLexerState
corresponding to the specified IntelliJstate
.Gets the
ANTLRLexerState
corresponding to the specified IntelliJstate
.- state
The lexer state provided by IntelliJ.
- returns
The
ANTLRLexerState
instance corresponding to the specified state.
- Attributes
- protected[adaptor.lexer]
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)