|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The BraceProvider
interface provides the necessary
routines to support matching-brace highlighting support in a
language independent mechanism. The term brace is loosely
defined as a character or set of characters which delimits the
start or end of a language block.
Consider Java as an example, a language block may consist of an expression delimited by '(' and ')', or a block of statements delimited by '{' and '}', or the index operator of an array delimited by '[' and ']'. This interface allows languages to support braces which may consist of multiple characters.
Note that it is possible to find a matching brace, yet still have unbalanced braces between. For example, the following sequence is matched and balanced, "( [ ] )" for all braces. The following sequence is matched for the outer braces, but contains imbalanced braces inside, "( [ )". The last sequence is completely mismatched, "( ]".
LanguageModule
,
LanguageSupport
Field Summary | |
static int |
BALANCED_MATCH
Constant indicating that the findMatchingBrace() operation found a matching brace, and that all braces contained within are balanced. |
static int |
MISMATCH
Constant indicating that the findMatchingBrace() operation could not find a matching brace. |
static int |
UNBALANCED_MATCH
Constant indicating that the findMatchingBrace() operation found a matching brace, but that at least one of the braces contained within is unbalanced. |
Method Summary | |
int |
findMatchingBrace(int braceType,
NumberRange braceLocation,
NumberRange matchingLocation)
Finds the brace matching the given brace identified by isPartOfBrace(). |
int |
isPartOfBrace(int offset,
NumberRange braceLocation)
Determines whether the character at the given offset is considered a brace (such as '(', '[', or '{' in Java) or part of a brace in this language. |
Field Detail |
public static final int BALANCED_MATCH
public static final int UNBALANCED_MATCH
public static final int MISMATCH
Method Detail |
public int isPartOfBrace(int offset, NumberRange braceLocation)
NumberRange
object passed in by the caller is
filled in by this routine to indicate the start and end of the
brace at the given offset provided. This routine returns a
language-specific token type corresponding to the given brace
at the offset, or -1 (Lexer.NOT_FOUND) if the offset is not
part of a brace.
offset
- the offset in the document associated with the
specific LanguageSupport to check if it is a bracebraceLocation
- an out parameter to pass start and end
offset information to the caller if the provided
brace offset is indeed part of a brace
public int findMatchingBrace(int braceType, NumberRange braceLocation, NumberRange matchingLocation)
braceType
- the language-specific token type returned by
isPartOfBrace().braceLocation
- the brace location filled in by isPartOfBrace()matchingLocation
- an out parameter to pass start and end
offset information to the caller if a matching brace was found
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.