Пример #1
0
 def addVar(self, id, value, type_, row, column):
     """
     Inserta un nuevo simbolo en la tabla de simbolos
     """
     env = self
     if id in env.variables:
         return None
     symbol = sym.Symbol(value, type_, row, column)
     env.variables[id] = symbol
     return symbol
Пример #2
0
 def updateVar(self, id, value, type_):
     """
     Actualiza el valor de una llave en la tabla de simbolos
     """
     env = self
     while env != None:
         if id in env.variables:
             symbol = env.variables[id]
             symbol = sym.Symbol(id, value, type_, symbol.row, symbol.column)
             env.variables[id] = symbol
             return True
         env = env.previous
     return None