class Rufo::Formatter
def visit_string_literal(node)
def visit_string_literal(node) # [:string_literal, [:string_content, exps]] heredoc = current_token_kind == :on_heredoc_beg tilde = current_token_value.include?("~") if heredoc write current_token_value.rstrip next_token skip_space # A comma after a heredoc means the heredoc contents # come after an argument list, so put it in a list # for later. # The same happens if we already have a heredoc in # the list, which means this will come after other # heredocs. if comma? || (current_token_kind == :on_period) || !@heredocs.empty? @heredocs << [@current_node, node, tilde] return end elsif current_token_kind == :on_backtick consume_token :on_backtick else consume_token :on_tstring_beg end if heredoc @current_heredoc = [node, tilde] end visit_string_literal_end(node) @current_heredoc = nil if heredoc end