java.lang.Object
org.gjt.sp.jedit.syntax.TokenMarkerContext
- public class TokenMarkerContext
- extends java.lang.Object
This class contains the Context of a Token Marker that can be passed along
nested Token Markers through a method like
markTokensImpl(MyToken token, TokenMarkerContext ctx) : MyToken
where MyToken represents the token state at the end of the marked line.
It contains useful infos such as last offset and last keyword and the pos in the marked line
It also provides utility functions that are often used in TokenMarkers such as
addTokenToPos, addTokenToEnd
doKeywordToPos, doKeywordToEnd
- Version:
- 0.6
line
public javax.swing.text.Segment line
lineIndex
public int lineIndex
array
public char[] array
offset
public int offset
lastOffset
public int lastOffset
lastKeyword
public int lastKeyword
length
public int length
pos
public int pos
marker
private TokenMarkerWithAddToken marker
prevLineInfo
public TokenMarker.LineInfo prevLineInfo
currLineInfo
public TokenMarker.LineInfo currLineInfo
TokenMarkerContext
public TokenMarkerContext(javax.swing.text.Segment line,
int lineIndex,
TokenMarkerWithAddToken marker,
TokenMarker.LineInfo[] lineInfo)
TokenMarkerContext
public TokenMarkerContext(javax.swing.text.Segment line,
int lineIndex,
TokenMarkerWithAddToken marker)
atFirst
public boolean atFirst()
hasMoreChars
public boolean hasMoreChars()
remainingChars
public int remainingChars()
getChar
public char getChar()
getChar
public char getChar(int inc)
lastChar
public char lastChar()
addToken
public void addToken(int length,
byte id)
addTokenToPos
public void addTokenToPos(byte id)
- Adds a token to the position specified (position exclusive)
The character at pos index is excluded
addTokenToPos
public void addTokenToPos(int pos,
byte id)
addTokenToEnd
public void addTokenToEnd(byte id)
doKeywordToPos
public byte doKeywordToPos(int pos,
KeywordMap keywords)
doKeywordToPos
public byte doKeywordToPos(KeywordMap keywords)
doKeywordToEnd
public byte doKeywordToEnd(KeywordMap keywords)
regionMatches
public boolean regionMatches(boolean ignoreCase,
java.lang.String match)
RERegionMatches
public gnu.regexp.REMatch RERegionMatches(gnu.regexp.RE match)
RERegionMatches
private static gnu.regexp.REMatch RERegionMatches(javax.swing.text.Segment text,
int offset,
gnu.regexp.RE match)
- Checks if a subregion of a
Segment matches a regular expression.
The match-beginning operator (^) in the regular expression matches segment at position offset
This function is intended to be part of SyntaxUtilities
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method
never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string
concatenation with this object. If the result is
null, string concatenation will instead
use "null".
The default implementation returns
getClass().getName() + "@" +
Integer.toHexString(hashCode()).