Exemple #1
0
 public void Reduce(Type expression)
 {
     if (OperatorPrecedence.Applicable(expression))
     {
         Reduce(OperatorPrecedence.Of(expression));
     }
 }
        public bool Reduce(ExpressionParserHelper parseHelper, Expression you, int priority)
        {
            bool reduced = OperatorPrecedence.IsHigherThan(you.GetType(), priority);

            if (reduced)
            {
                ((T)you).FillInRhs(parseHelper.Pop());
            }
            return(reduced);
        }
Exemple #3
0
        private bool ShouldReduce(ExpressionParserHelper parseHelper)
        {
            if (parseHelper.PeekOnStack == null)
            {
                return(true);
            }
            var myPriority    = OperatorPrecedence.Of(typeof(T));
            var stackPriority = OperatorPrecedence.Of(parseHelper.PeekOnStack.GetType());

            if (myPriority != stackPriority)
            {
                return(true);
            }
            return(false);
        }
Exemple #4
0
        public bool Reduce(ExpressionParserHelper parseHelper, Expression you, int priority)
        {
            bool reduced = OperatorPrecedence.IsHigherThan(you.GetType(), priority);

            if (reduced)
            {
                var subResult = ((T)you);
                if (subResult.Second == null)
                {
                    subResult.FillInSecond(parseHelper.Pop());
                }
                else
                {
                    subResult.FillInThird(parseHelper.Pop());
                }
            }
            return(reduced);
        }