retest non block with if then else
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -102,21 +102,21 @@ public class Program{
|
||||
}
|
||||
}
|
||||
|
||||
public static record IfThenImp(Expression e, ArrayList<Instruction> i1) implements Instruction {
|
||||
public static record IfThenImp(Expression e, Instruction i1) implements Instruction {
|
||||
@Override
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitIfThen(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record IfThenElseImp(Expression e, ArrayList<Instruction> i1, ArrayList<Instruction> i2) implements Instruction {
|
||||
public static record IfThenElseImp(Expression e, Instruction i1, Instruction i2) implements Instruction {
|
||||
@Override
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitIfThenElse(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record WhileImp(Expression e, ArrayList<Instruction> i1) implements Instruction {
|
||||
public static record WhileImp(Expression e, Instruction i1) implements Instruction {
|
||||
@Override
|
||||
public <H, S> S accept(InstrVisitor<H, S> v, H h) {
|
||||
return v.visitWhile(this, h);
|
||||
|
||||
Reference in New Issue
Block a user