private ParseResult Fail(String Message, ResultType ResultType, Failure SubFailure) { var failReason = new CompoundFailure(); failReason.FailedAt = this; failReason.Message = Message; failReason.AddFailure(SubFailure); return(new ParseResult { ResultType = ResultType, FailReason = failReason }); }
internal ParseResult Fail(String Message, CompoundFailure SubFailures = null) { Failure failReason = SubFailures; if (failReason == null) { failReason = new Failure(this, Message); } else { failReason.FailedAt = this; failReason.Message = Message; } return(new ParseResult { ResultType = ResultType.Failure, FailReason = failReason }); }
public static CompoundFailure Compound(Failure A, Failure B) { var r = new CompoundFailure(); if (A is CompoundFailure) { r.CompoundedFailures.AddRange((A as CompoundFailure).CompoundedFailures); } else { r.CompoundedFailures.Add(A); } if (B is CompoundFailure) { r.CompoundedFailures.AddRange((B as CompoundFailure).CompoundedFailures); } else { r.CompoundedFailures.Add(B); } return(r); }