# File lib/mspec/utils/options.rb, line 124
124:   def parse(argv=ARGV)
125:     argv = Array(argv).dup
126: 
127:     while entry = argv.shift
128:       # collect everything that is not an option
129:       if entry[0] != ?- or entry.size < 2
130:         @on_extra[entry]
131:         next
132:       end
133: 
134:       # this is a long option
135:       if entry[1] == ?-
136:         opt, arg = entry.split "="
137:         process argv, entry, opt, arg
138:         next
139:       end
140: 
141:       # disambiguate short option group from short option with argument
142:       opt, arg, rest = split entry, 2
143: 
144:       # process first option
145:       option = process argv, entry, opt, arg
146:       next unless option and not option.arg?
147: 
148:       # process the rest of the options
149:       while rest.size > 0
150:         opt, arg, rest = split rest, 1
151:         opt = "-" + opt
152:         option = process argv, opt, opt, arg
153:         break if option.arg?
154:       end
155:     end
156: 
157:     @extra
158:   rescue ParseError => e
159:     puts self
160:     puts e
161:     exit 1
162:   end