public abstract class TokenMarker
extends java.lang.Object
For performance reasons, the linked list of tokens is reused after each line
is tokenized. Therefore, the return value of markTokens
should only
be used for immediate painting. Notably, it cannot be cached.
Token
Modifier | Constructor and Description |
---|---|
protected |
TokenMarker()
Creates a new
TokenMarker . |
Modifier and Type | Method and Description |
---|---|
protected void |
addToken(int length,
byte id)
Adds a token to the token list.
|
void |
deleteLines(int index,
int lines)
Informs the token marker that line have been deleted from the document.
|
void |
insertLines(int index,
int lines)
Informs the token marker that lines have been inserted into the document.
|
boolean |
isNextLineRequested()
Returns true if the next line should be repainted.
|
@NotNull java.util.List<Token> |
markTokens(@NotNull javax.swing.text.Segment line,
int lineIndex)
A wrapper for the lower-level
markTokensImpl method that is
called to split a line up into tokens. |
protected abstract byte |
markTokensImpl(byte token,
@NotNull javax.swing.text.Segment line)
An abstract method that splits a line up into tokens.
|
protected TokenMarker()
TokenMarker
. This DOES NOT create a lineInfo array;
an initial call to insertLines()
does that.@NotNull public @NotNull java.util.List<Token> markTokens(@NotNull @NotNull javax.swing.text.Segment line, int lineIndex)
markTokensImpl
method that is
called to split a line up into tokens.line
- the linelineIndex
- the line numberprotected abstract byte markTokensImpl(byte token, @NotNull @NotNull javax.swing.text.Segment line)
addToken()
to add syntax tokens to the token list.
Then, it should return the initial token type for the next line.
For example if the current line contains the start of a multi-line comment that doesn't end on that line, this method should return the comment token type so that it continues on the next line.
token
- the initial token type for this lineline
- the line to be tokenizedpublic void insertLines(int index, int lines)
lineInfo
array.index
- the first line numberlines
- the number of linespublic void deleteLines(int index, int lines)
lineInfo
array.index
- the first line numberlines
- the number of linespublic boolean isNextLineRequested()
protected void addToken(int length, byte id)
length
- the length of the tokenid
- the id of the token