コード例 #1
0
        private void ProcessWhileStatement(NodeBase statement)
        {
            Queue <NodeBase> children = GetChildren(statement);

            Expect(children.Dequeue(), NodeType.Keyword, "while");
            Expect(children.Dequeue(), NodeType.Symbol, "(");

            int whileStatementNumber = vmWriter.GetWhileStatementNumber();

            vmWriter.WhileStart(whileStatementNumber);
            ProcessExpression(children.Dequeue());
            vmWriter.WhileBreak(whileStatementNumber);

            Expect(children.Dequeue(), NodeType.Symbol, ")");
            Expect(children.Dequeue(), NodeType.Symbol, "{");

            ProcessStatements(children.Dequeue());

            Expect(children.Dequeue(), NodeType.Symbol, "}");
            vmWriter.WhileEnd(whileStatementNumber);
        }