diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-03-25 13:05:34 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-03-25 13:05:34 -0600 |
commit | b16ddfd5d0bc48b66123352827979e242fcd6bfc (patch) | |
tree | 094dc879c33608c94c47d03ec3e8df37962a5274 /minijava/SymTableVis.java | |
parent | 762acb336997d43e15d64ff591103614abe4806f (diff) |
Funnel all debug print statements into designated print filter
Diffstat (limited to 'minijava/SymTableVis.java')
-rw-r--r-- | minijava/SymTableVis.java | 20 |
1 files changed, 7 insertions, 13 deletions
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<R,A> extends GJDepthFirst<R,A> { public HashMap<String,TypeInstance> 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<R,A> extends GJDepthFirst<R,A> { 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<R,A> extends GJDepthFirst<R,A> { */ 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<R,A> extends GJDepthFirst<R,A> { 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<R,A> extends GJDepthFirst<R,A> { 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); |