Class TokenMarker
java.lang.Object
mars.venus.editors.jeditsyntax.tokenmarker.TokenMarker
- Direct Known Subclasses:
MIPSTokenMarker
A token marker that splits lines of text into tokens. Each token carries
a length field and an identification 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.
- Version:
- $Id: TokenMarker.java,v 1.32 1999/12/13 03:40:30 sp Exp $
- Author:
- Slava Pestov
- See Also:
Token
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Inner class for storing information about tokenized lines. -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteLines(int index, int lines)
Informs the token marker that line have been deleted from the document.int
Returns the number of lines in this token marker.getTokenExactMatchHelp(Token token, String tokenText)
Construct and return any appropriate help information for the given token.getTokenPrefixMatchHelp(String line, Token tokenList, Token tokenAtOffset, String tokenText)
Construct and return any appropriate help information for the given token or "token prefix".void
insertLines(int index, int lines)
Informs the token marker that lines have been inserted into the document.boolean
Returns true if the next line should be repainted.markTokens(Segment line, int lineIndex)
A wrapper for the lower-levelmarkTokensImpl
method that is called to split a line up into tokens.boolean
Returns if the token marker supports tokens that span multiple lines.
-
Method Details
-
markTokens
A wrapper for the lower-levelmarkTokensImpl
method that is called to split a line up into tokens.- Parameters:
line
- The linelineIndex
- The line number
-
supportsMultilineTokens
public boolean supportsMultilineTokens()Returns if the token marker supports tokens that span multiple lines. If this is true, the object using this token marker is required to pass all lines in the document to themarkTokens()
method (in turn).The default implementation returns true; it should be overridden to return false on simpler token markers for increased speed.
-
insertLines
public void insertLines(int index, int lines)Informs the token marker that lines have been inserted into the document. This inserts a gap in thelineInfo
array.- Parameters:
index
- The first line numberlines
- The number of lines
-
deleteLines
public void deleteLines(int index, int lines)Informs the token marker that line have been deleted from the document. This removes the lines in question from thelineInfo
array.- Parameters:
index
- The first line numberlines
- The number of lines
-
getLineCount
public int getLineCount()Returns the number of lines in this token marker. -
isNextLineRequested
public boolean isNextLineRequested()Returns true if the next line should be repainted. This will return true after a line has been tokenized that starts a multiline token that continues onto the next line. -
getTokenExactMatchHelp
Construct and return any appropriate help information for the given token. This default definition returns null; override it in language-specific subclasses.- Parameters:
token
- the pertinent Token objecttokenText
- the source String that matched to the token- Returns:
- ArrayList containing PopupHelpItem objects, one per match.
-
getTokenPrefixMatchHelp
public ArrayList<PopupHelpItem> getTokenPrefixMatchHelp(String line, Token tokenList, Token tokenAtOffset, String tokenText)Construct and return any appropriate help information for the given token or "token prefix". Will match instruction prefixes, e.g. "s" matches "sw". This default definition returns null; override it in language-specific subclasses.- Parameters:
line
- String containing current linetokenList
- first Token on the current linetokenAtOffset
- the pertinent Token objecttokenText
- the source String that matched to the token- Returns:
- ArrayList containing PopupHelpItem objects, one per match.
-