Class BracePair

java.lang.Object
com.intellij.lang.BracePair

public class BracePair extends Object
Defines a single pair of braces which need to be matched when editing code in a custom language.
See Also:
  • Constructor Details

    • BracePair

      public BracePair(@NotNull @NotNull IElementType leftBrace, @NotNull @NotNull IElementType rightBrace, boolean structural)
      Creates a new brace pair instance.
      Parameters:
      leftBrace - the lexer token type for the left 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 Details

    • getLeftBraceType

      @NotNull public @NotNull IElementType getLeftBraceType()
      Returns the lexer token type for the left brace in the pair.
      Returns:
      token type
    • getRightBraceType

      @NotNull public @NotNull 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.
    • toString

      @NonNls public @NonNls String toString()
      Overrides:
      toString in class Object