Exemplo n.º 1
0
		private String PartToString(ExpressionTreeNode node, Int32 currentPrecedence)
		{
			Debug.Assert(node != null, "node != null");
			String part = node.ToString();

			if (node.Token.IsOperator)
			{
				switch (node.Token.OperatorDescriptor.PrimitiveOperator)
				{
					case PrimitiveOperator.Add:
					case PrimitiveOperator.Sub:
					case PrimitiveOperator.Mul:
					case PrimitiveOperator.Div:
					{
						if (currentPrecedence > LeftNode.Token.OperatorPrecedence)
						{
							part = String.Format(CultureInfo.CurrentCulture, "({0})", part);
						}

						break;
					}
				}
			}

			return part;
		}
Exemplo n.º 2
0
        private String PartToString(ExpressionTreeNode node, Int32 currentPrecedence)
        {
            Debug.Assert(node != null, "node != null");
            String part = node.ToString();

            if (node.Token.IsOperator)
            {
                switch (node.Token.OperatorDescriptor.PrimitiveOperator)
                {
                case PrimitiveOperator.Add:
                case PrimitiveOperator.Sub:
                case PrimitiveOperator.Mul:
                case PrimitiveOperator.Div:
                {
                    if (currentPrecedence > LeftNode.Token.OperatorPrecedence)
                    {
                        part = String.Format(CultureInfo.CurrentCulture, "({0})", part);
                    }

                    break;
                }
                }
            }

            return(part);
        }