Package org.gjt.sp.jedit.syntax
Class DefaultTokenHandler
- java.lang.Object
-
- org.gjt.sp.jedit.syntax.DefaultTokenHandler
-
- All Implemented Interfaces:
TokenHandler
- Direct Known Subclasses:
DisplayTokenHandler
public class DefaultTokenHandler extends java.lang.Object implements TokenHandler
Builds a linked list of tokens without any additional processing.- Since:
- jEdit 4.1pre1
-
-
Field Summary
Fields Modifier and Type Field Description protected Token
firstToken
protected Token
lastToken
protected TokenMarker.LineContext
lineContext
-
Constructor Summary
Constructors Constructor Description DefaultTokenHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addToken(Token token, TokenMarker.LineContext context)
protected Token
createToken(byte id, int offset, int length, TokenMarker.LineContext context)
TokenMarker.LineContext
getLineContext()
The token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed (meaning subsequent lines might need to be retokenized).protected ParserRuleSet
getParserRuleSet(TokenMarker.LineContext context)
Token
getTokens()
Returns the first syntax token.void
handleToken(javax.swing.text.Segment seg, byte id, int offset, int length, TokenMarker.LineContext context)
Called by the token marker when a syntax token has been parsed.void
init()
Clears the list of tokens.void
setLineContext(TokenMarker.LineContext lineContext)
The token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed (meaning subsequent lines might need to be retokenized).
-
-
-
Field Detail
-
firstToken
protected Token firstToken
-
lastToken
protected Token lastToken
-
lineContext
protected TokenMarker.LineContext lineContext
-
-
Method Detail
-
init
public void init()
Clears the list of tokens.
-
getTokens
public Token getTokens()
Returns the first syntax token.- Since:
- jEdit 4.1pre1
-
handleToken
public void handleToken(javax.swing.text.Segment seg, byte id, int offset, int length, TokenMarker.LineContext context)
Called by the token marker when a syntax token has been parsed.- Specified by:
handleToken
in interfaceTokenHandler
- Parameters:
seg
- The segment containing the textid
- The token type (one of the constants in theToken
class).offset
- The start offset of the tokenlength
- The number of characters in the tokencontext
- The line context- Since:
- jEdit 4.2pre3
-
getLineContext
public TokenMarker.LineContext getLineContext()
The token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed (meaning subsequent lines might need to be retokenized).- Since:
- jEdit 4.2pre6
-
setLineContext
public void setLineContext(TokenMarker.LineContext lineContext)
The token handler can compare this object with the object previously given for this line to see if the token type at the end of the line has changed (meaning subsequent lines might need to be retokenized).- Specified by:
setLineContext
in interfaceTokenHandler
- Since:
- jEdit 4.2pre6
-
getParserRuleSet
protected ParserRuleSet getParserRuleSet(TokenMarker.LineContext context)
-
createToken
protected Token createToken(byte id, int offset, int length, TokenMarker.LineContext context)
-
addToken
protected void addToken(Token token, TokenMarker.LineContext context)
-
-