From b16ddfd5d0bc48b66123352827979e242fcd6bfc Mon Sep 17 00:00:00 2001 From: bd-912 Date: Mon, 25 Mar 2024 13:05:34 -0600 Subject: Funnel all debug print statements into designated print filter --- minijava/SymTableVis.java | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'minijava/SymTableVis.java') diff --git a/minijava/SymTableVis.java b/minijava/SymTableVis.java index 6f03c45..1a48fd2 100644 --- a/minijava/SymTableVis.java +++ b/minijava/SymTableVis.java @@ -12,12 +12,6 @@ public class SymTableVis extends GJDepthFirst { public HashMap symt = new HashMap<>(); - private void print_filter(String message) { - boolean debug = true; - if (debug) - System.out.println(message); - } - /** * f0 -> "class" * f1 -> Identifier() @@ -45,12 +39,12 @@ public class SymTableVis extends GJDepthFirst { n.f14.accept(this, argu); n.f15.accept(this, argu); - this.print_filter("Processing main"); + Utilities.print_filter("Processing main", true); String id = n.f1.f0.tokenImage; TypeInstance type = new TypeInstance(id, TypeEnum.classname); - this.print_filter("Inserting " + id + " => " + type); + Utilities.print_filter("Inserting " + id + " => " + type, true); symt.put(id, type); return null; @@ -64,7 +58,7 @@ public class SymTableVis extends GJDepthFirst { */ public R visit(VarDeclaration n, A argu) { - this.print_filter("Processing declaration"); + Utilities.print_filter("Processing declaration", true); String id = n.f1.f0.tokenImage; TypeInstance type = new TypeInstance("ERROR", TypeEnum.ERROR); @@ -78,10 +72,10 @@ public class SymTableVis extends GJDepthFirst { case 3: type = new TypeInstance(id, TypeEnum.classname); break; default: - this.print_filter("Unsupported case"); + Utilities.print_filter("Unsupported case", true); } - this.print_filter("Inserting " + id + " => " + type); + Utilities.print_filter("Inserting " + id + " => " + type, true); // Safe? symt.put(id, type); @@ -90,12 +84,12 @@ public class SymTableVis extends GJDepthFirst { public R visit(ClassDeclaration n, A argu) { - this.print_filter("Processing class"); + Utilities.print_filter("Processing class", true); String id = n.f1.f0.tokenImage; TypeInstance type = new TypeInstance(id, TypeEnum.classname); - this.print_filter("Inserting " + id + " => " + type); + Utilities.print_filter("Inserting " + id + " => " + type, true); // Safe? symt.put(id, type); -- cgit v1.2.3