Esempio n. 1
0
        public override void CaseAForStm(AForStm node)
        {
            //Replace with while
            node.GetBody().Apply(new ReworkForContinues());

            AABlock innerBlock = new AABlock();
            innerBlock.SetToken(new TRBrace("{", node.GetToken().Line, node.GetToken().Pos));
            innerBlock.GetStatements().Add(node.GetBody());
            innerBlock.GetStatements().Add(node.GetUpdate());
            ABlockStm innerBlockStm = new ABlockStm(new TLBrace(";"), innerBlock);
            AWhileStm whileStm = new AWhileStm(node.GetToken(), node.GetCond(), innerBlockStm);
            AABlock block = new AABlock();
            block.SetToken(new TRBrace("{", whileStm.GetToken().Line, whileStm.GetToken().Pos));
            block.GetStatements().Add(node.GetInit());
            block.GetStatements().Add(whileStm);
            ABlockStm blockStm = new ABlockStm(null, block);
            node.ReplaceBy(blockStm);
            blockStm.Apply(this);
        }
 public virtual void OutAForStm(AForStm node)
 {
     DefaultOut(node);
 }
 public virtual void CaseAForStm(AForStm node)
 {
     DefaultCase(node);
 }
 public virtual void InAForStm(AForStm node)
 {
     DefaultIn(node);
 }
 public override void CaseAForStm(AForStm node)
 {
     InAForStm(node);
     if (node.GetBody() != null)
     {
         node.GetBody().Apply(this);
     }
     if (node.GetUpdate() != null)
     {
         node.GetUpdate().Apply(this);
     }
     if (node.GetCond() != null)
     {
         node.GetCond().Apply(this);
     }
     if (node.GetInit() != null)
     {
         node.GetInit().Apply(this);
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutAForStm(node);
 }
Esempio n. 6
0
 public override void CaseAForStm(AForStm node)
 {
     //Ignore it.
 }
Esempio n. 7
0
 ArrayList New316()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList7 = (ArrayList) Pop();
     ArrayList nodeArrayList6 = (ArrayList) Pop();
     ArrayList nodeArrayList5 = (ArrayList) Pop();
     ArrayList nodeArrayList4 = (ArrayList) Pop();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TLParen tlparenNode2 = (TLParen)nodeArrayList2[0];
     PStm pstmNode3 = (PStm)nodeArrayList3[0];
     PExp pexpNode4 = (PExp)nodeArrayList4[0];
     PStm pstmNode5 = (PStm)nodeArrayList5[0];
     PStm pstmNode6 = (PStm)nodeArrayList7[0];
     AForStm pstmNode1 = new AForStm (
       tlparenNode2,
       pstmNode3,
       pexpNode4,
       pstmNode5,
       pstmNode6
     );
     nodeList.Add(pstmNode1);
     return nodeList;
 }
Esempio n. 8
0
 ArrayList New315()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList6 = (ArrayList) Pop();
     ArrayList nodeArrayList5 = (ArrayList) Pop();
     ArrayList nodeArrayList4 = (ArrayList) Pop();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TLParen tlparenNode2 = (TLParen)nodeArrayList2[0];
     PStm pstmNode3 = (PStm)nodeArrayList3[0];
     PStm pstmNode5 = (PStm)nodeArrayList4[0];
     PStm pstmNode6 = (PStm)nodeArrayList6[0];
     AForStm pstmNode1 = new AForStm (
       tlparenNode2,
       pstmNode3,
       null,
       pstmNode5,
       pstmNode6
     );
     nodeList.Add(pstmNode1);
     return nodeList;
 }