Esempio n. 1
0
 def toObject(self, env):
     # self.env.parent=env if env is not None else scheme.Globals.Globals
     if hasattr(self, 'obj'):
         return self.obj
     e = env
     while e is not None:
         if e is self.env:
             return Symbol.toObject(self, env)
         if hasattr(e, 'parent'):
             e = e.parent
         else:
             e = None
     return Symbol.toObject(self, self.env)
Esempio n. 2
0
 def toObject(self, env):
     # self.env.parent=env if env is not None else scheme.Globals.Globals
     if hasattr(self, 'obj'):
         return self.obj
     e = env
     while e is not None:
         if e is self.env:
             return Symbol.toObject(self, env)
         if hasattr(e, 'parent'):
             e = e.parent
         else:
             e = None
     return Symbol.toObject(self, self.env)
Esempio n. 3
0
 def toObject(self, env):
     # print 31, self, env
     if not isinstance(self.symbol, Symbol):
         return self.symbol
     try:
         possibleEnv = Symbol.getEnv(self, env)
         # print 36
     except NameError:
         if hasattr(self, 'altEnv'):
             # print 38
             try:
                 possibleEnv = Symbol.getEnv(self.symbol, self.altEnv)
                 # print 40, possibleEnv
                 return Symbol.toObject(self.symbol, self.altEnv)
             except NameError:
                 possibleEnv = None
         else:
             possibleEnv = None
     # print 44, possibleEnv
     if possibleEnv is not None:
         keys = possibleEnv.keys()
         if self in keys:
             possibleSymbol = keys[keys.index(self)]
             if isinstance(possibleSymbol, SyntaxSymbol) and possibleSymbol.transformer == self.transformer:
                 return possibleEnv[self]
     try:
         return self.symbol.toObject(self.env)
     except NameError as e:
         if hasattr(self, 'altEnv'):
             # print 59
             return self.symbol.toObject(self.altEnv)
         if possibleEnv:
             import scheme.processer as p
             return MacroSymbol(self.symbol).setObj(possibleEnv[self])
         raise e
Esempio n. 4
0
 def toObject(self, env):
     # print 31, self, env
     if not isinstance(self.symbol, Symbol):
         return self.symbol
     try:
         possibleEnv = Symbol.getEnv(self, env)
         # print 36
     except NameError:
         if hasattr(self, 'altEnv'):
             # print 38
             try:
                 possibleEnv = Symbol.getEnv(self.symbol, self.altEnv)
                 # print 40, possibleEnv
                 return Symbol.toObject(self.symbol, self.altEnv)
             except NameError:
                 possibleEnv = None
         else:
             possibleEnv = None
     # print 44, possibleEnv
     if possibleEnv is not None:
         keys = possibleEnv.keys()
         if self in keys:
             possibleSymbol = keys[keys.index(self)]
             if isinstance(
                     possibleSymbol, SyntaxSymbol
             ) and possibleSymbol.transformer == self.transformer:
                 return possibleEnv[self]
     try:
         return self.symbol.toObject(self.env)
     except NameError as e:
         if hasattr(self, 'altEnv'):
             # print 59
             return self.symbol.toObject(self.altEnv)
         if possibleEnv:
             import scheme.processer as p
             return MacroSymbol(self.symbol).setObj(possibleEnv[self])
         raise e