Exemplo n.º 1
0
 void FunctionDeclaration()
 {
     if (currentMethod != null)
     {
         Error("Cannot define a function inside another function.");
     }
     Expect(13);
     Expect(57);
     Expect(18);
     Expect(1);
     currentMethod = new LOLMethod(GetFunction(t.val), program); short arg = 0;
     if (la.kind == 30)
     {
         Get();
         Expect(1);
         currentMethod.SetArgumentName(arg++, t.val);
         while (la.kind == 48)
         {
             Get();
             Expect(30);
             Expect(1);
             currentMethod.SetArgumentName(arg++, t.val);
         }
     }
     while (la.kind == 5)
     {
         Get();
     }
     Statements(out currentMethod.statements);
     Expect(58);
     Expect(59);
     Expect(60);
     Expect(61);
     program.methods.Add(currentMethod.info.Name, currentMethod); currentMethod = null;
 }
Exemplo n.º 2
0
 void FunctionDeclaration()
 {
     if(currentMethod != null) Error("Cannot define a function inside another function.");
     Expect(13);
     Expect(57);
     Expect(18);
     Expect(1);
     currentMethod = new LOLMethod(GetFunction(t.val), program); short arg = 0;
     if (la.kind == 30) {
     Get();
     Expect(1);
     currentMethod.SetArgumentName(arg++, t.val);
     while (la.kind == 48) {
         Get();
         Expect(30);
         Expect(1);
         currentMethod.SetArgumentName(arg++, t.val);
     }
     }
     while (la.kind == 5) {
     Get();
     }
     Statements(out currentMethod.statements);
     Expect(58);
     Expect(59);
     Expect(60);
     Expect(61);
     program.methods.Add(currentMethod.info.Name, currentMethod); currentMethod = null;
 }