Example #1
0
 def GetFrame(self, var):
     if var.GetLocation() == 'GF':
         return Model.GF
     elif var.GetLocation() == 'LF':
         return Model.LF
     elif var.GetLocation() == 'TF':
         if Model.TF == None:
             raise Err.UndefinedFrameException("TF not defined.")
         return Model.TF
     else:
         raise Err.UndefinedFrameException('unknown frame')
Example #2
0
 def GetValue(self, name):
     """ Returns top Frame variable value.
         Will throw exception, if empty, or not initialized. """
     try:
         return self.frames.Top().GetValue(name)
     except AttributeError:
         raise Err.UndefinedFrameException("Empty stackframe!")
Example #3
0
 def DefVar(self, name, c):
     """ Creates new top Frame variable.
         Will throw exception, if empty. """
     try:
         self.frames.Top().DefVar(name, c)
     except AttributeError:
         raise Err.UndefinedFrameException("Empty stackframe!")
Example #4
0
 def PopFrame(self):
     """ Pops Frame and returns it.
         Will throw exception, if empty. """
     try:
         return self.frames.Pop()
     except IndexError:
         raise Err.UndefinedFrameException("Empty stackframe!")
Example #5
0
 def Set(self, name, c):
     """ Initializes top Frame variable.
         Will throw exception, if does not exist. """
     try:
         self.frames.Top().Set(name, c)
     except AttributeError:
         raise Err.UndefinedFrameException("Empty stackframe!")
Example #6
0
 def Top(self):
     """ Returns top item.
         Will throw exception, if empty. """
     try:
         return self.data[-1]
     except:
         raise Err.UndefinedFrameException('empty framestack')
Example #7
0
def PushFrame():
    """ Pushes Frame onto LF. Aims LF operations on it.
        Will throw exception, if TF is not defined. """
    global TF
    global LF
    if TF is not None:
        LF.PushFrame(TF)
        TF = None
    else:
        raise Err.UndefinedFrameException("TF is not defined!")