com.intellij.lang
Class BracePair

java.lang.Object
  extended by com.intellij.lang.BracePair

public class BracePair
extends java.lang.Object

Defines a single pair of braces which need to be matched when editing code in a custom language.

See Also:
PairedBraceMatcher

Constructor Summary
BracePair(char leftBraceChar, IElementType leftBrace, char rightBraceChar, IElementType rightBrace, boolean structural)
          Creates a new brace pair instance.
 
Method Summary
 char getLeftBraceChar()
          Returns the character for the left brace in the pair.
 IElementType getLeftBraceType()
          Returns the lexer token type for the left brace in the pair.
 char getRightBraceChar()
          Returns the character for the right brace in the pair.
 IElementType getRightBraceType()
          Returns the lexer token type for the right brace in the pair.
 boolean isStructural()
          Returns true if the brace is structural.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BracePair

public BracePair(char leftBraceChar,
                 IElementType leftBrace,
                 char rightBraceChar,
                 IElementType rightBrace,
                 boolean structural)
Creates a new brace pair instance.

Parameters:
leftBraceChar - the character for the left brace in the pair.
leftBrace - the lexer token type for the left brace in the pair.
rightBraceChar - the character for the right brace in the pair.
rightBrace - the lexer token type for the right brace in the pair.
structural - if true, the brace is considered structural (see isStructural() for details)
Method Detail

getLeftBraceType

public IElementType getLeftBraceType()
Returns the lexer token type for the left brace in the pair.

Returns:
token type

getRightBraceType

public IElementType getRightBraceType()
Returns the lexer token type for the right brace in the pair.

Returns:
token type

isStructural

public boolean isStructural()
Returns true if the brace is structural. Structural braces have higher priority than regular braces: they are matched with each other even if there are unmatched braces of other types between them, and an opening non-structural brace is not matched with a closing one if one of them is outside a pair of matched structural braces and another is outside. In Java code, the curly braces are structural.

Returns:
true if the brace is structural, false otherwise.

getLeftBraceChar

public char getLeftBraceChar()
Returns the character for the left brace in the pair.

Returns:
brace character

getRightBraceChar

public char getRightBraceChar()
Returns the character for the right brace in the pair.

Returns:
brace character