# File lib/kwalify/parser/yaml.rb, line 795
  def location(path)
    if path.empty? || path == '/'
      return @location_table[-1]    # return value is [linenum, column]
    end
    if path.is_a?(Array)
      items = path.collect { |item| to_scalar(item) }
    elsif path.is_a?(String)
      items = path.split('/').collect { |item| to_scalar(item) }
      items.shift if path[0] == ?/  # delete empty string on head
    else
      raise ArgumentError.new("path should be Array or String.")
    end
    last_item = items.pop()
    c = @doc                        # collection
    items.each do |item|
      if c.is_a?(Array)
        c = c[item.to_i]
      elsif c.is_a?(Hash)
        c = c[item]
      elsif (table = @location_table[c.__id__]) && table[:classobj]
        if c.respond_to?(item)
          c = c.__send__(item)
        elsif c.respond_to?("[]=")
          c = c[item]
        else
          assert false
        end
      else
        #assert false
        raise ArgumentError.new("#{path.inspect}: invalid path.")
      end
    end
    collection = @location_table[c.__id__]
    return nil if collection.nil?
    index = c.is_a?(Array) ? last_item.to_i : last_item
    return collection[index]  # return value is [linenum, column]
  end