summaryrefslogtreecommitdiff
path: root/minijava/SymTableVis.java
diff options
context:
space:
mode:
Diffstat (limited to 'minijava/SymTableVis.java')
-rw-r--r--minijava/SymTableVis.java20
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);