Exemplo n.º 1
0
 public Statement(Parser yyp, ForLoop fl)
     : base(((LSLSyntax
         )yyp))
 {
     kids.Add(fl);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Generates the code for a ForLoop node.
        /// </summary>
        /// <param name="fl">The ForLoop node.</param>
        /// <returns>String containing C# code for ForLoop fl.</returns>
        private string GenerateForLoop(ForLoop fl)
        {
            string retstr = String.Empty;

            retstr += GenerateIndented("for (", fl);

            // for ( x = 0 ; x < 10 ; x++ )
            //       ^^^^^^^
            retstr += GenerateForLoopStatement((ForLoopStatement)fl.kids.Pop());
            retstr += Generate("; ");
            // for ( x = 0 ; x < 10 ; x++ )
            //               ^^^^^^^^
            retstr += GenerateNode((SYMBOL)fl.kids.Pop());
            retstr += Generate("; ");
            // for ( x = 0 ; x < 10 ; x++ )
            //                        ^^^^^
            retstr += GenerateForLoopStatement((ForLoopStatement)fl.kids.Pop());
            retstr += GenerateLine(")");

            // CompoundStatement handles indentation itself but we need to do it
            // otherwise.
            bool indentHere = fl.kids.Top is Statement;
            if (indentHere) m_braceCount++;
            retstr += GenerateNode((SYMBOL)fl.kids.Pop());
            if (indentHere) m_braceCount--;

            return retstr;
        }