class Crass::Tokenizer

def consume_string(ending = nil)

4.3.5. http://dev.w3.org/csswg/css-syntax/#consume-a-string-token

token.
Consumes a string token that ends at the given character, and returns the
def consume_string(ending = nil)
  ending = @s.current if ending.nil?
  value  = String.new
  until @s.eos?
    case char = @s.consume
    when ending
      break
    when "\n"
      # Parse error.
      @s.reconsume
      return create_token(:bad_string,
        :error => true,
        :value => value)
    when '\\'
      case @s.peek
      when ''
        # End of the input, so do nothing.
        next
      when "\n"
        @s.consume
      else
        value << consume_escaped
      end
    else
      value << char
    end
  end
  create_token(:string, :value => value)
end