diff options
Diffstat (limited to 'src/ast/nodes/ExprNode.java')
-rw-r--r-- | src/ast/nodes/ExprNode.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/ast/nodes/ExprNode.java b/src/ast/nodes/ExprNode.java index 873d537..693176a 100644 --- a/src/ast/nodes/ExprNode.java +++ b/src/ast/nodes/ExprNode.java @@ -52,7 +52,7 @@ public class ExprNode implements Node { @Override public ArrayList<SemanticError> checkSemantics(SymbolTable ST, int _nesting) { - ArrayList<SemanticError> errors = new ArrayList(); + ArrayList<SemanticError> errors = new ArrayList<>(); // check if the atom is a function if (atom != null && !trailers.isEmpty()) { @@ -130,19 +130,22 @@ public class ExprNode implements Node { if (atom != null) { str += atom.toPrint(prefix); } - if (compOp != null) { str += compOp.toPrint(prefix); } - - for (var expr : exprs) { - str = expr.toPrint(prefix); - } - - for (var trailer : trailers) { - str = trailer.toPrint(prefix); + + if (exprs != null) { + for (var expr : exprs) { + str += expr.toPrint(prefix); + } } - + + if (trailers != null) { + for (var trailer : trailers) { + str += trailer.toPrint(prefix); + } + } + if (op != null) { str += prefix + "Op(" + op + ")\n"; } |