public abstract class TokenMarker extends Object
markTokens
should
only be used for immediate painting. Notably, it cannot be cached.org.syntax.jedit.Token
Modifier and Type | Class and Description |
---|---|
class |
TokenMarker.LineInfo
Inner class for storing information about tokenized lines.
|
Modifier and Type | Field and Description |
---|---|
protected Token |
firstToken
The first token in the list.
|
protected int |
lastLine
The last tokenized line.
|
protected Token |
lastToken
The last token in the list.
|
protected int |
length
The number of lines in the model being tokenized.
|
protected TokenMarker.LineInfo[] |
lineInfo
An array for storing information about lines.
|
protected boolean |
nextLineRequested
True if the next line should be painted.
|
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.
|
protected void |
ensureCapacity(int index)
Ensures that the
lineInfo array can contain the specified
index. |
int |
getLineCount()
Returns the number of lines in this token marker.
|
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.
|
Token |
markTokens(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,
Segment line,
int lineIndex)
An abstract method that splits a line up into tokens.
|
boolean |
supportsMultilineTokens()
Returns if the token marker supports tokens that span multiple lines.
|
protected Token firstToken
markTokens()
.protected Token lastToken
protected TokenMarker.LineInfo[] lineInfo
insertLines()
and
deleteLines()
methods.protected int length
lineInfo
array.protected int lastLine
protected boolean nextLineRequested
protected TokenMarker()
TokenMarker
. This DOES NOT create a lineInfo
array; an initial call to insertLines()
does that.public Token markTokens(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, Segment line, int lineIndex)
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 multiline 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 tokenizedlineIndex
- The index of the line in the document, starting at 0public boolean supportsMultilineTokens()
markTokens()
method (in turn).
The default implementation returns true; it should be overridden to return
false on simpler token markers for increased speed.public 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 int getLineCount()
public boolean isNextLineRequested()
protected void ensureCapacity(int index)
lineInfo
array can contain the specified
index. This enlarges it if necessary. No action is taken if the array is
large enough already.
It should be unnecessary to call this under normal circumstances;
insertLine()
should take care of enlarging the line info
array automatically.index
- The array indexprotected void addToken(int length, byte id)
length
- The length of the tokenid
- The id of the tokenCopyright © 2019. All Rights Reserved.