MCPcopy Create free account
hub / github.com/Whiley/WhileyCompiler / parseShortForm

Method parseShortForm

src/main/java/wycc/util/OptArg.java:367–385  ·  view source on GitHub ↗
(String arg, Iterator<String> iter, Map<String, OptArg> opts)

Source from the content-addressed store, hash-verified

365 }
366
367 private static Object[] parseShortForm(String arg, Iterator<String> iter, Map<String, OptArg> opts) {
368 arg = arg.substring(1,arg.length());
369 OptArg opt = opts.get(arg);
370 String param;
371 if(opt != null) {
372 // matched
373 iter.remove(); // remove option from args list
374 //
375 if(opt.argument != null) {
376 param = iter.next();
377 iter.remove(); // remove option from args list
378 } else {
379 param = null;
380 }
381 } else {
382 throw new RuntimeException("unknown command-line option: -" + arg);
383 }
384 return new Object[] {opt,param};
385 }
386
387 public static void usage(PrintStream output, OptArg...options) {
388 // first, work out gap information

Callers 1

parseOptionsMethod · 0.95

Calls 4

removeMethod · 0.80
lengthMethod · 0.65
getMethod · 0.65
nextMethod · 0.45

Tested by

no test coverage detected