# File lib/Getopt/Declare.rb, line 518
    def initialize(spec, desc, dittoflag)
      first = 1


      @@nextid += 1
      @flag     = ''
      @args     = []
      @actions  = []
      @ditto    = dittoflag
      @required = 0
      @requires = nil
      @id       = @@nextid
      @desc     = spec.dup
      @items    = 0

      @desc.sub!(/\A\s*(.*?)\s*\Z/,'\1')

      while spec && spec != ''
        begin

          # OPTIONAL

          if spec.sub!( /\A(\s*)\[/, '\1' )
            @args.push( StartOpt.new )
            next
          elsif spec.sub!(/\A\s*\]/,"")
            @args.push( EndOpt.new )
            next
          end

          # ARG


          se  = DelimScanner::new( spec )
          tmp = se.scanBracketed('<>')

          arg = nows = nil
          arg, spec, nows = tmp[:match], tmp[:suffix], tmp[:prefix] if tmp


          if arg
            arg =~ /\A(\s*)(<)([a-zA-Z]\w*)(:[^>]+|)>/ or
              raise "Error: bad Getopt::Declare parameter variable specification near '#{arg}'\n"

            details = [ "#$3", "#$4", !first && !nows.length ]  # NAME,TYPE,NOW


            if spec && spec.sub!( /\A\.\.\./, "")      # ARRAY ARG

              @args.push( ArrayArg.new(*details) )
            else  # SCALAR ARG

              @args.push( ScalarArg.new(*details) )
            end
            @items += 1
            next

            # PUNCTUATION

          elsif spec.sub!( /\A(\s*)((\\.|[^\] \t\n\[<])+)/, "" )
            ows, punct = [ "#$1", "#$2" ]
            punct.gsub!( /\\(?!\\)(.)/, '\1' )

            if first == 1
              @flag = punct
              @@flags.push( punct )
            else
              @args.push( Punctuator.new(punct,!ows.length()) )
              @items += 1
            end

          else 
            break
          end # if arg/spec.sub

        ensure
          first = 0
        end

      end # while



      @@helpcmdH.delete(@flag)    if @@helpcmdH.key?(@flag)
      @@versioncmdH.delete(@flag) if @@versioncmdH.key?(@flag)
    end