You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: string.rb
    path of file: ./repos/yard/lib/yard/core_ext
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
class String
  # Splits text into tokens the way a shell would, handling quoted
  # text as a single token. Use '\"' and "\'" to escape quotes and
  # '\\' to escape a backslash.
  #
  # @return [Array] an array representing the tokens
  def shell_split
    out = [String.new("")]
    state = :none
    escape_next = false
    quote = String.new("")
    strip.split(//).each do |char|
      case state
      whe
    
  def shell_split
    out = [String.new("")]
    state = :none
    escape_next = false
    quote = String.new("")
    strip.split(//).each do |char|
      case state
      when :none, :space
        case char
        when /\s/
          out << String.new("") unless state == :space
          state = :space
          escape_next = false
        when "\\"
          if escape_next
            out.last << char
            escape_next = false
          else
            escape_next = true
          end
        when '"', "'"
          if escape_next
            out.last << char
            escape_next = false
          else
            state = char
            quote = String.new("")
          end