public Identifier save(string id, object valor, string valor_Def, DataType type, bool esconstante, bool isAssigned, bool isheap, bool isrefer, string tipo_dato) { var generator = C3D.C3DController.Instance; Ambit amb = this; var position = generator.get_posision_global(); Identifier ident = new Identifier(valor.ToString(), valor_Def, id, type, esconstante, isAssigned, this.size++, (anterior == null), isheap, isrefer, tipo_dato, position, position); if (!amb.Ambit_name_inmediato.Equals("Function")) { if (!amb.variables.ContainsKey(id.ToLower())) { amb.variables[id.ToLower()] = (ident); } } else { saveVarFunction(ident); } return(ident); }
public void saveArray(string id, Arrays arrays) { Ambit amb = this; if (!amb.Arrayss.ContainsKey(id.ToLower())) { amb.Arrayss[id.ToLower()] = arrays; } }
public void saveVarFunction(Identifier ident) { Ambit amb = this; if (!amb.variables.ContainsKey(ident.Id.ToLower())) { amb.variables[ident.Id.ToLower()] = (ident); } }
public void saveFuncion(string id, Function function) { Ambit amb = this; if (!amb.functions.ContainsKey(id.ToLower())) { amb.functions[id.ToLower()] = function; } }
public void saveVarFunction(string id, string valor, string valdef, DataType type, bool isrefe, string tipo_Dato, int reference_to) { var generator = C3D.C3DController.Instance; Ambit amb = this; if (!amb.variables.ContainsKey(id)) { var pos = generator.get_posision_global(); amb.variables[id] = (new Identifier(valor, valdef, id, type, false, false, Size++, false, false, isrefe, tipo_Dato, pos, reference_to)); } }
public Identifier getVariableInAmbit(string id) { Identifier identifier = new Identifier(); Ambit amb = this; if (amb.Variables.ContainsKey(id)) { identifier = amb.Variables[id]; } return(identifier); }
public void setVariableFuncion(string id, string valor, string valdef, DataType type, bool isrefe, string tipo_Dato, int reference_to, bool isheap) { Ambit env = this; if (env.Variables.ContainsKey(id.ToLower())) { var variable = env.Variables[id.ToLower()]; env.Variables[id.ToLower()] = new Identifier(valor, valdef, id, type, false, false, variable.Position, false, isheap, isrefe, tipo_Dato, variable.Position_global, reference_to); } }
public void setArray(string id, Arrays tipo_dato) { Ambit env = this; while (env != null) { if (env.Arrayss.ContainsKey(id.ToLower())) { env.Arrayss[id.ToLower()] = tipo_dato; return; } env = env.anterior; } }
public Function getFuncion(string id) { Ambit amb = this; while (amb != null) { if (amb.Functions.ContainsKey(id.ToLower())) { return(amb.Functions[id.ToLower()]); } amb = amb.anterior; } return(null); }
public void setFunction(string id, Function function) { Ambit env = this; while (env != null) { if (env.Functions.ContainsKey(id.ToLower())) { env.Functions[id.ToLower()] = function; return; } env = env.anterior; } }
//CONSTRUCTOR PARA FUNCIONES public Ambit(Ambit a, string n, string ni, string tempoReturn, string exit_tag, bool isf, DataType dt, int size) { this.variables = new Dictionary <string, Identifier>(); this.functions = new Dictionary <string, Function>(); this.arrays = new Dictionary <string, Arrays>(); this.ambit_name = n; this.ambit_name_inmediato = ni; this.anterior = a; this.ambit_null = false; this.size = size; this.temp_return = tempoReturn; this.isFunction = isf; this._exit = exit_tag; this.tipo_fun = dt; this.temporales = new ArrayList(); }
public Arrays getArray(string id) { Ambit amb = this; while (amb != null) { if (amb.Arrayss.ContainsKey(id.ToLower())) { return(amb.Arrayss[id.ToLower()]); } amb = amb.anterior; } return(null); }
//CONSTRUCTOR PARA INSTRUCCIONES DE CONTROL public Ambit(Ambit a, string n, string ni, bool isnull, bool isf) { this.variables = a.variables; this.functions = a.functions; this.arrays = a.arrays; this.temporales = a.temporales; this.ambit_name = n; this.ambit_name_inmediato = ni; this.anterior = a; this.ambit_null = isnull; this.size = a.Size; this._break = a.Break; this._exit = a.Exit; this._continue = a.Continue; this.isFunction = isf; this.Tipo_fun = a.Tipo_fun; this.temp_return = a.temp_return; }
public void setVariable(string id, string valor, string valdef, DataType type, bool isAssigned, int posi, bool isglobal, bool isrefe, string tipo_Dato, int position_refence) { Ambit env = this; while (env != null) { if (env.Variables.ContainsKey(id.ToLower())) { var variable = env.Variables[id.ToLower()]; env.Variables[id.ToLower()] = new Identifier(valor, valdef, id, type, false, isAssigned, posi, isglobal, false, isrefe, tipo_Dato, variable.Position_global, position_refence); return; } env = env.anterior; } }
public Identifier getVariable(string id) { Identifier identifier = new Identifier(); Ambit amb = this; if (amb.Variables.ContainsKey(id.ToLower())) { return(amb.Variables[id.ToLower()]); } while (amb != null) { if (amb.Variables.ContainsKey(id.ToLower())) { identifier = amb.Variables[id.ToLower()]; identifier.IsGlobal = true; break; } amb = amb.anterior; } return(identifier); }