| org.netbeans.editor.TokenProcessor
All known Subclasses: org.netbeans.editor.ext.java.JCTokenProcessor, org.netbeans.editor.ext.java.JavaImport,
TokenProcessor | public interface TokenProcessor (Code) | | Process the tokens
author: Miloslav Metelka version: 1.00 |
Method Summary | |
public int | eot(int offset) Notify that end of scanned buffer was found. | public void | nextBuffer(char[] buffer, int offset, int len, int startPos, int preScan, boolean lastBuffer) Notify that the following buffer will be scanned. | public boolean | token(TokenID tokenID, TokenContextPath tokenContextPath, int tokenBufferOffset, int tokenLength) Notify that the token was found.
Parameters: tokenID - ID of the token found Parameters: tokenContextPath - Context-path in which the token that was found. Parameters: tokenBufferOffset - Offset of the token in the buffer. |
eot | public int eot(int offset)(Code) | | Notify that end of scanned buffer was found. The method decides whether
to continue the scan or stop. The rest of characters that were not
scanned, because the is not completed is also provided.
Parameters: offset - offset of the rest of the characters 0 to stop token processing, > 0 process additional charactersin the document |
nextBuffer | public void nextBuffer(char[] buffer, int offset, int len, int startPos, int preScan, boolean lastBuffer)(Code) | | Notify that the following buffer will be scanned. This method is called
before the buffer is being scanned.
Parameters: buffer - buffer that will be scanned. To get the text of the tokens thebuffer should be stored in some instance variable. Parameters: offset - offset in the buffer with the first character to be scanned.If doesn't reflect the possible preScan. If the preScan wouldbe non-zero then the first buffer offset that contains thevalid data is offset - preScan. Parameters: len - count of the characters that will be scanned. It doesn'treflect the ppossible reScan. Parameters: startPos - starting position of the scanning in the document. Itlogically corresponds to the offset because of thesame text data both in the buffer and in the document. Itagain doesn't reflect the possible preScan and thestartPos - preScan gives the real start of thefirst token. If it's necessary to know the position of eachtoken, it's a good idea to store the valuestartPos - offset in an instance variable thatcould be called bufferStartPos. The position ofthe token can be then computed asbufferStartPos + tokenBufferOffset. Parameters: preScan - preScan needed for the scanning. Parameters: lastBuffer - whether this is the last buffer to scan in the document sothere are no more characters in the document after thisbuffer. @ |
token | public boolean token(TokenID tokenID, TokenContextPath tokenContextPath, int tokenBufferOffset, int tokenLength)(Code) | | Notify that the token was found.
Parameters: tokenID - ID of the token found Parameters: tokenContextPath - Context-path in which the token that was found. Parameters: tokenBufferOffset - Offset of the token in the buffer. The buffer is provided inthe nextBuffer() method. Parameters: tokenLength - Length of the token found true if the next token should be searched or false if the scanshould be stopped completely. |
|
|