class Rufo::Formatter

def find_closing_brace_token

def find_closing_brace_token
  count = 0
  i     = @tokens.size - 1
  while i >= 0
    token                = @tokens[i]
    (line, column), kind = token
    case kind
    when :on_lbrace, :on_tlambeg
      count += 1
    when :on_rbrace
      count -= 1
      return [token, i] if count == 0
    end
    i -= 1
  end
  nil
end