retest non block with if then else

This commit is contained in:
Vu Tuan Minh
2025-04-10 12:43:08 +02:00
parent 28e0517f23
commit 754e12a9e5
4 changed files with 13 additions and 22 deletions

View File

@@ -103,9 +103,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent + "IF ";
str +=(instr.e().accept(this, ""));
str +=" THEN ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
return str;
}
@@ -114,13 +112,9 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent + "IF ";
str +=(instr.e().accept(this, ""));
str +=" THEN ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
str +=" ELSE ";
for(int i=0; i<instr.i2().size();i++){
str+= instr.i2().get(i).accept(this, "");
}
str+= instr.i2().accept(this, "");
return str;
}
@@ -139,9 +133,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
String str = indent+"WHILE ";
str += (instr.e().accept(this, ""));
str+= " DO ";
for(int i=0; i<instr.i1().size();i++){
str+= instr.i1().get(i).accept(this, "");
}
str+= instr.i1().accept(this, "");
str+= " DONE";
return str;
}