Ejemplo n.º 1
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
Ejemplo n.º 2
0
 def getEnv(self, env):
     possibleEnv=None
     try:
         possibleEnv = Symbol.getEnv(self.symbol, env)
     except NameError:
         try:
             possibleEnv = Symbol.getEnv(self.symbol, self.altEnv)
         except NameError:
             pass
     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
     return self.symbol.getEnv(self.env)
Ejemplo n.º 3
0
 def getEnv(self, env):
     possibleEnv = None
     try:
         possibleEnv = Symbol.getEnv(self.symbol, env)
     except NameError:
         try:
             possibleEnv = Symbol.getEnv(self.symbol, self.altEnv)
         except NameError:
             pass
     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
     return self.symbol.getEnv(self.env)
Ejemplo 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