| java.lang.Object org.netbeans.editor.SyntaxSupport org.netbeans.editor.ext.ExtSyntaxSupport
All known Subclasses: org.netbeans.editor.ext.html.HTMLSyntaxSupport, org.netbeans.editor.ext.java.JavaSyntaxSupport,
ExtSyntaxSupport | public class ExtSyntaxSupport extends SyntaxSupport (Code) | | Support methods for syntax analyzes
author: Miloslav Metelka version: 1.00 |
Inner Class :public interface DeclarationTokenProcessor extends TokenProcessor | |
Inner Class :public interface VariableMapTokenProcessor extends TokenProcessor | |
Method Summary | |
protected Map | buildGlobalVariableMap(int offset) | protected Map | buildLocalVariableMap(int offset) | public int | checkCompletion(JTextComponent target, String typedText, boolean visible) | protected DeclarationTokenProcessor | createDeclarationTokenProcessor(String varName, int startPos, int endPos) | protected VariableMapTokenProcessor | createVariableMapTokenProcessor(int startPos, int endPos) | protected void | documentModified(DocumentEvent evt) Called when the document was modified by either the insert or removal.
Parameters: evt - event received with the modification notification. | public int | findDeclarationPosition(String varName, int varPos) Find either the local or global declaration position. | public int | findGlobalDeclarationPosition(String varName, int varPos) Get the position of the global declaration of a given variable. | public int | findLocalDeclarationPosition(String varName, int varPos) | public int[] | findMatchingBlock(int offset, boolean simpleSearch) Find matching bracket or more generally block that matches with the
current position.
Parameters: offset - position of the starting bracket Parameters: simple - whether the search should skip comment and possibly otherareas. | public Object | findType(String varName, int varPos) Find the type of the variable. | protected TokenID[] | getBracketSkipTokens() Get the array of token IDs that should be skipped when searching for
matching bracket. | public int[] | getCommentBlocks(int startPos, int endPos) Get the blocks consisting of comments in a specified document area. | public TokenID[] | getCommentTokens() Get the array of token IDs that denote the comments. | public int[] | getFunctionBlock(int[] identifierBlock) Is the identifier at the position a function call? It first checks
whether there is a identifier under the cursor and then it searches for
the function call character - usually '('. | public int[] | getFunctionBlock(int offset) | public Map | getGlobalVariableMap(int offset) | public Map | getLocalVariableMap(int offset) | protected BracketFinder | getMatchingBracketFinder(char bracketChar) Get the bracket finder that will search for the matching bracket or null
if the bracket character doesn't belong to bracket characters. | protected int | getMethodStartPosition(int offset) Get the start position of the method or the area where the declaration
can start. | public int | getRowLastValidChar(int offset) Gets the last non-blank and non-comment character on the given line. | public TokenItem | getTokenChain(int startOffset, int endOffset) Get the chain of the tokens for the given block of text. | public TokenID | getTokenID(int offset) Gets the token-id of the token at the given position.
Parameters: offset - position at which the token should be returned token-id of the token at the requested position. | public boolean | isCommentOrWhitespace(int startPos, int endPos) | public boolean | isPrepared() | public boolean | isRowValid(int offset) | public boolean | isWhitespaceToken(TokenID tokenID, char[] buffer, int offset, int tokenLength) |
COMPLETION_CANCEL | final public static int COMPLETION_CANCEL(Code) | | |
COMPLETION_HIDE | final public static int COMPLETION_HIDE(Code) | | |
COMPLETION_POPUP | final public static int COMPLETION_POPUP(Code) | | |
COMPLETION_POST_REFRESH | final public static int COMPLETION_POST_REFRESH(Code) | | |
COMPLETION_REFRESH | final public static int COMPLETION_REFRESH(Code) | | |
buildGlobalVariableMap | protected Map buildGlobalVariableMap(int offset)(Code) | | |
buildLocalVariableMap | protected Map buildLocalVariableMap(int offset)(Code) | | |
checkCompletion | public int checkCompletion(JTextComponent target, String typedText, boolean visible)(Code) | | Check and possibly popup, hide or refresh the completion
|
createDeclarationTokenProcessor | protected DeclarationTokenProcessor createDeclarationTokenProcessor(String varName, int startPos, int endPos)(Code) | | |
createVariableMapTokenProcessor | protected VariableMapTokenProcessor createVariableMapTokenProcessor(int startPos, int endPos)(Code) | | |
documentModified | protected void documentModified(DocumentEvent evt)(Code) | | Called when the document was modified by either the insert or removal.
Parameters: evt - event received with the modification notification. getType()can be used to obtain the type of the event. |
findDeclarationPosition | public int findDeclarationPosition(String varName, int varPos)(Code) | | Find either the local or global declaration position. First try the local
declaration and if it doesn't succeed, then try the global declaration.
|
findGlobalDeclarationPosition | public int findGlobalDeclarationPosition(String varName, int varPos)(Code) | | Get the position of the global declaration of a given variable. By
default it's implemented to use the same token processor as for the local
variables but the whole file is searched.
|
findLocalDeclarationPosition | public int findLocalDeclarationPosition(String varName, int varPos)(Code) | | |
findMatchingBlock | public int[] findMatchingBlock(int offset, boolean simpleSearch) throws BadLocationException(Code) | | Find matching bracket or more generally block that matches with the
current position.
Parameters: offset - position of the starting bracket Parameters: simple - whether the search should skip comment and possibly otherareas. This can be useful when the speed is critical, becausethe simple search is faster. array of integers containing starting and ending position of theblock in the document. Null is returned if there's no matchingblock. |
findType | public Object findType(String varName, int varPos)(Code) | | Find the type of the variable. The default behavior is to first search
for the local variable declaration and then possibly for the global
declaration and if the declaration position is found to get the first
word on that position.
it returns Object to enable the custom implementations to returnthe appropriate instances. |
getBracketSkipTokens | protected TokenID[] getBracketSkipTokens()(Code) | | Get the array of token IDs that should be skipped when searching for
matching bracket. It usually includes comments and character and string
constants. Returns empty array by default.
|
getCommentBlocks | public int[] getCommentBlocks(int startPos, int endPos) throws BadLocationException(Code) | | Get the blocks consisting of comments in a specified document area.
Parameters: doc - document to work with Parameters: startPos - starting position of the searched document area Parameters: endPos - ending position of the searched document area |
getCommentTokens | public TokenID[] getCommentTokens()(Code) | | Get the array of token IDs that denote the comments. Returns empty array
by default.
|
getFunctionBlock | public int[] getFunctionBlock(int[] identifierBlock) throws BadLocationException(Code) | | Is the identifier at the position a function call? It first checks
whether there is a identifier under the cursor and then it searches for
the function call character - usually '('.
Parameters: identifierBlock - int[2] block delimiting the identifier int[2] block or null if there's no function call |
getGlobalVariableMap | public Map getGlobalVariableMap(int offset)(Code) | | |
getLocalVariableMap | public Map getLocalVariableMap(int offset)(Code) | | |
getMatchingBracketFinder | protected BracketFinder getMatchingBracketFinder(char bracketChar)(Code) | | Get the bracket finder that will search for the matching bracket or null
if the bracket character doesn't belong to bracket characters.
|
getMethodStartPosition | protected int getMethodStartPosition(int offset)(Code) | | Get the start position of the method or the area where the declaration
can start.
|
getRowLastValidChar | public int getRowLastValidChar(int offset) throws BadLocationException(Code) | | Gets the last non-blank and non-comment character on the given line.
|
getTokenChain | public TokenItem getTokenChain(int startOffset, int endOffset) throws BadLocationException(Code) | | Get the chain of the tokens for the given block of text. The returned
chain of token-items reflects the tokens as they occur in the text and
therefore the first token can start at the slightly lower position than
the requested one. The chain itself can be extended automatically when
reaching the first chain item and calling getPrevious() on it.
Another chunk of the tokens will be parsed and the head of the chain will
be extended. However this happens only in case there was no modification
performed to the document between the creation of the chain and this
moment. Otherwise this call throws IllegalStateException.
Parameters: startOffset - starting position of the block Parameters: endOffset - ending position of the block the first item of the token-item chain or null if there are notokens in the given area or the area is so small that it laysinside one token. To prevent this provide the area that spans anew-line. |
getTokenID | public TokenID getTokenID(int offset) throws BadLocationException(Code) | | Gets the token-id of the token at the given position.
Parameters: offset - position at which the token should be returned token-id of the token at the requested position. If there's nomore tokens in the text, the Syntax.INVALID isreturned. |
isPrepared | public boolean isPrepared()(Code) | | Check if sources for code completion are already available
|
isRowValid | public boolean isRowValid(int offset) throws BadLocationException(Code) | | Does the line contain some valid code besides of possible white space and
comments?
|
isWhitespaceToken | public boolean isWhitespaceToken(TokenID tokenID, char[] buffer, int offset, int tokenLength)(Code) | | |
Fields inherited from org.netbeans.editor.SyntaxSupport | protected boolean tokenNumericIDsValid(Code)(Java Doc)
|
Methods inherited from org.netbeans.editor.SyntaxSupport | protected SyntaxSupport createSyntaxSupport(Class syntaxSupportClass)(Code)(Java Doc) public int findInsideBlocks(Finder finder, int startPos, int endPos, int[] blocks) throws BadLocationException(Code)(Java Doc) public int findOutsideBlocks(Finder finder, int startPos, int endPos, int[] blocks) throws BadLocationException(Code)(Java Doc) public synchronized SyntaxSupport get(Class syntaxSupportClass)(Code)(Java Doc) final public BaseDocument getDocument()(Code)(Java Doc) public synchronized int[] getTokenBlocks(int startPos, int endPos, TokenID[] tokenIDArray) throws BadLocationException(Code)(Java Doc) public TokenItem getTokenChain(int offset) throws BadLocationException(Code)(Java Doc) public void initSyntax(Syntax syntax, int startPos, int endPos, boolean forceLastBuffer, boolean forceNotLastBuffer) throws BadLocationException(Code)(Java Doc) public boolean isIdentifier(String word)(Code)(Java Doc) public void tokenizeText(TokenProcessor tp, int startOffset, int endOffset, boolean forceLastBuffer) throws BadLocationException(Code)(Java Doc) public void tokenizeText(TokenProcessor tp, String text)(Code)(Java Doc)
|
|
|