Example #1
0
        protected override void AddParsedOp(TOperator op)
        {
            TBaseParsedToken OpToken = TParsedTokenListBuilder.GetParsedOp(op);

            if (OpToken is TUnsupportedToken)
            {
                DoError(FlxErr.ErrFormulaInvalid, 2);
            }
            else
            {
                Push(OpToken);
            }
        }
Example #2
0
        public new static TLeftExpression LeftClaim(StringClaimer claimer, TExpression left)
        {
            Claim     failTo  = claimer.FailPoint();
            TOperator operand = TOperator.Claim(claimer);

            if (operand == null)
            {
                failTo.Fail();
                return(null);
            }
            TExpression right = TExpression.Claim(claimer);

            if (right == null)
            {
                failTo.Fail();
                return(null);
            }

            TArithmetic newArith = new TArithmetic
            {
                _leftArg  = left,
                _rightArg = right,
                _op       = operand
            };

            if (!(right is TLeftExpression t) || t.GetAssociativity() == Associativity.Na)
            {
                return(newArith);
            }
            int prec  = operand.GetPrecedence();
            int rPrec = t.GetPrecedence();

            if (prec >= rPrec && (prec != rPrec || operand.GetAssociativity() != Associativity.LeftToRight))
            {
                return(newArith);
            }
            newArith._rightArg = t.GetLeft();
            t.SetLeft(newArith);
            return(t);
        }
Example #3
0
 /// <summary>
 /// Creates a new operator token.
 /// </summary>
 /// <param name="aOperator">Type of operator.</param>
 public TTokenOperator(TOperator aOperator) : base(TTokenType.Operator)
 {
     Operator = aOperator;
 }
Example #4
0
 protected static void AddParsedOp(TParsedTokenListBuilder TokenBuilder, TOperator op)
 {
     Push(TokenBuilder, TParsedTokenListBuilder.GetParsedOp(op));
 }