public void mostrarSymbol(String blancos) { //Console.WriteLine(blancos + "SIMBOLO kind:" + this.kind + " nombre:" + this.name); Tab.tabSimbString = Tab.tabSimbString + blancos + "SIMBOLO kind:" + this.kind + " nombre:" + this.name + "\n"; if (this.type != null) { this.type.mostrarStruct(blancos + " "); } //else Console.WriteLine("type es null"); else { Tab.tabSimbString = Tab.tabSimbString + "type es null" + "\n"; } switch (this.kind) { case Symbol.Kinds.Const: //Console.WriteLine(blancos + "Value=" + this.val); break; Tab.tabSimbString = Tab.tabSimbString + blancos + "Value=" + this.val + "\n"; break; case Symbol.Kinds.Meth: case Symbol.Kinds.Prog: //muestra la lista de args y de vbles locales int cantArgs, cantLocs; cantArgs = cantLocs = 0; for (Symbol cur = this.locals; cur != null; cur = cur.next) { cur.mostrarSymbol(blancos + " "); if (cur.kind == Symbol.Kinds.Arg) { cantArgs++; } if (cur.kind == Symbol.Kinds.Local) { cantLocs++; } ; } ; if (this.nArgs != cantArgs || this.nLocs != cantLocs) { //Console.WriteLine("Error 4324242"); break; Tab.tabSimbString = Tab.tabSimbString + "Error 4324242" + "\n"; } break; } }
public static void mostrarTab() { tabSimbString = ""; //Console.WriteLine("\n======== TABLA DE SIMBOLOS ============"); tabSimbString = tabSimbString + "==== TABLA DE SIMBOLOS =====\n"; for (Symbol cur = Tab.topScope.locals; cur != null; cur = cur.next) {//mostrar un Symbol y sus descendientes cur.mostrarSymbol(""); } ; //Console.WriteLine("======== FIN TABLA DE SIMBOLOS ============"); tabSimbString = tabSimbString + "== FIN TABLA DE SIMBOLOS ===\n"; // if (ZZ.parser) Console.ReadKey(); if (muestraTabSimb) { //System.Windows.Forms.MessageBox.Show("Continuar"); Parser.MessageBoxCon3Preg(); } }
public void mostrarStruct(String blancos) { //Console.WriteLine(blancos + "STRUCT kind:"+ this.kind); Tab.tabSimbString = Tab.tabSimbString + blancos + "STRUCT kind:" + this.kind + "\n"; switch (this.kind) { case Struct.Kinds.Class: //recurro los fields for (Symbol campo = this.fields; campo != null; campo = campo.next) { campo.mostrarSymbol(blancos + " "); } break; case Struct.Kinds.Arr: //muestro elem if (this.elemType != null) { this.elemType.mostrarStruct(blancos + " "); } break; } }