jsp c'est un arraylist de string ou varImp dans proto et func

This commit is contained in:
Vu Tuan Minh
2025-04-24 07:00:31 +02:00
parent 0ae9660fc5
commit a86f3433be
6 changed files with 24 additions and 8 deletions

View File

@@ -35,19 +35,29 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
@Override
public String visitPrototype(PrototypeImp proto, String indent){
String str= indent + "PROTO "+proto.type().accept(this, "")+ " "+ proto.nom() + "(";
for(int i=0; i<proto.s().size();i++){
str+=proto.s().get(i);
if((i<proto.s().size()-1)){
str+=", ";
}
}
return str+")";
}
//FUNCTION
@Override
public String visitFunction(FunctionImp fun, String indent) {
String str = indent+"FUNC " + fun.type().accept(this,"")+ " " + fun.nom() +"() ";
String str = indent+"FUNC " + fun.type().accept(this,"")+ " " + fun.nom() +"(";
for(int i=0; i<fun.s().size();i++){
str+=fun.s().get(i);
if((i<fun.s().size()-1)){
str+=", ";
}
}
str+= ") ";
str += fun.instruction().accept(this,indent)+"\n";
return str;
}