public class SyntaxSupport extends Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
tokenNumericIDsValid
Whether all the token-ids this class deals with have valid
numeric-ids.
|
Constructor and Description |
---|
SyntaxSupport(BaseDocument doc) |
Modifier and Type | Method and Description |
---|---|
protected SyntaxSupport |
createSyntaxSupport(Class syntaxSupportClass) |
int |
findInsideBlocks(Finder finder,
int startPos,
int endPos,
int[] blocks) |
int |
findOutsideBlocks(Finder finder,
int startPos,
int endPos,
int[] blocks) |
SyntaxSupport |
get(Class syntaxSupportClass)
Get the support that fits the requested support class
in the best way.
|
BaseDocument |
getDocument()
Getter for the document that this support is associated to.
|
int[] |
getTokenBlocks(int startPos,
int endPos,
TokenID[] tokenIDArray)
Get position pairs covering the blocks that include only the tokens
from the given token array.
|
TokenItem |
getTokenChain(int offset)
Get the member of the chain of the tokens for the given document position.
|
void |
initSyntax(Syntax syntax,
int startPos,
int endPos,
boolean forceLastBuffer,
boolean forceNotLastBuffer)
Initialize the syntax so it's ready to scan the given area.
|
protected boolean |
isAbbrevDisabled(int offset)
Check whether the abbreviation expansion should be disabled
at the given offset.
|
boolean |
isIdentifier(String word)
Check whether the given word is identifier or not.
|
void |
tokenizeText(TokenProcessor tp,
int startOffset,
int endOffset,
boolean forceLastBuffer)
Parse the text and pass the resulting tokens to the token processor.
|
void |
tokenizeText(TokenProcessor tp,
String text)
Parse the text and pass the resulting tokens to the token processor.
|
protected boolean tokenNumericIDsValid
public SyntaxSupport(BaseDocument doc)
public final BaseDocument getDocument()
public SyntaxSupport get(Class syntaxSupportClass)
syntaxSupportClass
- returned value will be instance of this
class (or its descendant) or it will be nullprotected SyntaxSupport createSyntaxSupport(Class syntaxSupportClass)
public int[] getTokenBlocks(int startPos, int endPos, TokenID[] tokenIDArray) throws BadLocationException
doc
- document to work withstartPos
- starting position of the requested document area.endPos
- ending position of the requested document areatokenIDArray
- the array of the token IDs that should be in the blocks.BadLocationException
public int findInsideBlocks(Finder finder, int startPos, int endPos, int[] blocks) throws BadLocationException
BadLocationException
public int findOutsideBlocks(Finder finder, int startPos, int endPos, int[] blocks) throws BadLocationException
BadLocationException
public void initSyntax(Syntax syntax, int startPos, int endPos, boolean forceLastBuffer, boolean forceNotLastBuffer) throws BadLocationException
syntax
- lexical analyzer to preparestartPos
- starting position of the scanningendPos
- ending position of the scanningforceLastBuffer
- force the syntax to think that the scanned area is the last
in the document. This is useful for forcing the syntax to process all the characters
in the given area.forceNotLastBuffer
- force the syntax to think that the scanned area is NOT
the last buffer in the document. This is useful when the syntax will continue
scanning on another buffer.BadLocationException
public boolean isIdentifier(String word)
public void tokenizeText(TokenProcessor tp, int startOffset, int endOffset, boolean forceLastBuffer) throws BadLocationException
tp
- token processor that will be informed about the found tokens.startOffset
- starting position in the textendOffset
- ending position in the textforceLastBuffer
- force the syntax scanner to think that the requested
area is the last in the document.BadLocationException
public void tokenizeText(TokenProcessor tp, String text)
tp
- token processor that will be informed about the found tokens.text
- text to parsepublic TokenItem getTokenChain(int offset) throws BadLocationException
offset
- position in the document for which the chain
is being retrieved.BadLocationException
protected boolean isAbbrevDisabled(int offset)
offset
- offset at which the situation should be checked.Built on October 25 2023. | Copyright © 2017-2023 Apache Software Foundation. All Rights Reserved.