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

Method parseLongForm

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

Source from the content-addressed store, hash-verified

341 }
342
343 private static Object[] parseLongForm(String arg, Iterator<String> iter, Map<String, OptArg> opts) {
344 arg = arg.substring(2,arg.length());
345 String[] _args = arg.split("=");
346 OptArg opt = opts.get(_args[0]);
347 String param;
348 if(opt != null) {
349 // matched
350 iter.remove(); // remove option from args list
351 switch(_args.length) {
352 case 1:
353 param = null;
354 break;
355 case 2:
356 param = _args[1];
357 break;
358 default:
359 throw new IllegalArgumentException("error parsing \"" + arg + "\"");
360 }
361 } else {
362 throw new RuntimeException("unknown command-line option: -" + arg);
363 }
364 return new Object[] {opt,param};
365 }
366
367 private static Object[] parseShortForm(String arg, Iterator<String> iter, Map<String, OptArg> opts) {
368 arg = arg.substring(1,arg.length());

Callers 1

parseOptionsMethod · 0.95

Calls 3

removeMethod · 0.80
lengthMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected