Esempio n. 1
0
        private void MatchExprUnary(out IExpr result)
        {
            TokenTypes t;                               // remember the type

            t = curToken.Type;
            if (t == TokenTypes.PLUS || t == TokenTypes.MINUS)
            {
                curToken = tokens.Extract();
            }
            MatchExprParen(out result);
            if (t == TokenTypes.MINUS)
            {
                if (result.GetTypeCode() == TypeCode.Decimal)
                {
                    result = new FunctionUnaryMinusDecimal(result);
                }
                else if (result.GetTypeCode() == TypeCode.Int32)
                {
                    result = new FunctionUnaryMinusInteger(result);
                }
                else
                {
                    result = new FunctionUnaryMinus(result);
                }
            }
        }
Esempio n. 2
0
		private void MatchExprUnary(out IExpr result)
		{
			TokenTypes t;			// remember the type
			t = curToken.Type;
			if (t == TokenTypes.PLUS || t == TokenTypes.MINUS)
			{
				curToken = tokens.Extract();
			}
			MatchExprParen(out result);
			if (t == TokenTypes.MINUS)
			{
				if (result.GetTypeCode() == TypeCode.Decimal)
					result = new FunctionUnaryMinusDecimal(result);
				else if (result.GetTypeCode() == TypeCode.Int32)
					result = new FunctionUnaryMinusInteger(result);
				else
					result = new FunctionUnaryMinus(result);
			}
		}