public ParserResult(
     ArgumentValuesMap parsed,
     IEnumerable <ParserError> errors       = null,
     IEnumerable <ICommandArgument> missing = null,
     IEnumerable <ICommandArgument> omitted = null
     ) : this(default(TCommand), parsed, errors, missing, omitted)
 {
 }
 public ParserResult(
     TCommand command,
     ArgumentValuesMap parsed,
     IEnumerable <ParserError> errors       = null,
     IEnumerable <ICommandArgument> missing = null,
     IEnumerable <ICommandArgument> omitted = null
     )
 {
     Command   = command;
     Parsed    = parsed;
     Errors    = (errors ?? Array.Empty <ParserError>()).ToImmutableList() ?? throw new InvalidOperationException();
     Missing   = (missing ?? Array.Empty <ICommandArgument>()).ToImmutableList() ?? throw new InvalidOperationException();
     Omitted   = (omitted ?? Array.Empty <ICommandArgument>()).ToImmutableList() ?? throw new InvalidOperationException();
     Unhandled = Errors.Where(error => error is UnhandledArgumentError)
                 .Cast <UnhandledArgumentError>()
                 .ToImmutableList() ??
                 throw new InvalidOperationException();
 }
Exemple #3
0
 public ParserResult(
     [CanBeNull] TCommand command,
     [NotNull] ArgumentValuesMap parsed,
     [CanBeNull] IEnumerable <ParserError> errors       = null,
     [CanBeNull] IEnumerable <ICommandArgument> missing = null,
     [CanBeNull] IEnumerable <ICommandArgument> omitted = null
     )
 {
     Command   = command;
     Parsed    = parsed;
     Errors    = (errors ?? new ParserError[0]).ToImmutableList() ?? throw new InvalidOperationException();
     Missing   = (missing ?? new ICommandArgument[0]).ToImmutableList() ?? throw new InvalidOperationException();
     Omitted   = (omitted ?? new ICommandArgument[0]).ToImmutableList() ?? throw new InvalidOperationException();
     Unhandled = Errors.Where(error => error is UnhandledArgumentError)
                 .Cast <UnhandledArgumentError>()
                 .ToImmutableList() ??
                 throw new InvalidOperationException();
 }