示例#1
0
        /// <summary>
        /// Generates the code for a TypecastExpression node.
        /// </summary>
        /// <param name="te">The TypecastExpression node.</param>
        /// <returns>String containing C# code for TypecastExpression te.</returns>
        private string GenerateTypecastExpression(TypecastExpression te)
        {
            string retstr = "";

            // we wrap all typecasted statements in parentheses
            retstr += Generate(String.Format("({0}) (", te.TypecastType), te);
            retstr += GenerateNode((SYMBOL)te.kids.Pop());
            retstr += Generate(")");

            return retstr.ToString();
        }
        /// <summary>
        /// Generates the code for a TypecastExpression node.
        /// </summary>
        /// <param name="te">The TypecastExpression node.</param>
        /// <returns>String containing C# code for TypecastExpression te.</returns>
        private string GenerateTypecastExpression(TypecastExpression te)
        {
            StringBuilder retstr = new StringBuilder();

            // we wrap all typecasted statements in parentheses
            retstr.Append(Generate(String.Format("({0}) (", te.TypecastType), te));
            retstr.Append(GenerateNode((SYMBOL) te.kids.Pop()));
            retstr.Append(Generate(")"));

            return retstr.ToString();
        }