public void graficarTS2(Ambit_Trad ambit) { var res_graphi = ""; var ambito_name = ""; var ambito_name2 = ambit.Ambit_name.Replace("General_", ""); var graphi = "digraph G{\n"; graphi += "label = \"" + "Ambito Graficado: " + ambito_name2 + "\"\n"; graphi += "graph [pad=\"" + 0.5 + "\", nodesep=\"" + 0.5 + "\", ranksep=\"" + 2 + "\"]\nnode[shape = plain]\nrankdir = LR;\nBaz [label=<"; graphi += "\n<table border=\"" + 0 + "\" cellborder=\"" + 1 + "\" cellspacing=\"" + 0 + "\">"; graphi += "\n<tr>\n\t<td width='100'><i>Nombre</i></td>\n\t<td width='100'><i>Tipo</i></td>\n\t<td width='100'><i>Ambito</i></td>\n\t<td><i width='100'>Valor</i></td>\n\t<td><i width='100'>Tipo Objeto</i></td>\n</tr>\n"; while (ambit != null) { if (ambit.Variables.Count > 0) { foreach (var item in ambit.Variables) { Identifier_Trad id = (Identifier_Trad)item.Value; ambito_name = ambit.Ambit_name.Replace("General_", ""); res_graphi = "\n<tr>\n\t<td height='25'>" + id.Id + "</td>\n\t<td height='25'>" + id.DataType + "</td>\n\t<td height='25'>" + ambito_name + "</td>\n\t<td height='25'>" + id.Value.ToString() + "</td>\n\t<td height='25'>" + id.Tipo_dato + "</td>\n</tr>" + res_graphi; } } if (ambit.Functions.Count > 0) { var type = "void"; var isfunc = "Procedure"; foreach (var item in ambit.Functions) { type = "void"; isfunc = "Procedure"; Function_Trad func = (Function_Trad)item.Value; if (!func.IsProcedure) { isfunc = "Function"; type = func.Tipe.ToString(); } res_graphi = "<tr>\n<td height='25'>" + func.Id + "</td>\n<td height='25'>" + type + "</td>\n<td height='25'>" + ambit.Ambit_name + "</td>\n<td height='25'>" + func.Retorno.ToString() + "</td>\n<td height='25'>" + isfunc + "</td>\n</tr>" + res_graphi; } } var temp = ambit.Anterior; ambit = temp; } graphi += res_graphi + "\n</table>>];\n" + "}"; print_image(this.path, "tabla_simbolos", ambito_name2, graphi); }
public Identifier_Trad getVariableFunctionInAmbit(string id) { Identifier_Trad identifier = new Identifier_Trad(); Ambit_Trad amb = this; if (amb.Variables.ContainsKey(id)) { identifier = amb.Variables[id]; } return(identifier); }
public Identifier_Trad getVariable(string id) { Identifier_Trad identifier = new Identifier_Trad(); Ambit_Trad amb = this; while (amb != null) { if (amb.Variables.ContainsKey(id)) { identifier = amb.Variables[id]; break; } amb = amb.anterior; } return(identifier); }
public string get_var_anterior(Ambit_Trad ambit, string res_graphi) { if (ambit != null) { if (ambit.Variables.Count > 0) { var ambito_name = ambit.Ambit_name.Replace("General_", ""); foreach (var item in ambit.Variables) { Identifier_Trad id = (Identifier_Trad)item.Value; res_graphi = "\n<tr>\n\t<td height='25'>" + id.Id + "</td>\n\t<td height='25'>" + id.DataType + "</td>\n\t<td height='25'>" + ambito_name + "</td>\n\t<td height='25'>" + id.Value.ToString() + "</td>\n\t<td height='25'>" + id.Tipo_dato + "</td>\n</tr>" + res_graphi; } } res_graphi = get_var_anterior(ambit.Anterior, res_graphi); } return(res_graphi); }