diff --git a/src/main/java/de/hsrm/compiler/Klang/visitors/PrettyPrintVisitor.java b/src/main/java/de/hsrm/compiler/Klang/visitors/PrettyPrintVisitor.java index da410f5..37e95e1 100644 --- a/src/main/java/de/hsrm/compiler/Klang/visitors/PrettyPrintVisitor.java +++ b/src/main/java/de/hsrm/compiler/Klang/visitors/PrettyPrintVisitor.java @@ -61,6 +61,13 @@ public class PrettyPrintVisitor implements Visitor { ex.nl(); ex.nl(); } + + for (var structDef: e.structs) { + structDef.welcome(this); + ex.nl(); + ex.nl(); + } + e.expression.welcome(this); ex.write(";"); return null; @@ -378,4 +385,24 @@ public class PrettyPrintVisitor implements Visitor { return null; } + @Override + public Void visit(StructDefinition e) { + ex.write("struct " + e.name + " {"); + ex.addIndent(); + for(var field: e.fields) { + ex.nl(); + field.welcome(this); + } + ex.subIndent(); + ex.nl(); + ex.write("}"); + return null; + } + + @Override + public Void visit(StructField e) { + ex.write(e.name +": " + e.type.getName() + ";"); + return null; + } + } \ No newline at end of file