예제 #1
0
 public virtual void OutAOperatorDecl(AOperatorDecl node)
 {
     DefaultOut(node);
 }
예제 #2
0
 internal Formals_Cast(AOperatorDecl obj)
 {
     this.obj = obj;
 }
예제 #3
0
 public override void CaseAOperatorDecl(AOperatorDecl node)
 {
     InAOperatorDecl(node);
     if (node.GetBlock() != null)
     {
         node.GetBlock().Apply(this);
     }
     {
         Object[] temp = new Object[node.GetFormals().Count];
         node.GetFormals().CopyTo(temp, 0);
         for (int i = temp.Length - 1; i >= 0; i--)
         {
             ((PLocalDecl)temp[i]).Apply(this);
         }
     }
     if (node.GetOperator() != null)
     {
         node.GetOperator().Apply(this);
     }
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     if (node.GetReturnType() != null)
     {
         node.GetReturnType().Apply(this);
     }
     if (node.GetStatic() != null)
     {
         node.GetStatic().Apply(this);
     }
     if (node.GetVisibilityModifier() != null)
     {
         node.GetVisibilityModifier().Apply(this);
     }
     OutAOperatorDecl(node);
 }
예제 #4
0
 public virtual void InAOperatorDecl(AOperatorDecl node)
 {
     DefaultIn(node);
 }
예제 #5
0
 public virtual void CaseAOperatorDecl(AOperatorDecl node)
 {
     DefaultCase(node);
 }
예제 #6
0
        public override void CaseAOperatorDecl(AOperatorDecl node)
        {
            if (node.GetFormals().Count != 2)
                errors.Add(new ErrorCollection.Error(node.GetToken(), LocRM.GetString("ErrorText182")));
            Token token = null;
            if (node.GetOperator() is APlusBinop)
                token = ((APlusBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AMinusBinop)
                token = ((AMinusBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ADivideBinop)
                token = ((ADivideBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ATimesBinop)
                token = ((ATimesBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AModuloBinop)
                token = ((AModuloBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AEqBinop)
                token = ((AEqBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ANeBinop)
                token = ((ANeBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ALtBinop)
                token = ((ALtBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ALeBinop)
                token = ((ALeBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AGtBinop)
                token = ((AGtBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AGeBinop)
                token = ((AGeBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AGtBinop)
                token = ((AGtBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AAndBinop)
                token = ((AAndBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AOrBinop)
                token = ((AOrBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is AXorBinop)
                token = ((AXorBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ALBitShiftBinop)
                token = ((ALBitShiftBinop)node.GetOperator()).GetToken();
            else if (node.GetOperator() is ARBitShiftBinop)
                token = ((ARBitShiftBinop)node.GetOperator()).GetToken();

            AMethodDecl replacer = new AMethodDecl(node.GetVisibilityModifier(), null, node.GetStatic(), null, null,
                                                   null, node.GetReturnType(),
                                                   new TIdentifier(token.Text, token.Line, token.Pos), new ArrayList(),
                                                   node.GetBlock());
            while (node.GetFormals().Count > 0)
                replacer.GetFormals().Add(node.GetFormals()[0]);

            node.ReplaceBy(replacer);
            replacer.Apply(this);
        }
예제 #7
0
 ArrayList New37()
 {
     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();
     TypedList listNode8 = new TypedList();
     PVisibilityModifier pvisibilitymodifierNode2 = (PVisibilityModifier)nodeArrayList1[0];
     TStatic tstaticNode3 = (TStatic)nodeArrayList2[0];
     PType ptypeNode4 = (PType)nodeArrayList3[0];
     TOperator toperatorNode5 = (TOperator)nodeArrayList4[0];
     PBinop pbinopNode6 = (PBinop)nodeArrayList5[0];
     TypedList listNode7 = (TypedList)nodeArrayList6[0];
     if ( listNode7 != null )
     {
     listNode8.AddAll(listNode7);
     }
     PBlock pblockNode9 = (PBlock)nodeArrayList7[0];
     AOperatorDecl pdeclNode1 = new AOperatorDecl (
       pvisibilitymodifierNode2,
       tstaticNode3,
       ptypeNode4,
       toperatorNode5,
       pbinopNode6,
       listNode8,
       pblockNode9
     );
     nodeList.Add(pdeclNode1);
     return nodeList;
 }
예제 #8
0
 ArrayList New34()
 {
     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();
     TypedList listNode9 = new TypedList();
     PVisibilityModifier pvisibilitymodifierNode2 = (PVisibilityModifier)nodeArrayList1[0];
     TVoid tvoidNode5 = (TVoid)nodeArrayList2[0];
     AVoidType ptypeNode4 = new AVoidType (
       tvoidNode5
     );
     TOperator toperatorNode6 = (TOperator)nodeArrayList3[0];
     PBinop pbinopNode7 = (PBinop)nodeArrayList4[0];
     TypedList listNode8 = (TypedList)nodeArrayList5[0];
     if ( listNode8 != null )
     {
     listNode9.AddAll(listNode8);
     }
     PBlock pblockNode10 = (PBlock)nodeArrayList6[0];
     AOperatorDecl pdeclNode1 = new AOperatorDecl (
       pvisibilitymodifierNode2,
       null,
       ptypeNode4,
       toperatorNode6,
       pbinopNode7,
       listNode9,
       pblockNode10
     );
     nodeList.Add(pdeclNode1);
     return nodeList;
 }
        public override void CaseAOperatorDecl(AOperatorDecl node)
        {
            AMethodDecl replacer = new AMethodDecl(node.GetVisibilityModifier(), null, node.GetStatic(), null, null,
                                                   null, node.GetReturnType(),
                                                   new TIdentifier(""), new ArrayList(),
                                                   node.GetBlock());
            while (node.GetFormals().Count > 0)
                replacer.GetFormals().Add(node.GetFormals()[0]);

            node.ReplaceBy(replacer);
            replacer.Apply(this);
        }