412 err.println();
413 }
414 }
415 }
416
417 /**
418 * Processes the arguments and stores their information. Throws
419 * IllegalArgumentException on error. The message can be analyzed by the
420 * displayHelp function to become more context sensitive
421 *
422 * @param args arguments from command line
423 */
424 public void process(final String[] args) {
425 final LinkedList<String> argList = new LinkedList<>();
426 addSystemProperties(NASHORN_ARGS_PREPEND_PROPERTY, argList);
427 Collections.addAll(argList, args);
428 addSystemProperties(NASHORN_ARGS_PROPERTY, argList);
429
430 while (!argList.isEmpty()) {
431 final String arg = argList.remove(0);
432
433 // skip empty args
434 if (arg.isEmpty()) {
435 continue;
436 }
437
438 // user arguments to the script
439 if ("--".equals(arg)) {
440 arguments.addAll(argList);
441 argList.clear();
442 continue;
443 }
444
445 // If it doesn't start with -, it's a file. But, if it is just "-",
446 // then it is a file representing standard input.
447 if (!arg.startsWith("-") || arg.length() == 1) {
448 files.add(arg);
449 continue;
450 }
451
|
412 err.println();
413 }
414 }
415 }
416
417 /**
418 * Processes the arguments and stores their information. Throws
419 * IllegalArgumentException on error. The message can be analyzed by the
420 * displayHelp function to become more context sensitive
421 *
422 * @param args arguments from command line
423 */
424 public void process(final String[] args) {
425 final LinkedList<String> argList = new LinkedList<>();
426 addSystemProperties(NASHORN_ARGS_PREPEND_PROPERTY, argList);
427 Collections.addAll(argList, args);
428 addSystemProperties(NASHORN_ARGS_PROPERTY, argList);
429
430 while (!argList.isEmpty()) {
431 final String arg = argList.remove(0);
432 Objects.requireNonNull(arg);
433
434 // skip empty args
435 if (arg.isEmpty()) {
436 continue;
437 }
438
439 // user arguments to the script
440 if ("--".equals(arg)) {
441 arguments.addAll(argList);
442 argList.clear();
443 continue;
444 }
445
446 // If it doesn't start with -, it's a file. But, if it is just "-",
447 // then it is a file representing standard input.
448 if (!arg.startsWith("-") || arg.length() == 1) {
449 files.add(arg);
450 continue;
451 }
452
|