public virtual void InASwitchCaseStm(ASwitchCaseStm node)
 {
     DefaultIn(node);
 }
 public virtual void OutASwitchCaseStm(ASwitchCaseStm node)
 {
     DefaultOut(node);
 }
 public override void CaseASwitchCaseStm(ASwitchCaseStm node)
 {
     InASwitchCaseStm(node);
     if (node.GetBlock() != null)
     {
         node.GetBlock().Apply(this);
     }
     if (node.GetType() != null)
     {
         node.GetType().Apply(this);
     }
     OutASwitchCaseStm(node);
 }
 public virtual void CaseASwitchCaseStm(ASwitchCaseStm node)
 {
     DefaultCase(node);
 }
Esempio n. 5
0
        //This should be done later, after type linking since we might make new variables for i++, which shouldn't clash with user definitions
        /*public override void OutAIncDecExp(AIncDecExp node)
        {
            //Replace with assignment
            //<exp>++ => <exp> + 1
            //(... foo = <exp> ...)++ => (... foo = <exp> ...) = (... foo ...) + 1
            //(... foo++ ...)++ => (... foo++ ...) = (... foo ...) + 1

            PLvalue clone = (PLvalue) node.GetLvalue().Clone();
            clone.Apply(new AssignFixup());
            PBinop binop;
            Token token;
            if (node.GetIncDecOp() is APostIncIncDecOp)
            {
                APostIncIncDecOp op = (APostIncIncDecOp) node.GetIncDecOp();
                token = op.GetToken();
                binop = new APlusBinop(new TPlus("+", op.GetToken().Line, op.GetToken().Pos));
            }
            else
            {
                APostDecIncDecOp op = (APostDecIncDecOp)node.GetIncDecOp();
                token = op.GetToken();
                binop = new AMinusBinop(new TMinus("-", op.GetToken().Line, op.GetToken().Pos));
            }
            ABinopExp addExp = new ABinopExp(new ALvalueExp(clone), binop, new AIntConstExp(new TIntegerLiteral("1", token.Line, token.Pos)));
            AAssignmentExp exp = new AAssignmentExp(new TAssign("=", token.Line, token.Pos), node.GetLvalue(), addExp);
            node.ReplaceBy(exp);
            exp.Apply(this);
        }

        private class AssignFixup : DepthFirstAdapter
        {
            public override void CaseAAssignmentExp(AAssignmentExp node)
            {
                ALvalueExp replacer = new ALvalueExp(node.GetLvalue());
                node.ReplaceBy(replacer);
            }
        }*/
        public override void CaseASwitchCaseStm(ASwitchCaseStm node)
        {
            AABlock block = (AABlock) node.GetBlock();
            Token token;
            if (node.GetType() is ACaseSwitchCaseType)
                token = ((ACaseSwitchCaseType) node.GetType()).GetToken();
            else
                token = ((ADefaultSwitchCaseType)node.GetType()).GetToken();
            block.SetToken(new TRBrace("{", token.Line, token.Pos));
            base.CaseASwitchCaseStm(node);
        }
Esempio n. 6
0
 ArrayList New285()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TDefault tdefaultNode3 = (TDefault)nodeArrayList1[0];
     ADefaultSwitchCaseType pswitchcasetypeNode2 = new ADefaultSwitchCaseType (
       tdefaultNode3
     );
     TypedList listNode6 = new TypedList();
     TypedList listNode5 = (TypedList)nodeArrayList3[0];
     if ( listNode5 != null )
     {
     listNode6.AddAll(listNode5);
     }
     AABlock pblockNode4 = new AABlock (
       listNode6,
       null
     );
     ASwitchCaseStm pstmNode1 = new ASwitchCaseStm (
       pswitchcasetypeNode2,
       pblockNode4
     );
     nodeList.Add(pstmNode1);
     return nodeList;
 }
Esempio n. 7
0
 ArrayList New283()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList4 = (ArrayList) Pop();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TCase tcaseNode3 = (TCase)nodeArrayList1[0];
     PExp pexpNode4 = (PExp)nodeArrayList2[0];
     ACaseSwitchCaseType pswitchcasetypeNode2 = new ACaseSwitchCaseType (
       tcaseNode3,
       pexpNode4
     );
     TypedList listNode7 = new TypedList();
     TypedList listNode6 = (TypedList)nodeArrayList4[0];
     if ( listNode6 != null )
     {
     listNode7.AddAll(listNode6);
     }
     AABlock pblockNode5 = new AABlock (
       listNode7,
       null
     );
     ASwitchCaseStm pstmNode1 = new ASwitchCaseStm (
       pswitchcasetypeNode2,
       pblockNode5
     );
     nodeList.Add(pstmNode1);
     return nodeList;
 }