diff --git a/src/sa/Sc2sa.java b/src/sa/Sc2sa.java index b2bddb7c4653e18509d4b919aa1edcdd77b0184f..69385bb0237a3debd4715312ffec20a03f0e1f5f 100644 --- a/src/sa/Sc2sa.java +++ b/src/sa/Sc2sa.java @@ -11,17 +11,17 @@ public class Sc2sa extends DepthFirstAdapter public void defaultIn(@SuppressWarnings("unused") Node node) { - System.out.println("<" + node.getClass().getSimpleName() + ">"); + System.out.println("<" + node.getClass().getSimpleName() + ">"); } public void defaultOut(@SuppressWarnings("unused") Node node) { - System.out.println("</" + node.getClass().getSimpleName() + ">"); + System.out.println("</" + node.getClass().getSimpleName() + ">"); } - + public SaProg getRoot() { - return this.saRoot; + return this.saRoot; } @@ -31,9 +31,7 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseStart(Start node) { - inStart(node); - node.getPProg().apply(this); - outStart(node); + super.caseStart(node); } @Override @@ -46,6 +44,7 @@ public class Sc2sa extends DepthFirstAdapter node.getLdecfonc().apply(this); op2 = (SaLDecFonc) this.returnValue; this.returnValue = new SaProg(op1, op2); + this.saRoot = (SaProg) this.returnValue; outAProgProg(node); } @@ -444,7 +443,7 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseAIdVar(AIdVar node) { - String id = ""; + String id = null; inAIdVar(node); id = node.getId().getText(); this.returnValue = new SaVarSimple(id); @@ -481,10 +480,7 @@ public class Sc2sa extends DepthFirstAdapter @Override public void caseATypeTypeopt(ATypeTypeopt node) { inATypeTypeopt(node); - Type type = null; - node.getType().apply(this); - type = this.returnType; - this.returnType = Type.fromString(type.nom()); + this.returnType = Type.NUL; outATypeTypeopt(node); }