Argument arg = param.getArgument(); String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType()); if( value != null ) arg.setValue(value); } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); }
final boolean last = !cmdLine.hasNext(); Argument arg = param.getArgument(); String value = visitor.visitValue(s, last, cmdLine.getTokenType()); if (value != null) { if (visitor.isValueValid(arg, value, last)) { arg.setValue(value); } else { throw new SyntaxErrorException("Invalid value for argument"); } } } if (param.isSatisfied()) param = null; } while (cmdLine.hasNext()); }
	private synchronized void visitCommandLine(CommandLine cmdLine, CommandLineVisitor visitor) {		clearArguments();		Parameter param = null;		do {			String s = "";			if( cmdLine.hasNext() )				s = cmdLine.next();         // TODO: it didn't handle correctly the parameters starting with "-"             			/*if (s.startsWith("-") && (cmdLine.getTokenType() == CommandLine.LITERAL)) { // we got a named parameter here				if (param != null) // last param takes an argument, but it's not given					throw new SyntaxError("Unexpected Parameter " + s);				param = getParameter(s.substring(1));				if (param == null)					throw new SyntaxError("Unknown Parameter \"" + s + "\"");                                visitor.visitParameter(param);			} else { // we got an argument */				if (param == null) {// must be an argument for an anonymous parameter					param = getAnonymousParameter();					if (param == null) {// but...there are no more of them						throw new SyntaxError("Unexpected argument \"" + s + "\"");					} else {						visitor.visitParameter(param);					}				//}				// no check if there is an argument, as else we would have exited before (Parameter satisfied)				Argument arg = param.getArgument();				String value = visitor.visitValue(s, !cmdLine.hasNext(), cmdLine.getTokenType());				if( value != null )					arg.setValue(value);			}			if (param.isSatisfied())				param = null;		} while (cmdLine.hasNext());	}