def insertParametros(self, listaExpresiones, listaParametros, entornoLocal, entorno): cantidadRecorrido = len(listaExpresiones.hijos) i = 0 while i < cantidadRecorrido: #print('variable i: ',i) expresionExecute = listaExpresiones.hijos[i] value = expresionExecute.execute(entorno) parametroActual = listaParametros.hijos[i] tamParametro = len(parametroActual.hijos) if tamParametro == 4: argNombre = parametroActual.hijos[1].hijos[0] nombreVariable = argNombre.valor.lower() tipoDeclaracion = parametroActual.hijos[2].hijos[0] if tipoDeclaracion.nombreNodo == 'TEXT': if expresionExecute.tipo.data_type == Data_Type.character: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'SMALLINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'INTEGER': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BIGINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DECIMAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'NUMERIC': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'REAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'MONEY': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DATE': if expresionExecute.tipo.data_type == Data_Type.data_time: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False pass elif tamParametro == 3: nodo1 = parametroActual.hijos[0] nodo2 = parametroActual.hijos[1] nodo3 = parametroActual.hijos[2] if nodo1.nombreNodo == 'MODO_ARGUMENTO': argNombre = parametroActual.hijos[1].hijos[0] nombreVariable = argNombre.valor.lower() tipoDeclaracion = parametroActual.hijos[2].hijos[0] if tipoDeclaracion.nombreNodo == 'TEXT': if expresionExecute.tipo.data_type == Data_Type.character: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'SMALLINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'INTEGER': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BIGINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DECIMAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'NUMERIC': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'REAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'MONEY': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DATE': if expresionExecute.tipo.data_type == Data_Type.data_time: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False pass else: argNombre = parametroActual.hijos[0].hijos[0] nombreVariable = argNombre.valor.lower() tipoDeclaracion = parametroActual.hijos[1].hijos[0] if tipoDeclaracion.nombreNodo == 'TEXT': if expresionExecute.tipo.data_type == Data_Type.character: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'SMALLINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'INTEGER': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BIGINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DECIMAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'NUMERIC': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'REAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'MONEY': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DATE': if expresionExecute.tipo.data_type == Data_Type.data_time: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion( Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol( nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False pass elif tamParametro == 2: argNombre = parametroActual.hijos[0].hijos[0] nombreVariable = argNombre.valor.lower() tipoDeclaracion = parametroActual.hijos[1].hijos[0] if tipoDeclaracion.nombreNodo == 'TEXT': if expresionExecute.tipo.data_type == Data_Type.character: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.character) tipoVariable.data_specific = 'text' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'SMALLINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'smallint' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'INTEGER': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'integer' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BIGINT': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'bigint' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DECIMAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'decimal' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'NUMERIC': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'numeric' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'REAL': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'real' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'MONEY': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.numeric) tipoVariable.data_specific = 'money' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'DATE': if expresionExecute.tipo.data_type == Data_Type.data_time: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.data_time) tipoVariable.data_specific = 'data' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False elif tipoDeclaracion.nombreNodo == 'BOOLEAN': if expresionExecute.tipo.data_type == Data_Type.numeric: if entornoLocal.existeSimboloEntornoActual( nombreVariable): return False else: # Creamos Simbolo tipoVariable = Type_Expresion(Data_Type.boolean) tipoVariable.data_specific = 'boolean' simboloVariable = Symbol(nombreVariable, tipoVariable, value) entornoLocal.ingresar_simbolo( nombreVariable, simboloVariable) pass pass else: return False pass i += 1 pass return True
def execute(self, enviroment): tipoMetodo = Type_Expresion(Data_Type.non) # Simbolo guardar simboloMetodo = Simbolo_Metodo() nodo1 = self.hijos[0] if nodo1.nombreNodo == 'ORREPLACE': nodoNombreFunction = self.hijos[1] nombreFunction = nodoNombreFunction.valor.lower() # Nombre a guardar en tabla de símbolos nombreAlmacenarFuncion = 'f_' + nodoNombreFunction.valor.lower() # Nombre Simbolo simboloMetodo.nombreMetodo = nombreFunction nodo2 = self.hijos[2] if nodo2.nombreNodo == 'LISTA_ARG_FUNCION': # Se asigna la lista al objeto del método a crear simboloMetodo.listaParametros = nodo2 nodo3 = self.hijos[3] if nodo3.nombreNodo == 'SENTENCIA RETORNO': simboloMetodo.sentenciaReturn = nodo3 tipoDato = nodo3.hijos[0].hijos[0] if tipoDato.nombreNodo == 'SMALLINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'smallint' pass elif tipoDato.nombreNodo == 'INTEGER': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'integer' pass elif tipoDato.nombreNodo == 'BIGINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'bigint' pass elif tipoDato.nombreNodo == 'DECIMAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'decimal' pass elif tipoDato.nombreNodo == 'NUMERIC': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'numeric' pass elif tipoDato.nombreNodo == 'REAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'real' pass elif tipoDato.nombreNodo == 'MONEY': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'money' pass elif tipoDato.nombreNodo == 'TEXT': tipoMetodo.data_type = Data_Type.character tipoMetodo.data_specific = 'text' pass elif tipoDato.nombreNodo == 'DATE': tipoMetodo.data_type = Data_Type.data_time tipoMetodo.data_specific = 'date' pass elif tipoDato.nombreNodo == 'BOOLEAN': tipoMetodo.data_type = Data_Type.boolean tipoMetodo.data_specific = 'boolean' pass nodo4 = self.hijos[4] simboloMetodo.bloqueEjecutar = nodo4 if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.actualizar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloMetodo.bloqueEjecutar = nodo3 tipoMetodo.data_specific = 'void' if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.actualizar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass pass elif nodo2.nombreNodo == 'SENTENCIA RETORNO': tipoDato = nodo2.hijos[0].hijos[0] if tipoDato.nombreNodo == 'SMALLINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'smallint' pass elif tipoDato.nombreNodo == 'INTEGER': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'integer' pass elif tipoDato.nombreNodo == 'BIGINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'bigint' pass elif tipoDato.nombreNodo == 'DECIMAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'decimal' pass elif tipoDato.nombreNodo == 'NUMERIC': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'numeric' pass elif tipoDato.nombreNodo == 'REAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'real' pass elif tipoDato.nombreNodo == 'MONEY': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'money' pass elif tipoDato.nombreNodo == 'TEXT': tipoMetodo.data_type = Data_Type.character tipoMetodo.data_specific = 'text' pass elif tipoDato.nombreNodo == 'DATE': tipoMetodo.data_type = Data_Type.data_time tipoMetodo.data_specific = 'date' pass elif tipoDato.nombreNodo == 'BOOLEAN': tipoMetodo.data_type = Data_Type.boolean tipoMetodo.data_specific = 'boolean' pass nodo3 = self.hijos[3] simboloMetodo.bloqueEjecutar = nodo3 if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.actualizar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass else: simboloMetodo.bloqueEjecutar = nodo2 tipoMetodo.data_specific = 'void' if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.actualizar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass else: nombreFunction = nodo1.valor.lower() simboloMetodo.nombreMetodo = nombreFunction nombreAlmacenarFuncion = 'f_' + nombreFunction nodo2 = self.hijos[1] if nodo2.nombreNodo == 'LISTA_ARG_FUNCION': # Se asigna la lista al objeto del método a crear simboloMetodo.listaParametros = nodo2 nodo3 = self.hijos[2] if nodo3.nombreNodo == 'SENTENCIA RETORNO': simboloMetodo.sentenciaReturn = nodo3 tipoDato = nodo3.hijos[0].hijos[0] if tipoDato.nombreNodo == 'SMALLINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'smallint' pass elif tipoDato.nombreNodo == 'INTEGER': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'integer' pass elif tipoDato.nombreNodo == 'BIGINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'bigint' pass elif tipoDato.nombreNodo == 'DECIMAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'decimal' pass elif tipoDato.nombreNodo == 'NUMERIC': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'numeric' pass elif tipoDato.nombreNodo == 'REAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'real' pass elif tipoDato.nombreNodo == 'MONEY': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'money' pass elif tipoDato.nombreNodo == 'TEXT': tipoMetodo.data_type = Data_Type.character tipoMetodo.data_specific = 'text' pass elif tipoDato.nombreNodo == 'DATE': tipoMetodo.data_type = Data_Type.data_time tipoMetodo.data_specific = 'date' pass elif tipoDato.nombreNodo == 'BOOLEAN': tipoMetodo.data_type = Data_Type.boolean tipoMetodo.data_specific = 'boolean' pass nodo4 = self.hijos[3] simboloMetodo.bloqueEjecutar = nodo4 if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): print( 'Error: Ya se ha ingresado el método previamente') pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass else: simboloMetodo.bloqueEjecutar = nodo3 tipoMetodo.data_specific = 'void' if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): print( 'Error: Ya se ha ingresado el método previamente') pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass pass elif nodo2.nombreNodo == 'SENTENCIA RETORNO': tipoDato = nodo2.hijos[0].hijos[0] if tipoDato.nombreNodo == 'SMALLINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'smallint' pass elif tipoDato.nombreNodo == 'INTEGER': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'integer' pass elif tipoDato.nombreNodo == 'BIGINT': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'bigint' pass elif tipoDato.nombreNodo == 'DECIMAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'decimal' pass elif tipoDato.nombreNodo == 'NUMERIC': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'numeric' pass elif tipoDato.nombreNodo == 'REAL': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'real' pass elif tipoDato.nombreNodo == 'MONEY': tipoMetodo.data_type = Data_Type.numeric tipoMetodo.data_specific = 'money' pass elif tipoDato.nombreNodo == 'TEXT': tipoMetodo.data_type = Data_Type.character tipoMetodo.data_specific = 'text' pass elif tipoDato.nombreNodo == 'DATE': tipoMetodo.data_type = Data_Type.data_time tipoMetodo.data_specific = 'date' pass elif tipoDato.nombreNodo == 'BOOLEAN': tipoMetodo.data_type = Data_Type.boolean tipoMetodo.data_specific = 'boolean' pass nodo3 = self.hijos[2] simboloMetodo.bloqueEjecutar = nodo3 if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): print("Error: Ya ha sido ingresado el método previamente") pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass else: simboloMetodo.bloqueEjecutar = nodo2 tipoMetodo.data_specific = 'void' if enviroment.existeSimboloEntornoActual( nombreAlmacenarFuncion): print('Error: Ya se ha ingresado el método previamente') pass else: simboloGuardar = Symbol(nombreFunction, tipoMetodo, simboloMetodo) enviroment.ingresar_simbolo(nombreAlmacenarFuncion, simboloGuardar) pass pass pass pass