| java.lang.Object workbench.gui.editor.TokenMarker
All known Subclasses: workbench.gui.editor.SQLTokenMarker,
TokenMarker | abstract public class TokenMarker (Code) | | A token marker that splits lines of text into tokens. Each token carries
a length field and an indentification tag that can be mapped to a color
for painting that token.
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.
author: Slava Pestov, Thomas Kellerer See Also: Token |
Constructor Summary | |
protected | TokenMarker() Creates a new TokenMarker . |
Method Summary | |
protected synchronized Token | addToken(int lineIndex, int length, byte id) Adds a token to the token list. | public void | deleteLines(int index, int lines) Informs the token marker that line have been deleted from
the document. | public void | dispose() | public synchronized Token | getFirstTokenInLine(int lineIndex) | public Token | getLastTokenInLine(int lineIndex) | public int | getLineCount() Returns the number of lines in this token marker. | abstract public char | getPendingLiteralChar() | public synchronized Token | getToken(Segment line, int lineIndex) | public void | insertLines(int index, int lines) Informs the token marker that lines have been inserted into
the document. | public synchronized Token | markTokens(Segment line, int lineIndex) A wrapper for the lower-level markTokensImpl method
that is called to split a line up into tokens. | abstract protected void | markTokensImpl(Token lastToken, Segment line, int lineIndex) An abstract method that splits a line up into tokens. |
length | protected int length(Code) | | The number of lines in the model being tokenized. This can be
less than the length of the lineInfo array.
|
TokenMarker | protected TokenMarker()(Code) | | Creates a new TokenMarker . This DOES NOT create
a lineInfo array; an initial call to insertLines()
does that.
|
addToken | protected synchronized Token addToken(int lineIndex, int length, byte id)(Code) | | Adds a token to the token list.
Parameters: length - The length of the token Parameters: id - The id of the token |
deleteLines | public void deleteLines(int index, int lines)(Code) | | Informs the token marker that line have been deleted from
the document. This removes the lines in question from the
lineInfo array.
Parameters: index - The first line number Parameters: lines - The number of lines |
dispose | public void dispose()(Code) | | |
getFirstTokenInLine | public synchronized Token getFirstTokenInLine(int lineIndex)(Code) | | |
getLastTokenInLine | public Token getLastTokenInLine(int lineIndex)(Code) | | |
getLineCount | public int getLineCount()(Code) | | Returns the number of lines in this token marker.
|
getPendingLiteralChar | abstract public char getPendingLiteralChar()(Code) | | |
insertLines | public void insertLines(int index, int lines)(Code) | | Informs the token marker that lines have been inserted into
the document. This inserts a gap in the lineInfo
array.
Parameters: index - The first line number Parameters: lines - The number of lines |
markTokens | public synchronized Token markTokens(Segment line, int lineIndex)(Code) | | A wrapper for the lower-level markTokensImpl method
that is called to split a line up into tokens.
Parameters: line - The line Parameters: lineIndex - The line number |
markTokensImpl | abstract protected void markTokensImpl(Token lastToken, Segment line, int lineIndex)(Code) | | An abstract method that splits a line up into tokens. It
should parse the line, and call 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.
Parameters: token - The initial token type for this line Parameters: line - The line to be tokenized Parameters: lineIndex - The index of the line in the document,starting at 0 The initial token type for the next line |
|
|