correction params
This commit is contained in:
@@ -64,9 +64,9 @@ functions returns [ArrayList<Function> out]
|
|||||||
;
|
;
|
||||||
|
|
||||||
function returns [Function out]:
|
function returns [Function out]:
|
||||||
FUNCTION t=type i=ident ParO liste_param ParF instr= instruction
|
FUNCTION t=type i=ident ParO v=liste_param ParF instr= instruction
|
||||||
{
|
{
|
||||||
$out=new FunctionImp($t.return_type, $i.out, $vars_locaux.out, $instr.out);
|
$out=new FunctionImp($t.return_type, $i.out, $v.out, $instr.out);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
|
|||||||
String str= indent + "PROTO "+proto.type().accept(this, "")+ " "+ proto.nom() + "(";
|
String str= indent + "PROTO "+proto.type().accept(this, "")+ " "+ proto.nom() + "(";
|
||||||
|
|
||||||
for(int i=0; i<proto.params().size();i++){
|
for(int i=0; i<proto.params().size();i++){
|
||||||
str+=proto.params().get(i);
|
str+=proto.params().get(i).accept(this, "");
|
||||||
if((i<proto.params().size()-1)){
|
if((i<proto.params().size()-1)){
|
||||||
str+=", ";
|
str+=", ";
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ public class PrettyprinterVisitor implements ProgramVisitor<String,String>,
|
|||||||
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.params().size();i++){
|
for(int i=0; i<fun.params().size();i++){
|
||||||
str+=fun.params().get(i);
|
str+=fun.params().get(i).accept(this, "");
|
||||||
if((i<fun.params().size()-1)){
|
if((i<fun.params().size()-1)){
|
||||||
str+=", ";
|
str+=", ";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Program{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Prototype
|
//Prototype
|
||||||
public static record PrototypeImp(Type type, String nom, ArrayList<String> params) implements Prototype{
|
public static record PrototypeImp(Type type, String nom, ArrayList<VarImp> params) implements Prototype{
|
||||||
@Override
|
@Override
|
||||||
public <H, S> S accept(PrototypeVisitor<H, S> v, H h) {
|
public <H, S> S accept(PrototypeVisitor<H, S> v, H h) {
|
||||||
return v.visitPrototype(this,h);
|
return v.visitPrototype(this,h);
|
||||||
|
|||||||
Reference in New Issue
Block a user