Smart parentheses adaptation.