예제 #1
0
        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
            });
        }
예제 #2
0
        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
            });
        }
예제 #3
0
파일: Failure.cs 프로젝트: Blecki/Ancora
        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);
        }