public final class BraceHelper
extends java.lang.Object
BraceHelper class is a helper class that can
be used by brace matching implementations for language definitions
based on the Language API.| Modifier and Type | Field and Description |
|---|---|
static int |
INVALID_BRACE
The index returned for an invalid brace.
|
| Constructor and Description |
|---|
BraceHelper(Language language)
Construct a new
BraceHelper instance. |
BraceHelper(java.lang.String[][] languageBraces) |
| Modifier and Type | Method and Description |
|---|---|
int |
getBraceIndex(ReadTextBuffer buffer,
int startOffset,
int endOffset)
Fetches the index of the brace at the specified location in the
buffer.
|
int |
getBraceLength(int index)
Fetches the length of the brace.
|
int |
getBracePairsCount()
Fetches the number of matching brace pairs in this language.
|
int |
getMatchingBraceIndex(int index)
Fetches the index of the matching brace for the specified index.
|
boolean |
isCloseIndex(int index)
Fetch whether the given index is a valid index for a close brace.
|
boolean |
isOpenIndex(int index)
Fetch whether the given index is a valid index for an open brace.
|
public static final int INVALID_BRACE
public BraceHelper(Language language)
BraceHelper instance.language - the language definitionpublic BraceHelper(java.lang.String[][] languageBraces)
public boolean isOpenIndex(int index)
index - the index to validatepublic boolean isCloseIndex(int index)
index - the index to validatepublic int getBraceLength(int index)
index - the brace indexpublic int getBracePairsCount()
public int getBraceIndex(ReadTextBuffer buffer, int startOffset, int endOffset)
buffer - the buffer where the brace is locatedstartOffset - the start of the brace (inclusive)endOffset - the end of the brace (exclusive)public int getMatchingBraceIndex(int index)
index - the index of the brace to get the matching brace index for