diff options
Diffstat (limited to 'src/ast/nodes/CompoundNode.java')
| -rw-r--r-- | src/ast/nodes/CompoundNode.java | 42 | 
1 files changed, 41 insertions, 1 deletions
diff --git a/src/ast/nodes/CompoundNode.java b/src/ast/nodes/CompoundNode.java index f0f63f2..ad3420d 100644 --- a/src/ast/nodes/CompoundNode.java +++ b/src/ast/nodes/CompoundNode.java @@ -22,6 +22,7 @@ public class CompoundNode implements Node {          this.whileStmt = whileStmt;      } +      @Override      public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting, FunctionType ft) {          ArrayList<SemanticError> errors = new ArrayList<>(); @@ -72,12 +73,35 @@ public class CompoundNode implements Node {      }      @Override -    public String toPrint(String prefix) { +    public String printAST(String prefix) {          String str = prefix + "CompoundNode\n";          prefix += "  ";          if (ifNode != null) { +            str += ifNode.printAST(prefix); +        } + +        if (funcDef != null) { +            str += funcDef.printAST(prefix); +        } + +        if (forStmt != null) { +            str += forStmt.printAST(prefix); +        } + +        if (whileStmt != null) { +            str += whileStmt.printAST(prefix); +        } + +        return str; +    } + +    @Override +    public String toPrint(String prefix) { +        String str = ""; + +        if (ifNode != null) {              str += ifNode.toPrint(prefix);          } @@ -94,6 +118,22 @@ public class CompoundNode implements Node {          }          return str; +      } +    public Node getForStmt() { +        return forStmt; +    } + +    public Node getFuncDef() { +        return funcDef; +    } + +    public Node getIfNode() { +        return ifNode; +    } + +    public Node getWhileStmt() { +        return whileStmt; +    }  }  |