Пример #1
0
 public override void CaseAFunctioncall(AFunctioncall node)
 {
     InAFunctioncall(node);
     if (node.GetEol() != null)
     {
         node.GetEol().Apply(this);
     }
     if (node.GetRparen() != null)
     {
         node.GetRparen().Apply(this);
     }
     if (node.GetArguments() != null)
     {
         node.GetArguments().Apply(this);
     }
     if (node.GetLparen() != null)
     {
         node.GetLparen().Apply(this);
     }
     if (node.GetId() != null)
     {
         node.GetId().Apply(this);
     }
     OutAFunctioncall(node);
 }
Пример #2
0
        //functioncall
        public override void OutAFunctioncall(AFunctioncall node)
        {
            Definition idDef, exprDef;
            String     funcName = node.GetId().Text;

            //    ensure id has been declared
            if (!(_currentSymbolTable.TryGetValue(funcName, out idDef) || _globalSymbolTable.TryGetValue(funcName, out idDef)))
            {
                Console.WriteLine("[" + node.GetId().Line + "] : " + funcName + " is not defined.");

                //    ensure id is a method
            }
            else if (!(idDef is MethodDefinition))
            {
                Console.WriteLine("[" + node.GetId().Line + "] : " + funcName + " is not a method.");

                //    ensure argument is decorated
            }
            else if (!_decoratedParseTree.TryGetValue(node.GetParams(), out exprDef))
            {
                Console.WriteLine("[" + node.GetId().Line + "] : argument was not decorated.");

                // Ensure that expr is a string or basic type
            }
            else if (!(exprDef is StringTypeDefinition) || !(exprDef is BasicTypeDefinition))
            {
                Console.WriteLine("[" + node.GetId().Line + "] : language only allows strings and basic types as arguments.");
            }
        }
Пример #3
0
 public override void OutAFunctioncall(AFunctioncall node)
 {
     if (node.GetId().Text.Equals("Print"))
     {
         _output.WriteLine("\tcall void [mscorlib]System.Console::Write(string)");
     }
     if (node.GetId().Text.Equals("NewLine"))
     {
         _output.WriteLine("\tldstr \"\\n\"");
         _output.WriteLine("\tcall void [mscorlib]System.Console::Write(string)");
     }
     if (node.GetId().Text.Equals("PrintInt"))
     {
         _output.WriteLine("\tcall void [mscorlib]System.Console::Write(int32)");
     }
     if (node.GetId().Text.Equals("PrintFloat"))
     {
         _output.WriteLine("\tcall void [mscorlib]System.Console::Write(float32)");
     }
 }
Пример #4
0
        ArrayList New8()
        {
            ArrayList     nodeList           = new ArrayList();
            ArrayList     nodeArrayList5     = (ArrayList)Pop();
            ArrayList     nodeArrayList4     = (ArrayList)Pop();
            ArrayList     nodeArrayList3     = (ArrayList)Pop();
            ArrayList     nodeArrayList2     = (ArrayList)Pop();
            ArrayList     nodeArrayList1     = (ArrayList)Pop();
            TId           tidNode2           = (TId)nodeArrayList1[0];
            TLparen       tlparenNode3       = (TLparen)nodeArrayList2[0];
            PArguments    pargumentsNode4    = (PArguments)nodeArrayList3[0];
            TRparen       trparenNode5       = (TRparen)nodeArrayList4[0];
            TEol          teolNode6          = (TEol)nodeArrayList5[0];
            AFunctioncall pfunctioncallNode1 = new AFunctioncall(
                tidNode2,
                tlparenNode3,
                pargumentsNode4,
                trparenNode5,
                teolNode6
                );

            nodeList.Add(pfunctioncallNode1);
            return(nodeList);
        }
Пример #5
0
 public virtual void OutAFunctioncall(AFunctioncall node)
 {
     DefaultOut(node);
 }
Пример #6
0
 public virtual void InAFunctioncall(AFunctioncall node)
 {
     DefaultIn(node);
 }
Пример #7
0
 public virtual void CaseAFunctioncall(AFunctioncall node)
 {
     DefaultCase(node);
 }