       forcesBreakBeforeRightDelimiter: breakBeforeRightBracket)
 
     return .visitChildren
+  }
+
+  override func visitPost(_ node: SubscriptExprSyntax) {
+    clearContextualBreakState(node)
   }
 
   override func visit(_ node: ExpressionSegmentSyntax) -> SyntaxVisitorContinueKind {

          expr.parent?.isProtocol(CallingExprSyntaxProtocol.self) != true {
        before(memberAccessExpr.dot, tokens: .break(.contextual, size: 0))
      }
      let children: [ExprSyntax]
      var hasCompoundExpression = false
      if let base = memberAccessExpr.base {
        (children, hasCompoundExpression, _) = insertContextualBreaks(base, isTopLevel: false)
      } else {
        children = []
      }
      if isTopLevel {
        before(expr.firstToken, tokens: .contextualBreakingStart)
        after(expr.lastToken, tokens: .contextualBreakingEnd)
      }
      return ([expr] + children, hasCompoundExpression, true)
    } else if let callingExpr = expr.asProtocol(CallingExprSyntaxProtocol.self) {
      let calledExpression = callingExpr.calledExpression
      let (children, hasCompoundExpression, hasMemberAccess) =
        insertContextualBreaks(calledExpression, isTopLevel: false)

      let shouldGroup =


  /// Lists the expressions that have been visited, from the outermost expression, where contextual
  /// breaks and start/end contextual breaking tokens have been inserted.
  private var preVisitedExprs = Set<SyntaxIdentifier>()

  /// Tracks the "root" exprs where previsiting for contextual breaks started so that
  /// `preVisitedExprs` can be emptied after exiting an expr tree.
  private var rootExprs = Set<SyntaxIdentifier>()

  /// Lists the tokens that are the closing or final delimiter of a node that shouldn't be split
  /// from the preceding token. When breaks are inserted around compound expressions, the breaks are
