From b37e9146d41a8920777aabeea2a4f6c5c2bc975e Mon Sep 17 00:00:00 2001 From: Vu Tuan Minh Date: Mon, 28 Apr 2025 06:30:35 +0200 Subject: [PATCH] fixer parser when there is no args --- src/main/antlr/VSLParser.g | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/antlr/VSLParser.g b/src/main/antlr/VSLParser.g index 568fa6b..c8b0150 100644 --- a/src/main/antlr/VSLParser.g +++ b/src/main/antlr/VSLParser.g @@ -31,10 +31,9 @@ liste_param returns [ArrayList out] @init{ $out = new ArrayList(); }: - ( - (ii1=ident {$out.add(new VarImp($ii1.out));}) + ii1=ident {$out.add(new VarImp($ii1.out));} (VIRGULE ii2=ident {$out.add(new VarImp($ii2.out));})* - )* + ; functions returns [ArrayList out] @@ -221,7 +220,7 @@ lit returns [Expression out]: } | t=ident ( - ParO (para=list_expression)? ParF {$out = new AppealImp($t.out,$para.out);} + ParO (para=list_expression)? ParF {$out = new AppealImp($t.out,($para.out !=null) ?$para.out : new ArrayList<>());} | {$out=new VarImp($t.out);} ) ;