def initialize(spec, desc, dittoflag)
first = 1
@@nextid += 1
@flag = ''
@foundid = nil
@args = []
@actions = []
@ditto = dittoflag
@required = false
@requires = nil
@id = @@nextid
@desc = spec.dup
@items = 0
@nocase = false
@desc.sub!(/\A\s*(.*?)\s*\Z/,'\1')
while spec && spec != ''
begin
if spec.sub!( /\A(\s*)\[/, '\1' )
@args.push( StartOpt.new )
next
elsif spec.sub!(/\A\s*\]/,"")
@args.push( EndOpt.new )
next
end
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>0) ]
if spec && spec.sub!( /\A\.\.\./, "")
@args.push( ArrayArg.new(*details) )
else
@args.push( ScalarArg.new(*details) )
end
@items += 1
next
elsif spec.sub!( /\A(\s*)((\\.|[^\] \t\n\[<])+)/, '' )
ows, punct = $1, $2
punct.gsub!( /\\(?!\\)(.)/, '\1' )
if first
spec =~ /\A(\S+)/
@foundid = "#{punct}#{$1}"
@flag = punct
@@flags.push( punct )
else
@args.push( Punctuator.new(punct, !(ows.size > 0)) )
@items += 1
end
else
break
end
ensure
first = nil
end
end
@@helpcmdH.delete(@flag) if @@helpcmdH.key?(@flag)
@@versioncmdH.delete(@flag) if @@versioncmdH.key?(@flag)
end