# File lib/Getopt/Declare.rb, line 1198
  def parse(*opts)
    source = opts[0]
    _args = nil
    _get_nextline = proc { nil }

    if source
      case source
      when Method
        _get_nextline = source
        _args = _get_nextline.call(self)
        source = '[METHOD]'
      when Proc
        _get_nextline = source
        _args = _get_nextline.call(self)
        source = '[PROC]'
      when IO
        if source.fileno > 0 && source.tty?
          _get_nextline = method(:_get_nextline)
          _args = $stdin.readline
          source = '<STDIN>'
        else
          _args = source.readlines.join(' ')
          _args.tr!('\t\n',' ')
        end
      when :build, :skip
        return 0
      when Array
        if source.length() == 1 && !source[0] ||
            source[0] == "-BUILD" ||
            source[0] == "-SKIP"
          return 0
        elsif source.length() == 2 && source[0] == "-ARGV"
          if !source[1] or !source[1] === Array
            raise 'Error: parse(["-ARGV"]) not passed an array as second parameter.'
          end
          _args  = source[1].map { |i| i.tr( " \t\n", "\0\0\0" ) }.join(' ')
          source = '<ARRAY>'
        elsif source.length() == 1 && source[0] == "-STDIN"
          _get_nextline = method(:_get_nextline)
          _args = $stdin.readline
          source = '<STDIN>'
        elsif source.length() == 1 && source[0] == '-CONFIG'
          progname = "#{$0}rc"
          progname.sub!(%r#.*/#,'')
          home = ENV['HOME'] || ''
          _args, source = _load_sources( _get_nextline,
                                        [ home+"/.#{progname}",
                                          ".#{progname}" ] )
        else
          # Bunch of files to load passed to parse()

          _args, source = _load_sources( _get_nextline, source )
        end
      when String  # else/case LITERAL STRING TO PARSE

        _args = source.dup
        source = source[0,7] + '...' if source && source.length() > 7
        source = "\"#{source[0..9]}\""
      else
        raise "Unknown source type for Getopt::Declare::parse"
      end  # case

      return 0 unless _args
      source = " (in #{source})"
    else
      _args  = ARGV.map { |i| i.tr( " \t\n", "\0\0\0" ) }.join(' ')
      source = ''
    end

    @source = source
    begin
      err = eval( code(@caller) )
      if $@
        # oops, something wrong... exit

        puts "#{$!}: #{$@.inspect}"
        exit(1)
      end
      if !err
        exit(1)
      end
    rescue
      raise
    end


    true
  end