Exemplo n.º 1
0
        /// <summary>
        /// Generates a binary operator of the specified type with the specified nodes.
        /// </summary>
        /// <param name="opType">The type of binary operator.</param>
        /// <param name="lhs">The node to appear on the left side of the operator.</param>
        /// <param name="rhs">The node to appear on the right side of the operator.</param>
        /// <returns>The root node of this AST.</returns>
        public static Node Generate(BinaryOperatorType opType, Node lhs, Node rhs)
        {
            var binaryOp = new BinaryOperator(opType);

            binaryOp.AddChild(lhs);
            binaryOp.AddChild(rhs);
            return(binaryOp);
        }