Ejemplo n.º 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
            });
        }
Ejemplo n.º 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
            });
        }
Ejemplo n.º 3
0
        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);
        }