def count_expected
      count = @expected.inject(0) do |n, exp|
        case exp.first
        when :list
          # if the list is greedy, all arguments have to be absorbed
          return [n, true] unless exp[3]

          n + exp[3]
        else
          n + 1
        end
      end

      [count, false]
    end
def count_expected
      count = @expected.inject(0) do |n, exp|
        case exp.first
        when :list
          # if the list is greedy, all arguments have to be absorbed
          return [n, true] unless exp[3]

          n + exp[3]
        else
          n + 1
        end
      end

      [count, false]
    end
Count the number of arguments expected to be supplied.
 @raise [Integer, nil] the number of expected arguments, or nil if a list
  of indeterminate size is specified
 @api private