public void Evaluate(FormattedSentence.Context context, Stack <FormattedSentence.IEvaluationStackMember> evaluationStack) { FormattedSentence.IEvaluationStackMember evaluationStackMember = evaluationStack.Pop(); FormattedSentence.IEvaluationStackMember evaluationStackMember2 = evaluationStack.Pop(); FormattedSentence.IEvaluationStackMember evaluationStackMember3 = evaluationStack.Pop(); bool flag = (!evaluationStackMember3.IsEmpty && !evaluationStackMember.IsEmpty) || (!evaluationStackMember3.IsEmpty && evaluationStackMember == FormattedSentence.StringConstant.Null) || (!evaluationStackMember.IsEmpty && evaluationStackMember3 == FormattedSentence.StringConstant.Null); evaluationStack.Push(FormattedSentence.CompositeString.Create(new FormattedSentence.IEvaluationStackMember[] { evaluationStackMember3, flag ? evaluationStackMember2 : FormattedSentence.StringConstant.Null, evaluationStackMember })); }
public string Evaluate(FormattedSentence.Context context) { if (context == null) { throw new ArgumentNullException("context"); } Stack <FormattedSentence.IEvaluationStackMember> stack = new Stack <FormattedSentence.IEvaluationStackMember>(); foreach (FormattedSentence.IInstructionQueueMember instructionQueueMember in this.instructionQueue) { instructionQueueMember.Evaluate(context, stack); } FormattedSentence.IEvaluationStackMember evaluationStackMember = stack.Pop(); if (stack.Count > 0) { throw new InvalidOperationException("FormattedSentence execution produced unexpected results: more than 1 result element"); } StringBuilder stringBuilder = new StringBuilder(); evaluationStackMember.WriteTo(stringBuilder); return(stringBuilder.ToString()); }
public void Evaluate(FormattedSentence.Context context, Stack <FormattedSentence.IEvaluationStackMember> evaluationStack) { evaluationStack.Push(new FormattedSentence.StringConstant(context.ResolvePlaceholder(this.code))); }
public void Evaluate(FormattedSentence.Context context, Stack <FormattedSentence.IEvaluationStackMember> evaluationStack) { evaluationStack.Push(this); }