class Rufo::Formatter
def visit_while_or_until(node, keyword)
def visit_while_or_until(node, keyword) _, cond, body = node consume_keyword keyword consume_space visit cond skip_space # Keep `while cond; end` as is semicolon = semicolon? is_do = keyword?("do") if (semicolon || is_do) && void_exps?(body) next_token skip_space if keyword?("end") if is_do write " do end" else write "; end" end next_token return end end if semicolon || is_do next_token skip_space skip_semicolons if newline? || comment? indent_body body write_indent else skip_space_or_newline if semicolon write "; " else write " do " end visit_exps body, with_lines: false skip_space_or_newline write_space if is_do end else indent_body body write_indent end consume_keyword "end" end