Esempio n. 1
0
		public  Statement (Parser yyp, WhileStatement  ifs ):base(((LSLSyntax
		                                                           )yyp)){ kids . Add ( ifs );
		}
Esempio n. 2
0
        /// <summary>
        /// Generates the code for a WhileStatement node.
        /// </summary>
        /// <param name="ws">The WhileStatement node.</param>
        /// <returns>String containing C# code for WhileStatement ws.</returns>
        private string GenerateWhileStatement(WhileStatement ws)
        {
            string retstr = "";
            string tmpstr = "";

            bool marc = FuncCallsMarc();

            tmpstr += GenerateIndented("while (", ws);
            tmpstr += GenerateNode((SYMBOL)ws.kids.Pop());
            tmpstr += GenerateLine(")");

            retstr += DumpFunc(marc) + tmpstr.ToString();

            if (IsParentEnumerable)
            {
                retstr += GenerateLine("{"); // SLAM! No 'while(true) doThis(); ' statements for you!
                retstr += GenerateLine("if (CheckSlice()) yield return null;");
            }

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

            if (IsParentEnumerable)
                retstr += GenerateLine("}");

            return retstr.ToString();
        }
Esempio n. 3
0
        /// <summary>
        /// Generates the code for a WhileStatement node.
        /// </summary>
        /// <param name="ws">The WhileStatement node.</param>
        /// <returns>String containing C# code for WhileStatement ws.</returns>
        private string GenerateWhileStatement(WhileStatement ws)
        {
            string retstr = "";

            retstr += GenerateIndented("while (", ws);
            retstr += GenerateNode((SYMBOL)ws.kids.Pop());
            retstr += GenerateLine(")");

            retstr += GenerateLine("{");
            retstr += GenerateLine("CheckSleep();");

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

            retstr += GenerateLine("}");

            return retstr.ToString();
        }
Esempio n. 4
0
        /// <summary>
        /// Generates the code for a WhileStatement node.
        /// </summary>
        /// <param name="ws">The WhileStatement node.</param>
        /// <returns>String containing C# code for WhileStatement ws.</returns>
        private string GenerateWhileStatement(WhileStatement ws)
        {
            string retstr = "";
            string tmpstr = "";

            bool marc = FuncCallsMarc();

            tmpstr += GenerateIndented("while (", ws);
            tmpstr += GenerateNode((SYMBOL)ws.kids.Pop());
            tmpstr += GenerateLine(")");

            //Forces all functions to use MoveNext() instead of .Current, as it never changes otherwise, and the loop runs infinitely
            m_isInEnumeratedDeclaration = true;
            retstr += DumpFunc(marc) + tmpstr.ToString();
            m_isInEnumeratedDeclaration  = false; //End above

            if (IsParentEnumerable)
            {
                retstr += GenerateLine("{"); // SLAM! No 'while(true) doThis(); ' statements for you!
                retstr += GenerateLine("if (CheckSlice()) yield return null;");
            }

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

            if (IsParentEnumerable)
                retstr += GenerateLine("}");

            return retstr.ToString();
        }
Esempio n. 5
0
        /// <summary>
        /// Generates the code for a WhileStatement node.
        /// </summary>
        /// <param name="ws">The WhileStatement node.</param>
        /// <returns>String containing C# code for WhileStatement ws.</returns>
        private string GenerateWhileStatement(WhileStatement ws)
        {
            StringBuilder retstr = new StringBuilder();

            if (IsParentEnumerable)
            {
                retstr.Append(GenerateLine("yield return null;"));
            }

            retstr.Append(GenerateIndented("while (", ws));
            retstr.Append(GenerateNode((SYMBOL)ws.kids.Pop()));
            retstr.Append(GenerateLine(")"));
            if (IsParentEnumerable)
            {
                retstr.Append(GenerateLine("{")); // SLAM! No 'while(true) doThis(); ' statements for you!
                retstr.Append(GenerateLine("yield return null;"));
            }
            
            // CompoundStatement handles indentation itself but we need to do it
            // otherwise.
            bool indentHere = ws.kids.Top is Statement;
            if (indentHere) m_braceCount++;
            retstr.Append(GenerateNode((SYMBOL) ws.kids.Pop()));
            if (indentHere) m_braceCount--;

            if (IsParentEnumerable)
                retstr.Append(GenerateLine("}"));

            return retstr.ToString();
        }