Esempio n. 1
0
 def getSuff(self,c):
     while (self.t.checkNext()):
         n = self.t.checkNext()
         if n == "(":
             self.t.getNext()
             self.Expression(c, ")")
             c.pushcode(code.call())
         else:
             break
Esempio n. 2
0
 def Statement(self,c):
     n = self.t.checkNext()
     if (n == ";"):
         self.t.getNext()
         return
     elif (n == "{"):
         self.t.getNext()
         self.ParseBlock(c)
         return
     elif (n == "identifier"):
         self.t.getNext()
         if self.t.data == "if":
             self.ParseIf(c)
             return
         elif self.t.data == "for":
             self.ParseFor(c)
             return
         else:
             name = self.t.data
             if self.t.checkNext() == "(":
                 self.t.getNext()
                 arg = variable.variable()
                 if self.t.checkNext() == ")":
                     self.t.getNext()
                     arg.pushcode(code.push_null())
                 else:
                     self.Expression(arg, ")")
                 if self.t.checkNext() == "{":
                     self.t.getNext()
                     arg.pushcode(code.argument())
                     self.ParseBlock(arg)
                     c.index(name).assignment(arg)
                     return
                 c.pushcode(code.pop())
                 c.pushcode(code.variable(name))
                 c.x.code.c += arg.x.code.c
                 c.pushcode(code.call())
             else:
                 c.pushcode(code.pop())
                 c.pushcode(code.variable(name))
             self.getSuff(c)
             self.Expression(c, ";", True)
             return
     c.pushcode(code.pop())
     self.Expression(c, ";")