Exemple #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 void GenerateTypecastExpression(TypecastExpression te, StringBuilder sb)
 {
     // we wrap all typecasted statements in parentheses
     Generate(String.Format("({0}) (", te.TypecastType), te, sb);
     GenerateNodeToSB(te, (SYMBOL)te.kids.Pop(), sb);
     Generate(")", sb);
 }
Exemple #2
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 = String.Empty;

            // 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);
        }
Exemple #3
0
        void TypecastExpression(out Expression exp)
        {
            TypecastExpression te = new TypecastExpression(GetPragma(la)); exp = te;

            Expect(49);
            Expression(out te.exp);
            if (la.kind == 20)
            {
                Get();
            }
            Typename(out te.destType);
            SetEndPragma(te);
        }
 /// <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 retVal = new StringBuilder();
     // we wrap all typecasted statements in parentheses
     retVal.Append(Generate(String.Format("({0}) (", te.TypecastType), te));
     retVal.Append(GenerateNode((SYMBOL) te.kids.Pop()));
     retVal.Append(Generate(")"));
     return retVal.ToString();
 }
Exemple #5
0
 void TypecastExpression(out Expression exp)
 {
     TypecastExpression te = new TypecastExpression(GetPragma(la)); exp = te;
     Expect(49);
     Expression(out te.exp);
     if (la.kind == 20) {
     Get();
     }
     Typename(out te.destType);
     SetEndPragma(te);
 }
        /// <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;
        }