예제 #1
0
파일: parser.py 프로젝트: Silica/PyPSL
 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
예제 #2
0
파일: parser.py 프로젝트: Silica/PyPSL
 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, ";")