class Rufo::Formatter

def visit_exps(exps, with_indent: false, with_lines: true)

def visit_exps(exps, with_indent: false, with_lines: true)
  consume_end_of_line(at_prefix: true)
  line_before_endline = nil
  exps.each_with_index do |exp, i|
    exp_kind = exp[0]
    # Skip voids to avoid extra indentation
    if exp_kind == :void_stmt
      next
    end
    if with_indent
      # Don't indent if this exp is in the same line as the previous
      # one (this happens when there's a semicolon between the exps)
      unless line_before_endline && line_before_endline == @line
        write_indent
      end
    end
    push_node(exp) do
      visit exp
    end
    is_last = last?(i, exps)
    skip_space unless is_last
    line_before_endline = @line
    if with_lines
      exp_needs_two_lines = needs_two_lines?(exp)
      consume_end_of_line(want_semicolon: !is_last, want_multiline: !is_last, needs_two_lines_on_comment: exp_needs_two_lines)
      # Make sure to put two lines before defs, class and others
      if !is_last && (exp_needs_two_lines || needs_two_lines?(exps[i + 1])) && @line <= line_before_endline + 1
        write_line
      end
    elsif !is_last
      skip_space
      has_semicolon = semicolon?
      skip_semicolons
      if newline?
        write_line
        write_indent(next_indent)
      elsif has_semicolon
        write "; "
      end
      skip_space_or_newline
    end
  end
end